bootsplasher.sh 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #!/bin/bash
  2. # menu_plugin
  3. PLUGIN_NAME="Bootsplasher"
  4. PLUGIN_FUNCTION="Set custom boot splash"
  5. PLUGIN_DESCRIPTION="Simple plugin to set a custom boot splash from the user's downloads folder"
  6. PLUGIN_AUTHOR="rainestorme"
  7. PLUGIN_VERSION=1
  8. # to create a bootsplash tar.gz:
  9. # yt-dlp https://www.youtube.com/watch?v=Fnz9ljn1cwE -f mp4
  10. # ffmpeg -i <video>.mp4 -vf "fps=25" bootsplash/boot_splash_frame%03d.png
  11. # tar -czvf bootsplash.tar.gz bootsplash/
  12. doas() {
  13. ssh -t -p 1337 -i /rootkey -oStrictHostKeyChecking=no root@127.0.0.1 "$@"
  14. }
  15. copy_bootsplash_static() {
  16. echo "Copying bootsplash..."
  17. doas 'rm /usr/share/chromeos-assets/images_100_percent/boot_splash_frame*.png'
  18. doas 'cp /tmp/bootsplash.png /usr/share/chromeos-assets/images_100_percent/boot_splash_frame00.png'
  19. rm -f /tmp/bootsplash.png
  20. echo "Done!"
  21. }
  22. copy_bootsplash_animated() {
  23. echo "Copying bootsplash..."
  24. doas 'rm /usr/share/chromeos-assets/images_100_percent/boot_splash_frame*.png'
  25. doas 'cp /tmp/bootsplash/*.png /usr/share/chromeos-assets/images_100_percent/'
  26. rm -rf /tmp/bootsplash
  27. echo "Done!"
  28. }
  29. get_asset() {
  30. curl -s -f "https://api.github.com/repos/rainestorme/murkmod/contents/$1" | jq -r ".content" | base64 -d
  31. }
  32. install() {
  33. TMP=$(mktemp)
  34. get_asset "$1" >"$TMP"
  35. if [ "$?" == "1" ] || ! grep -q '[^[:space:]]' "$TMP"; then
  36. echo "Failed to install $1 to $2"
  37. rm -f "$TMP"
  38. exit
  39. fi
  40. # Don't mv, that would break permissions
  41. cat "$TMP" >"$2"
  42. rm -f "$TMP"
  43. }
  44. set_custom() {
  45. read -p 'Enter filename (downloads folder) > ' bootsplash
  46. cp "/home/chronos/user/Downloads/$bootsplash" /tmp/bootsplash.png
  47. copy_bootsplash_static
  48. }
  49. set_custom_animated() {
  50. read -p 'Enter folder name (downloads folder) > ' bootsplash
  51. cp -r "/home/chronos/user/Downloads/$bootsplash" /tmp/bootsplash
  52. copy_bootsplash_animated
  53. }
  54. restore_murkmod() {
  55. echo "Grabbing murkmod bootsplash..."
  56. install "chromeos-bootsplash-v2.png" /tmp/bootsplash.png
  57. copy_bootsplash_static
  58. }
  59. get_bootsplash() {
  60. echo "Installing bootsplash $1 to $2"
  61. pushd /tmp/
  62. curl -Lk https://raw.githubusercontent.com/rainestorme/bootsplashes/main/$1 -o $2
  63. popd
  64. }
  65. choose_bootsplash() {
  66. echo "Select a bootsplash:"
  67. echo " 1. Pip-boy"
  68. echo " 2. Valve Intro"
  69. echo " 3. PS2 Startup"
  70. echo " 4. Xbox Startup"
  71. echo " 5. Gamecube Startup"
  72. echo " 6. Apple Logo"
  73. read -r -p "> (1-5): " choice
  74. case "$choice" in
  75. 1) get_bootsplash "pipboy.tar.gz" /tmp/bootsplash.tar.gz ;;
  76. 2) get_bootsplash "valve.tar.gz" /tmp/bootsplash.tar.gz ;;
  77. 3) get_bootsplash "ps2.tar.gz" /tmp/bootsplash.tar.gz ;;
  78. 4) get_bootsplash "xbox.tar.gz" /tmp/bootsplash.tar.gz ;;
  79. 5) get_bootsplash "gamecube.tar.gz" /tmp/bootsplash.tar.gz ;;
  80. 6) get_bootsplash "apple.tar.gz" /tmp/bootsplash.tar.gz ;;
  81. *) echo && echo "Invalid option, dipshit." && echo ;;
  82. esac
  83. tar -xzf /tmp/bootsplash.tar.gz -C /tmp/
  84. copy_bootsplash_animated
  85. }
  86. echo "Make sure your bootsplash is in PNG format!"
  87. echo "Animated bootsplashes must be in a folder named 'bootsplash' in your downloads folder!"
  88. echo "Select an option:"
  89. echo " 1. Set custom static bootsplash"
  90. echo " 2. Set custom animated bootsplash"
  91. echo " 3. Restore murkmod default bootsplash"
  92. echo " 4. Choose from pre-made bootsplashes"
  93. read -r -p "> (1-4): " choice
  94. case "$choice" in
  95. 1) set_custom ;;
  96. 2) set_custom_animated ;;
  97. 3) restore_murkmod ;;
  98. 4) choose_bootsplash ;;
  99. *) echo && echo "Invalid option, dipshit." && echo ;;
  100. esac
  101. sync
  102. exit