wok-6.x annotate slitaz-fbsplash/stuff/tazfbsplash @ rev 10152
Up: gutenprint to 5.2.7.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Fri May 20 19:30:10 2011 +0000 (2011-05-20) |
parents | |
children |
rev | line source |
---|---|
pankso@8844 | 1 #!/bin/sh |
pankso@8844 | 2 # |
pankso@8844 | 3 # Tazfbsplash - Tool to manage and configure Busybox fbsplash on SliTaz |
pankso@8844 | 4 # (C) 2011 SliTaz - GNU General Public License. |
pankso@8844 | 5 # |
pankso@8844 | 6 # TODO: |
pankso@8844 | 7 # box - on/off with curent status |
pankso@8844 | 8 # box - change/install/remove themes |
pankso@8844 | 9 # check GRUB settings: quiet vga=* |
pankso@8844 | 10 # |
pankso@8844 | 11 |
pankso@8844 | 12 . /etc/rcS.conf |
pankso@8844 | 13 |
pankso@8844 | 14 # Functions |
pankso@8844 | 15 |
pankso@8844 | 16 . /usr/lib/slitaz/libtaz |
pankso@8844 | 17 source_lib commons |
pankso@8844 | 18 |
pankso@8844 | 19 usage() { |
pankso@8844 | 20 echo -e "\nSliTaz graphical boot configuration tool\n |
pankso@8844 | 21 \033[1mUsage:\033[0m `basename $0` [command] [theme] |
pankso@8844 | 22 \033[1mCommands: \033[0m |
pankso@8844 | 23 on Enable graphical boot. |
pankso@8844 | 24 off Disable graphical boot. |
pankso@8844 | 25 list-themes List all installed themes. |
pankso@8844 | 26 change-theme Change current theme. |
pankso@8844 | 27 pack-theme Pack a system theme in a tar archive. |
pankso@8844 | 28 install-theme Install a fbsplash-theme-* archive. |
pankso@8844 | 29 test Test a theme configuration (Must be run in text mode). |
pankso@8844 | 30 box Graphical configuration box.\n" |
pankso@8844 | 31 } |
pankso@8844 | 32 |
pankso@8844 | 33 separator() { |
pankso@8844 | 34 echo "================================================================================" |
pankso@8844 | 35 } |
pankso@8844 | 36 |
pankso@8844 | 37 change_theme() |
pankso@8844 | 38 { |
pankso@8844 | 39 sed -i s~FBSPLASH_THEME=.*~FBSPLASH_THEME=\"$new_theme\"~ /etc/rcS.conf |
pankso@8844 | 40 } |
pankso@8844 | 41 |
pankso@8844 | 42 # GUI box (not yet ready :-) |
pankso@8844 | 43 box() { |
pankso@8844 | 44 export MAIN_DIALOG=' |
pankso@8844 | 45 <window title="Tazfbsplash Box" icon-name="preferences-desktop-wallpaper"> |
pankso@8844 | 46 <vbox> |
pankso@8844 | 47 <text use-markup="true"> |
pankso@8844 | 48 <label>" |
pankso@8844 | 49 <b>SliTaz Fbsplash Box</b>"</label> |
pankso@8844 | 50 </text> |
pankso@8844 | 51 <text wrap="true" width-chars="50" use-markup="true"> |
pankso@8844 | 52 <label>"SliTaz graphical boot manager |
pankso@8844 | 53 "</label> |
pankso@8844 | 54 </text> |
pankso@8844 | 55 <hbox> |
pankso@8844 | 56 <text use-markup="true"> |
pankso@8844 | 57 <label>"<b>Theme:</b>"</label> |
pankso@8844 | 58 </text> |
pankso@8844 | 59 <entry> |
pankso@8844 | 60 <default>'$FBSPLASH_THEME'</default> |
pankso@8844 | 61 <variable>NEW_THEME</variable> |
pankso@8844 | 62 </entry> |
pankso@8844 | 63 <button> |
pankso@8844 | 64 <input file icon="text-editor"></input> |
pankso@8844 | 65 <action>editor /etc/fbsplash/$NEW_THEME/fbsplash.cfg</action> |
pankso@8844 | 66 </button> |
pankso@8844 | 67 <button> |
pankso@8844 | 68 <input file icon="forward"></input> |
pankso@8844 | 69 <action>tazfbsplash -ct $NEW_THEME</action> |
pankso@8844 | 70 </button> |
pankso@8844 | 71 </hbox> |
pankso@8844 | 72 <tree> |
pankso@8844 | 73 <width>320</width><height>120</height> |
pankso@8844 | 74 <variable>EDIT_THEME</variable> |
pankso@8844 | 75 <label>Themes list (double-click to edit config)</label> |
pankso@8844 | 76 <input>tazfbsplash -lt --box</input> |
pankso@8844 | 77 <action>editor /etc/fbsplash/$EDIT_THEME/fbsplash.cfg</action> |
pankso@8844 | 78 </tree> |
pankso@8844 | 79 <hbox> |
pankso@8844 | 80 <button> |
pankso@8844 | 81 <input file icon="exit"></input> |
pankso@8844 | 82 <action type="exit">exit</action> |
pankso@8844 | 83 </button> |
pankso@8844 | 84 </hbox> |
pankso@8844 | 85 </vbox> |
pankso@8844 | 86 </window>' |
pankso@8844 | 87 gtkdialog --center --program=MAIN_DIALOG |
pankso@8844 | 88 } |
pankso@8844 | 89 |
pankso@8844 | 90 # Commands |
pankso@8844 | 91 |
pankso@8844 | 92 case "$1" in |
pankso@8844 | 93 on) |
pankso@8844 | 94 # Enable graphical boot. |
pankso@8844 | 95 echo -en "\nEnabling SliTaz graphical boot..." |
pankso@8844 | 96 if [ ! `grep "rcS > /dev/null" /etc/inittab` ]; then |
pankso@8844 | 97 sed -i s'/rcS/rcS > \/dev\/null/' /etc/inittab |
pankso@8844 | 98 fi |
pankso@8844 | 99 sed -i s'/FBSPLASH="no"/FBSPLASH="yes"/' /etc/rcS.conf |
pankso@8844 | 100 status && echo "" ;; |
pankso@8844 | 101 off) |
pankso@8844 | 102 # Disable graphical boot. |
pankso@8844 | 103 echo -en "\nDisabling SliTaz graphical boot..." |
pankso@8844 | 104 sed -i s'/rcS > \/dev\/null/rcS/' /etc/inittab |
pankso@8844 | 105 sed -i s'/FBSPLASH="yes"/FBSPLASH="no"/' /etc/rcS.conf |
pankso@8844 | 106 status && echo "" ;; |
pankso@8844 | 107 list-themes|-lt) |
pankso@8844 | 108 # List all themes |
pankso@8844 | 109 if [ "$2" != "--box" ]; then |
pankso@8844 | 110 echo -en "\n\033[1mBoot splash themes\033[0m" |
pankso@8844 | 111 separator |
pankso@8844 | 112 fi |
pankso@8844 | 113 cd /etc/fbsplash |
pankso@8844 | 114 for i in * |
pankso@8844 | 115 do |
pankso@8844 | 116 [ -f "/etc/fbsplash/$i/fbsplash.cfg" ] && echo $i |
pankso@8844 | 117 done |
pankso@8844 | 118 [ "$2" != "--box" ] && echo "" ;; |
pankso@8844 | 119 change-theme|-ct) |
pankso@8844 | 120 new_theme="$2" |
pankso@8844 | 121 [ -z "$new_theme" ] && exit 0 |
pankso@8844 | 122 [ ! -d "/etc/fbsplash/$new_theme" ] && exit 0 |
pankso@8844 | 123 echo -n "Activing fbsplash theme: $new_theme" |
pankso@8844 | 124 change_theme && status ;; |
pankso@8844 | 125 pack-theme|-pt) |
pankso@8844 | 126 # Pack a theme into .tar.gz |
pankso@8844 | 127 theme="$2" |
pankso@8844 | 128 tmp=slitaz-fbsplash-$theme |
pankso@8844 | 129 if [ ! -d "/etc/fbsplash/$theme" ]; then |
pankso@8844 | 130 echo -e "\nNo theme found in: /etc/fbsplash/$theme\n" |
pankso@8844 | 131 exit 0 |
pankso@8844 | 132 fi |
pankso@8844 | 133 echo -n "Creating fbsplash theme archive for: $theme" |
pankso@8844 | 134 mkdir -p $tmp |
pankso@8844 | 135 cp -r /etc/fbsplash/$theme $tmp |
pankso@8844 | 136 cat > $tmp/README << EOT |
pankso@8844 | 137 SliTaz graphical boot theme |
pankso@8844 | 138 ================================================================================ |
pankso@8844 | 139 |
pankso@8844 | 140 This is a Busybox fbsplash theme created on and for SliTaz GNU/Linux. To use it |
pankso@8844 | 141 you can copy files manually to /etc/fbsplash or use 'tazfbsplash install-theme' |
pankso@8844 | 142 EOT |
pankso@8844 | 143 busybox tar czf slitaz-fbsplash-$theme.tar.gz $tmp |
pankso@8844 | 144 rm -rf $tmp && status ;; |
pankso@8844 | 145 install-theme|-it) |
pankso@8844 | 146 check_root |
pankso@8844 | 147 file=$2 |
pankso@8844 | 148 if [ ! -f "$file" ]; then |
pankso@8844 | 149 echo -e "\nNo theme archive: $file\n" |
pankso@8844 | 150 exit 0 |
pankso@8844 | 151 fi |
pankso@8844 | 152 echo -n "Installing fbsplash theme..." |
pankso@8844 | 153 tar xzf $file -C /tmp |
pankso@8844 | 154 rm /tmp/slitaz-fbsplash-*/README |
pankso@8844 | 155 cp -r /tmp/slitaz-fbsplash-*/* /etc/fbsplash |
pankso@8844 | 156 status ;; |
pankso@8844 | 157 test|-t) |
pankso@8844 | 158 # Test suite for fbsplash on SliTaz (must be run in text mode). |
pankso@8844 | 159 fbsplash -c \ |
pankso@8844 | 160 -s /etc/fbsplash/$FBSPLASH_THEME/fbsplash.ppm \ |
pankso@8844 | 161 -i /etc/fbsplash/$FBSPLASH_THEME/fbsplash.cfg \ |
pankso@8844 | 162 -f /etc/fbsplash/fifo & |
pankso@8844 | 163 for p in 0 10 20 30 40 50 60 70 80 90 100 |
pankso@8844 | 164 do |
pankso@8844 | 165 echo "$p" > /etc/fbsplash/fifo && sleep 1 |
pankso@8844 | 166 done > /dev/null |
pankso@8844 | 167 echo "exit" > /etc/fbsplash/fifo ;; |
pankso@8844 | 168 box|-b) |
pankso@8844 | 169 box ;; |
pankso@8844 | 170 *) |
pankso@8844 | 171 usage ;; |
pankso@8844 | 172 esac |
pankso@8844 | 173 exit 0 |