slitaz-tools rev 828

tazhw: clean up and remove box (use gtkdialog)
author Christophe Lincoln <pankso@slitaz.org>
date Wed Jan 29 01:00:37 2014 +0100 (2014-01-29)
parents 41572890bde8
children 6b444a8504e5
files tinyutils/tazhw
line diff
     1.1 --- a/tinyutils/tazhw	Wed Jan 22 18:33:16 2014 +0100
     1.2 +++ b/tinyutils/tazhw	Wed Jan 29 01:00:37 2014 +0100
     1.3 @@ -36,15 +36,6 @@
     1.4  EOT
     1.5  }
     1.6  
     1.7 -# Check if user is root to install, or remove packages.
     1.8 -check_root() {
     1.9 -	if test $(id -u) != 0 ; then
    1.10 -		echo -e "\nYou must be root to run `basename $0` with this option."
    1.11 -		echo -e "Please use 'su' and root password to become super-user.\n"
    1.12 -		exit 0
    1.13 -	fi
    1.14 -}
    1.15 -
    1.16  box_check_root() {
    1.17  	if test $(id -u) != 0 ; then
    1.18  		exec subox tazhw box
    1.19 @@ -107,12 +98,6 @@
    1.20  			check_firmware
    1.21  			load_module
    1.22  		done
    1.23 -		# yenta_socket = laptop
    1.24 -		if $(lsmod | grep -q "yenta_socket"); then
    1.25 -			grep -qs batt /etc/lxpanel/default/panels/panel || 
    1.26 -			sed -i 's/= cpu/= batt\n}\n\nPlugin {\n    type = cpu/' \
    1.27 -				/etc/lxpanel/default/panels/panel 2> /dev/null
    1.28 -		fi
    1.29  	fi
    1.30  }
    1.31  
    1.32 @@ -180,122 +165,6 @@
    1.33  		read i; exit 0"
    1.34  }
    1.35  
    1.36 -box() {
    1.37 -	export BIN=$0
    1.38 -	export MAIN_DIALOG='
    1.39 -<window title="Tazhw box" icon-name="computer">
    1.40 -<vbox>
    1.41 -	<text width-chars="54" use-markup="true">
    1.42 -		<label>"<b>Hardware auto-detection and configuration tool</b>"</label>
    1.43 -	</text>
    1.44 -	<frame Loaded Kernel Modules>
    1.45 -		<vbox>
    1.46 -			<tree>
    1.47 -				<width>470</width>
    1.48 -				<height>180</height>
    1.49 -				<variable>MODULE</variable>
    1.50 -				<label>Module|Description</label>
    1.51 -				<input>$BIN box_list</input>
    1.52 -				<action>refresh:MODULE</action>
    1.53 -			</tree>
    1.54 -			<hbox>
    1.55 -				<checkbox>
    1.56 -					<label>Auto install non-free Firmware       </label>
    1.57 -					<variable>INSTALL_FIRMARE</variable>
    1.58 -					<default>false</default>
    1.59 -				</checkbox>
    1.60 -				<button>
    1.61 -					<label>Discover PCI/USB devices</label>
    1.62 -					<input file icon="folder-saved-search"></input>
    1.63 -					<action>$BIN box_detect_devices</action>
    1.64 -					<action>refresh:MODULE</action>
    1.65 -				</button>
    1.66 -			</hbox>
    1.67 -		</vbox>
    1.68 -	</frame>
    1.69 -	<frame Hardware Setup>
    1.70 -		<hbox>
    1.71 -			<button>
    1.72 -				<label>Printer</label>
    1.73 -				<input file icon="printer"></input>
    1.74 -				<action>export DEVICE="printer";$BIN box_setup_devices</action>
    1.75 -			</button>
    1.76 -			<button>
    1.77 -				<label>Scanner</label>
    1.78 -				<input file icon="x-office-document"></input>
    1.79 -				<action>export DEVICE="scanner";$BIN box_setup_devices</action>
    1.80 -			</button>
    1.81 -			<button>
    1.82 -				<label>3G-Modem</label>
    1.83 -				<input file icon="network-transmit-receive"></input>
    1.84 -				<action>export DEVICE="3g-modem";$BIN box_setup_devices</action>
    1.85 -			</button>
    1.86 -			<button>
    1.87 -				<label>Nvidia</label>
    1.88 -				<input file icon="video-display"></input>
    1.89 -				<action>export DEVICE="nvidia";$BIN box_setup_devices</action>
    1.90 -			</button>
    1.91 -			<button>
    1.92 -				<label>ATI Radeon</label>
    1.93 -				<input file icon="video-display"></input>
    1.94 -				<action>export DEVICE="ati";$BIN box_setup_devices</action>
    1.95 -			</button>
    1.96 -		</hbox>
    1.97 -		<hbox>
    1.98 -			<button>
    1.99 -				<label>Webcam     </label>
   1.100 -				<input file icon="camera-video"></input>
   1.101 -				<action>export DEVICE="webcam";$BIN box_setup_devices</action>
   1.102 -			</button>
   1.103 -			<button>
   1.104 -				<label>Digital Camera    </label>
   1.105 -				<input file icon="camera-photo"></input>
   1.106 -				<action>export DEVICE="camera";$BIN box_setup_devices</action>
   1.107 -			</button>
   1.108 -			<button>
   1.109 -				<label>Bluetooth   </label>
   1.110 -				<input file icon="preferences-desktop-multimedia"></input>
   1.111 -				<action>export DEVICE="bluetooth";$BIN box_setup_devices</action>
   1.112 -			</button>
   1.113 -			<button>
   1.114 -				<label>Firewall    </label>
   1.115 -				<input file icon="gtk-network"></input>
   1.116 -				<action>export DEVICE="firewall";$BIN box_setup_devices</action>
   1.117 -			</button>
   1.118 -		</hbox>
   1.119 -		<hbox>
   1.120 -			<checkbox>
   1.121 -				<label>Install non-free packages      </label>
   1.122 -				<variable>INSTALL_NON_FREE</variable>
   1.123 -				<default>true</default>
   1.124 -			</checkbox>
   1.125 -			<checkbox>
   1.126 -				<label>Auto-install all optional packages    </label>
   1.127 -				<variable>AUTO_INSTALL_SUGGESTED</variable>
   1.128 -				<default>false</default>
   1.129 -			</checkbox>
   1.130 -		</hbox>
   1.131 -		<hbox>
   1.132 -			<checkbox>
   1.133 -				<label>Choose optional packages to install</label>
   1.134 -				<variable>CONFIRM_INSTALL_SUGGESTED</variable>
   1.135 -				<default>false</default>
   1.136 -			</checkbox>
   1.137 -		</hbox>
   1.138 -	</frame>
   1.139 -	<hbox>
   1.140 -		<button>
   1.141 -				<label>Exit</label>
   1.142 -				<input file icon="exit"></input>
   1.143 -				<action type="exit">Exit</action>
   1.144 -			</button>
   1.145 -	</hbox>
   1.146 -</vbox>
   1.147 -</window>'
   1.148 -
   1.149 -	gtkdialog --center --program=MAIN_DIALOG >/dev/null
   1.150 -}
   1.151 -
   1.152  # Get firmware used by check_firmware()
   1.153  if [ "$2" == "--get-firmware" ]; then
   1.154  	firmware='get'
   1.155 @@ -323,10 +192,8 @@
   1.156  		separator; newline ;;
   1.157  	setup)
   1.158  		SETUP_OPTIONS=$(echo "$@" | sed 's/setup//')
   1.159 +		check_root
   1.160  		hwsetup $SETUP_OPTIONS ;;
   1.161 -	box*)
   1.162 -		box_check_root
   1.163 -		$1 ;;
   1.164  	detected-modules)
   1.165  		newline; _ 'Detected PCI and USB modules'; separator
   1.166  		cat /var/lib/detected-modules