wok diff slitaz-fbsplash/stuff/tazfbsplash @ rev 9215

mc, samba, perl-curses: use ncursesw instead of ncurses
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Mar 11 11:47:15 2011 +0100 (2011-03-11)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/slitaz-fbsplash/stuff/tazfbsplash	Fri Mar 11 11:47:15 2011 +0100
     1.3 @@ -0,0 +1,173 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# Tazfbsplash - Tool to manage and configure Busybox fbsplash on SliTaz
     1.7 +# (C) 2011 SliTaz - GNU General Public License.
     1.8 +#
     1.9 +# TODO:
    1.10 +#	box - on/off with curent status 
    1.11 +#	box - change/install/remove themes
    1.12 +#   check GRUB settings: quiet vga=*
    1.13 +#
    1.14 +
    1.15 +. /etc/rcS.conf
    1.16 +
    1.17 +# Functions
    1.18 +
    1.19 +. /usr/lib/slitaz/libtaz
    1.20 +source_lib commons
    1.21 +
    1.22 +usage() {
    1.23 +	echo -e "\nSliTaz graphical boot configuration tool\n
    1.24 +\033[1mUsage:\033[0m `basename $0` [command] [theme]
    1.25 +\033[1mCommands: \033[0m
    1.26 +  on             Enable graphical boot.
    1.27 +  off            Disable graphical boot.
    1.28 +  list-themes    List all installed themes.
    1.29 +  change-theme   Change current theme.
    1.30 +  pack-theme     Pack a system theme in a tar archive.
    1.31 +  install-theme  Install a fbsplash-theme-* archive.
    1.32 +  test           Test a theme configuration (Must be run in text mode).
    1.33 +  box            Graphical configuration box.\n"
    1.34 +}
    1.35 +
    1.36 +separator() {
    1.37 +	echo "================================================================================"
    1.38 +}
    1.39 +
    1.40 +change_theme()
    1.41 +{
    1.42 +	sed -i s~FBSPLASH_THEME=.*~FBSPLASH_THEME=\"$new_theme\"~ /etc/rcS.conf
    1.43 +}
    1.44 +
    1.45 +# GUI box (not yet ready :-)
    1.46 +box() {
    1.47 +	export MAIN_DIALOG='
    1.48 +	<window title="Tazfbsplash Box" icon-name="preferences-desktop-wallpaper">
    1.49 +	<vbox>
    1.50 +		<text use-markup="true">
    1.51 +			<label>"
    1.52 +<b>SliTaz Fbsplash Box</b>"</label>
    1.53 +		</text>
    1.54 +		<text wrap="true" width-chars="50" use-markup="true">
    1.55 +			<label>"SliTaz graphical boot manager
    1.56 +			"</label>
    1.57 +		</text>
    1.58 +		<hbox>
    1.59 +			<text use-markup="true">
    1.60 +				<label>"<b>Theme:</b>"</label>
    1.61 +			</text>
    1.62 +			<entry>
    1.63 +				<default>'$FBSPLASH_THEME'</default>
    1.64 +				<variable>NEW_THEME</variable>
    1.65 +			</entry>
    1.66 +			<button>
    1.67 +				<input file icon="text-editor"></input>
    1.68 +				<action>editor /etc/fbsplash/$NEW_THEME/fbsplash.cfg</action>
    1.69 +			</button>
    1.70 +			<button>
    1.71 +				<input file icon="forward"></input>
    1.72 +				<action>tazfbsplash -ct $NEW_THEME</action>
    1.73 +			</button>
    1.74 +		</hbox>
    1.75 +		<tree>
    1.76 +			<width>320</width><height>120</height>
    1.77 +			<variable>EDIT_THEME</variable>
    1.78 +			<label>Themes list (double-click to edit config)</label>
    1.79 +			<input>tazfbsplash -lt --box</input>
    1.80 +			<action>editor /etc/fbsplash/$EDIT_THEME/fbsplash.cfg</action>
    1.81 +		</tree>
    1.82 +		<hbox>
    1.83 +			<button>
    1.84 +				<input file icon="exit"></input>
    1.85 +				<action type="exit">exit</action>
    1.86 +			</button>
    1.87 +		</hbox>
    1.88 +	</vbox>
    1.89 +	</window>'
    1.90 +	gtkdialog --center --program=MAIN_DIALOG 
    1.91 +}
    1.92 +
    1.93 +# Commands
    1.94 +
    1.95 +case "$1" in
    1.96 +	on)
    1.97 +		# Enable graphical boot.
    1.98 +		echo -en "\nEnabling SliTaz graphical boot..."
    1.99 +		if [ ! `grep "rcS > /dev/null" /etc/inittab` ]; then
   1.100 +			sed -i s'/rcS/rcS > \/dev\/null/' /etc/inittab
   1.101 +		fi
   1.102 +		sed -i s'/FBSPLASH="no"/FBSPLASH="yes"/' /etc/rcS.conf
   1.103 +		status && echo "" ;;
   1.104 +	off)
   1.105 +		# Disable graphical boot.
   1.106 +		echo -en "\nDisabling SliTaz graphical boot..."
   1.107 +		sed -i s'/rcS > \/dev\/null/rcS/' /etc/inittab
   1.108 +		sed -i s'/FBSPLASH="yes"/FBSPLASH="no"/' /etc/rcS.conf
   1.109 +		status && echo "" ;;
   1.110 +	list-themes|-lt)
   1.111 +		# List all themes
   1.112 +		if [ "$2" != "--box" ]; then
   1.113 +			echo -en "\n\033[1mBoot splash themes\033[0m"
   1.114 +			separator
   1.115 +		fi
   1.116 +		cd /etc/fbsplash
   1.117 +		for i in *
   1.118 +		do
   1.119 +			[ -f "/etc/fbsplash/$i/fbsplash.cfg" ] && echo $i
   1.120 +		done
   1.121 +		[ "$2" != "--box" ] && echo "" ;;
   1.122 +	change-theme|-ct)
   1.123 +		new_theme="$2"
   1.124 +		[ -z "$new_theme" ] && exit 0
   1.125 +		[ ! -d "/etc/fbsplash/$new_theme" ] && exit 0
   1.126 +		echo -n "Activing fbsplash theme: $new_theme"
   1.127 +		change_theme && status ;;
   1.128 +	pack-theme|-pt)
   1.129 +		# Pack a theme into .tar.gz
   1.130 +		theme="$2"
   1.131 +		tmp=slitaz-fbsplash-$theme
   1.132 +		if [ ! -d "/etc/fbsplash/$theme" ]; then
   1.133 +			echo -e "\nNo theme found in: /etc/fbsplash/$theme\n"
   1.134 +			exit 0
   1.135 +		fi
   1.136 +		echo -n "Creating fbsplash theme archive for: $theme"
   1.137 +		mkdir -p $tmp
   1.138 +		cp -r /etc/fbsplash/$theme $tmp
   1.139 +		cat > $tmp/README << EOT
   1.140 +SliTaz graphical boot theme
   1.141 +================================================================================
   1.142 +
   1.143 +This is a Busybox fbsplash theme created on and for SliTaz GNU/Linux. To use it
   1.144 +you can copy files manually to /etc/fbsplash or use 'tazfbsplash install-theme'
   1.145 +EOT
   1.146 +		busybox tar czf slitaz-fbsplash-$theme.tar.gz $tmp
   1.147 +		rm -rf $tmp && status ;;
   1.148 +	install-theme|-it)
   1.149 +		check_root
   1.150 +		file=$2
   1.151 +		if [ ! -f "$file" ]; then
   1.152 +			echo -e "\nNo theme archive: $file\n"
   1.153 +			exit 0
   1.154 +		fi
   1.155 +		echo -n "Installing fbsplash theme..."
   1.156 +		tar xzf $file -C /tmp
   1.157 +		rm /tmp/slitaz-fbsplash-*/README
   1.158 +		cp -r /tmp/slitaz-fbsplash-*/* /etc/fbsplash
   1.159 +		status ;;
   1.160 +	test|-t)
   1.161 +		# Test suite for fbsplash on SliTaz (must be run in text mode).
   1.162 +		fbsplash -c \
   1.163 +			-s /etc/fbsplash/$FBSPLASH_THEME/fbsplash.ppm \
   1.164 +			-i /etc/fbsplash/$FBSPLASH_THEME/fbsplash.cfg \
   1.165 +			-f /etc/fbsplash/fifo &
   1.166 +		for p in 0 10 20 30 40 50 60 70 80 90 100
   1.167 +		do
   1.168 +			echo "$p" > /etc/fbsplash/fifo && sleep 1
   1.169 +		done > /dev/null
   1.170 +		echo "exit" > /etc/fbsplash/fifo ;;
   1.171 +	box|-b)
   1.172 +		box ;;
   1.173 +	*)
   1.174 +		usage ;;
   1.175 +esac
   1.176 +exit 0