slitaz-tools rev 830

tazhw: some more clean-up
author Christophe Lincoln <pankso@slitaz.org>
date Wed Jan 29 02:11:40 2014 +0100 (2014-01-29)
parents 6b444a8504e5
children 6fec8f07e755
files tinyutils/tazhw
line diff
     1.1 --- a/tinyutils/tazhw	Wed Jan 29 01:48:09 2014 +0100
     1.2 +++ b/tinyutils/tazhw	Wed Jan 29 02:11:40 2014 +0100
     1.3 @@ -12,7 +12,7 @@
     1.4  #          Rohit Joshi <jozee@slitaz.org>
     1.5  #
     1.6  . /lib/libtaz.sh
     1.7 -export TEXTDOMAIN='slitaz-boxes' #i18n
     1.8 +export TEXTDOMAIN='slitaz-tools' # i18n text mode
     1.9  
    1.10  usage() {
    1.11  	cat << EOT
    1.12 @@ -23,7 +23,6 @@
    1.13  
    1.14  $(boldify "$(_n 'Commands:')")
    1.15    usage             $(_n 'Print this short usage.')
    1.16 -  box               $(_n 'Start in graphical mode.')
    1.17    init              $(_n 'Used at boot time to configure devices.')
    1.18    setup             $(_n 'Setup hardware devices.')
    1.19    detect-pci        $(_n 'Detect all PCI devices.')
    1.20 @@ -36,13 +35,6 @@
    1.21  EOT
    1.22  }
    1.23  
    1.24 -box_check_root() {
    1.25 -	if test $(id -u) != 0 ; then
    1.26 -		exec subox tazhw box
    1.27 -		exit 0
    1.28 -	fi
    1.29 -}
    1.30 -
    1.31  check_firmware() {
    1.32  	if [ -x /usr/bin/get-$mod-firmware ]; then
    1.33  		if [ ! -d /var/lib/tazpkg/installed/$mod-firmware ]; then
    1.34 @@ -131,49 +123,6 @@
    1.35  	fi
    1.36  }
    1.37  
    1.38 -# Box functions and dialog
    1.39 -
    1.40 -box_list() {
    1.41 -	for mod in $(cat /var/lib/detected-modules /var/lib/detected-usb-modules 2>/dev/null); do
    1.42 -		desc=$(modinfo $mod | grep ^description | cut -d":" -f2)
    1.43 -		[ -z "$desc" ] && desc="N/A"
    1.44 -		echo "$mod | $desc"
    1.45 -	done
    1.46 -}
    1.47 -
    1.48 -box_detect_devices() {
    1.49 -	if [ $INSTALL_FIRMARE != true ]; then
    1.50 -		xterm -T "Detect devices" \
    1.51 -			-geometry 80x24 \
    1.52 -			-e "$0 detect-pci; $0 detect-usb; \
    1.53 -			echo -e \"----\nPress ENTER to close...\"; \
    1.54 -			read i; exit 0"
    1.55 -	else
    1.56 -		xterm -T "Detect and get firmware" \
    1.57 -			-geometry 80x24 \
    1.58 -			-e "$0 detect-pci --get-firmware; \
    1.59 -			$0 detect-usb --get-firmware; \
    1.60 -			echo -e \"----\nPress ENTER to close...\"; \
    1.61 -			read i; exit 0"
    1.62 -	fi
    1.63 -}
    1.64 -
    1.65 -box_setup_devices() {
    1.66 -	SETUP_OPTIONS=""
    1.67 -	if [ $INSTALL_NON_FREE == true ]; then 
    1.68 -		SETUP_OPTIONS="$SETUP_OPTIONS --non-free"
    1.69 -	fi
    1.70 -	if [ $AUTO_INSTALL_SUGGESTED == true ]; then
    1.71 -		SETUP_OPTIONS="$SETUP_OPTIONS --suggested"
    1.72 -	elif [ $CONFIRM_INSTALL_SUGGESTED == true ]; then
    1.73 -		SETUP_OPTIONS="$SETUP_OPTIONS --confirm"
    1.74 -	fi
    1.75 -	xterm -geometry 80x24 -T "$DEVICE Setup" \
    1.76 -		-e "$0 setup $DEVICE $SETUP_OPTIONS; \
    1.77 -		echo -e \"----\nPress ENTER to close...\"; \
    1.78 -		read i; exit 0"
    1.79 -}
    1.80 -
    1.81  # Get firmware used by check_firmware()
    1.82  if [ "$2" == "--get-firmware" ]; then
    1.83  	firmware='get'
    1.84 @@ -181,34 +130,34 @@
    1.85  
    1.86  # What to do.
    1.87  case "$1" in
    1.88 -	init)
    1.89 +	-i|init)
    1.90  		check_root
    1.91  		_ 'Detecting PCI devices Kernel modules...'
    1.92  		detect_pci_devices
    1.93  		_ 'Detecting USB devices Kernel modules...'
    1.94  		detect_usb_devices ;;
    1.95 -	detect-pci)
    1.96 +	-dp|detect-pci)
    1.97  		check_root
    1.98  		newline; _ 'Detected PCI devices Kernel modules'; separator
    1.99  		rm -f /var/lib/detected-modules
   1.100  		detect_pci_devices
   1.101  		separator; newline ;;
   1.102 -	detect-usb)
   1.103 +	-du|detect-usb)
   1.104  		check_root
   1.105  		newline; _ 'Detected USB devices Kernel modules'; separator
   1.106  		rm -f /var/lib/detected-usb-modules
   1.107  		detect_usb_devices
   1.108  		separator; newline ;;
   1.109 -	setup)
   1.110 +	-s|setup)
   1.111  		SETUP_OPTIONS=$(echo "$@" | sed 's/setup//')
   1.112  		check_root
   1.113  		hwsetup $SETUP_OPTIONS ;;
   1.114 -	detected-modules)
   1.115 +	-dm|detected-modules)
   1.116  		newline; _ 'Detected PCI and USB modules'; separator
   1.117  		cat /var/lib/detected-modules
   1.118  		cat /var/lib/detected-usb-modules 2>/dev/null
   1.119  		separator; newline ;;
   1.120 -	*)
   1.121 +	*) 
   1.122  		usage ;;
   1.123  esac
   1.124