tazpanel rev 81
Use httpd_helper parser (GET)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Apr 13 16:41:02 2011 +0200 (2011-04-13) |
parents | 149c1821e9f6 |
children | a797e9424727 |
files | boot.cgi hardware.cgi index.cgi lib/libtazpanel live.cgi network.cgi pkgs.cgi settings.cgi |
line diff
1.1 --- a/boot.cgi Wed Apr 13 12:40:15 2011 +0200 1.2 +++ b/boot.cgi Wed Apr 13 16:41:02 2011 +0200 1.3 @@ -4,12 +4,11 @@ 1.4 # 1.5 # Copyright (C) 2011 SliTaz GNU/Linux - GNU gpl v3 1.6 # 1.7 -echo "Content-Type: text/html" 1.8 -echo "" 1.9 1.10 # Common functions from libtazpanel and source main boot config file. 1.11 . lib/libtazpanel 1.12 . /etc/rcS.conf 1.13 +header 1.14 get_config 1.15 1.16 # Include gettext helper script. 1.17 @@ -25,21 +24,20 @@ 1.18 # Commands 1.19 # 1.20 1.21 -case "$QUERY_STRING" in 1.22 - daemons*) 1.23 +case " $(GET) " in 1.24 + *\ daemons\ *) 1.25 # 1.26 # Everything until user login 1.27 # 1.28 # Start and stop a daemon. I think we dont need restart since 2 1.29 # clicks and you are done 1.30 - case "$QUERY_STRING" in 1.31 - *=start=*) 1.32 - daemon=${QUERY_STRING#*=start=} 1.33 + daemon=$(GET daemons) 1.34 + case "$daemon" in 1.35 + start=*) 1.36 sleep 1 1.37 - /etc/init.d/$daemon start | log ;; 1.38 - *=stop=*) 1.39 - daemon=${QUERY_STRING#*=stop=} 1.40 - /etc/init.d/$daemon stop | log ;; 1.41 + /etc/init.d/${daemon#start=} start | log ;; 1.42 + stop=*) 1.43 + /etc/init.d/${daemon#stop=} stop | log ;; 1.44 esac 1.45 . /etc/rcS.conf 1.46 TITLE="- Boot"
2.1 --- a/hardware.cgi Wed Apr 13 12:40:15 2011 +0200 2.2 +++ b/hardware.cgi Wed Apr 13 16:41:02 2011 +0200 2.3 @@ -4,12 +4,11 @@ 2.4 # 2.5 # Copyright (C) 2011 SliTaz GNU/Linux - GNU gpl v3 2.6 # 2.7 -echo "Content-Type: text/html" 2.8 -echo "" 2.9 2.10 # Common functions from libtazpanel 2.11 . lib/libtazpanel 2.12 get_config 2.13 +header 2.14 2.15 # Include gettext helper script. 2.16 . /usr/bin/gettext.sh 2.17 @@ -24,11 +23,10 @@ 2.18 # Commands 2.19 # 2.20 2.21 -case "$QUERY_STRING" in 2.22 - print*) 2.23 +case " $(GET) " in 2.24 + *\ print\ *) 2.25 echo "TODO" ;; 2.26 - modules*|modinfo=*) 2.27 - query_string_parser 2.28 + *\ modules\ *|*\ modinfo\ *) 2.29 xhtml_header 2.30 cat << EOT 2.31 <div id="wrapper"> 2.32 @@ -43,33 +41,34 @@ 2.33 </div> 2.34 EOT 2.35 # Request may be modinfo output that we want in the page itself 2.36 - case "$QUERY_STRING" in 2.37 - modinfo=*) 2.38 - echo '<strong>' 2.39 - gettext "Detailed information for module: "; echo "$WANT" 2.40 - echo '</strong>' 2.41 - echo '<pre>' 2.42 - modinfo $WANT 2.43 - echo '</pre>' ;; 2.44 - modprobe=*) 2.45 - echo '<pre>' 2.46 - modprobe -v $WANT 2.47 - echo '</pre>' ;; 2.48 - rmmod=*) 2.49 - #modprobe -r $WANT 2.50 - echo "Removing" 2.51 - rmmod -w $WANT ;; 2.52 - *search=*) 2.53 - gettext "Matching result(s) for: "; echo "$VAR_1" 2.54 - echo '<pre>' 2.55 - modprobe -l | grep "$VAR_1" | while read line 2.56 - do 2.57 - name=$(basename $line) 2.58 - mod=${name%.ko.gz} 2.59 - echo "Module : <a href='$SCRIPT_NAME?modinfo=$mod'>$mod</a> " 2.60 - done 2.61 - echo '</pre>' ;; 2.62 - esac 2.63 + if [ -n "$(GET modinfo)" ]; then 2.64 + echo '<strong>' 2.65 + gettext "Detailed information for module: "; echo "$(GET modinfo)" 2.66 + echo '</strong>' 2.67 + echo '<pre>' 2.68 + modinfo $(GET modinfo) 2.69 + echo '</pre>' 2.70 + fi 2.71 + if [ -n "$(GET modprobe)" ]; then 2.72 + echo '<pre>' 2.73 + modprobe -v $(GET modprobe) 2.74 + echo '</pre>' 2.75 + fi 2.76 + if [ -n "$(GET rmmod)" ]; then 2.77 + echo "Removing" 2.78 + rmmod -w $(GET rmmod) 2.79 + fi 2.80 + if [ -n "$(GET search)" ]; then 2.81 + gettext "Matching result(s) for: "; echo "$(GET search)" 2.82 + echo '<pre>' 2.83 + modprobe -l | grep "$(GET search)" | while read line 2.84 + do 2.85 + name=$(basename $line) 2.86 + mod=${name%.ko.gz} 2.87 + echo "Module : <a href='$SCRIPT_NAME?modinfo=$mod'>$mod</a> " 2.88 + done 2.89 + echo '</pre>' 2.90 + fi 2.91 cat << EOT 2.92 `table_start` 2.93 <tr class="thead">
3.1 --- a/index.cgi Wed Apr 13 12:40:15 2011 +0200 3.2 +++ b/index.cgi Wed Apr 13 16:41:02 2011 +0200 3.3 @@ -6,13 +6,11 @@ 3.4 # 3.5 # Copyright (C) 2011 SliTaz GNU/Linux - GNU gpl v3 3.6 # 3.7 -echo "Content-Type: text/html" 3.8 -echo "" 3.9 3.10 # Common functions from libtazpanel 3.11 . lib/libtazpanel 3.12 get_config 3.13 -query_string_parser 3.14 +header 3.15 3.16 # Include gettext helper script. 3.17 . /usr/bin/gettext.sh 3.18 @@ -25,76 +23,47 @@ 3.19 # Things to do before displaying the page 3.20 # 3.21 3.22 -case "$QUERY_STRING" in 3.23 - panel-pass=*) 3.24 - new=${QUERY_STRING#*=} 3.25 - sed -i s@/:root:.*@/:root:$new@ $HTTPD_CONF ;; 3.26 - *) continue ;; 3.27 -esac 3.28 +[ -n "$(GET panel_pass)" ] && 3.29 + sed -i s@/:root:.*@/:root:$(GET panel_pass)@ $HTTPD_CONF 3.30 3.31 # 3.32 # Commands 3.33 # 3.34 3.35 -case "$QUERY_STRING" in 3.36 - file=*) 3.37 +case " $(GET) " in 3.38 + *\ file\ *) 3.39 # 3.40 # Handle files (may have an edit function, we will see) 3.41 # 3.42 TITLE="- File" 3.43 xhtml_header 3.44 - echo "<h2>$WANT</h2>" 3.45 + file="$(GET file)" 3.46 + echo "<h2>$file</h2>" 3.47 echo '<pre>' 3.48 # Handle file type by extension as a Web Server does it. 3.49 - case "$WANT" in 3.50 + case "$file" in 3.51 *.conf|*.lst) 3.52 - cat $WANT | syntax_highlighter conf ;; 3.53 + syntax_highlighter conf ;; 3.54 *.sh|*.cgi) 3.55 - cat $WANT | syntax_highlighter sh ;; 3.56 + syntax_highlighter sh ;; 3.57 *) 3.58 - cat $WANT ;; 3.59 - esac 3.60 + cat ;; 3.61 + esac < $file 3.62 echo '</pre>' ;; 3.63 - debug*) 3.64 + *\ debug\ *) 3.65 TITLE="- Debug" 3.66 xhtml_header 3.67 - cat << EOT 3.68 -<h2>QUERY_STRING</h2> 3.69 -<pre> 3.70 -QUERY_STRING="$QUERY_STRING" 3.71 - 3.72 -Fuction: query_string_parser (<a href="?debug=test=var1=var2">test</a>) 3.73 - 3.74 -CASE="$CASE" 3.75 -WANT="$WANT" 3.76 -VAR_1="$VAR_1" 3.77 -VAR_2="$VAR_2" 3.78 -</pre> 3.79 -EOT 3.80 echo '<h2>HTTP Environment</h2>' 3.81 - local var 3.82 - local info 3.83 echo '<pre>' 3.84 - for var in SERVER_SOFTWARE SERVER_NAME SERVER_PORT GATEWAY_INTERFACE \ 3.85 - AUTH_TYPE REMOTE_ADDR REMOTE_PORT HTTP_HOST HTTP_USER_AGENT \ 3.86 - HTTP_ACCEPT_LANGUAGE REQUEST_METHOD REQUEST_URI QUERY_STRING \ 3.87 - CONTENT_LENGTH CONTENT_TYPE SCRIPT_NAME SCRIPT_FILENAME PWD 3.88 - do 3.89 - eval info=\$$var 3.90 - echo "$var=\"$info\"" 3.91 - done 3.92 + httpinfo 3.93 echo '</pre>' ;; 3.94 *) 3.95 # 3.96 # Default xHTML content 3.97 # 3.98 xhtml_header 3.99 - case "$QUERY_STRING" in 3.100 - gen-locale=*) 3.101 - new_locale=${QUERY_STRING#gen-locale=} ;; 3.102 - rdate) 3.103 - echo "" ;; 3.104 - esac 3.105 + [ -n "$(GET gen_locale)" ] && new_locale=$(GET gen_locale) 3.106 + [ -n "$(GET rdate)" ] && echo "" 3.107 cat << EOT 3.108 <div id="wrapper"> 3.109 <h2>`gettext "Host:"` `hostname`</h2> 3.110 @@ -131,7 +100,7 @@ 3.111 <form method="get" action="$SCRIPT_NAME"> 3.112 <div> 3.113 `gettext "Panel password:"` 3.114 - <input type="password" name="panel-pass"/> 3.115 + <input type="password" name="panel_pass"/> 3.116 <input type="submit" value="`gettext "Change"`" /> 3.117 </div> 3.118 </form>
4.1 --- a/lib/libtazpanel Wed Apr 13 12:40:15 2011 +0200 4.2 +++ b/lib/libtazpanel Wed Apr 13 16:41:02 2011 +0200 4.3 @@ -3,6 +3,9 @@ 4.4 # Common functions for TazPanel CGI and cmdline interface 4.5 # 4.6 4.7 +# Get parameters with GET, POST and FILE functions 4.8 +. /usr/bin/httpd_helper.sh 4.9 + 4.10 # Include gettext helper script. 4.11 . /usr/bin/gettext.sh 4.12 4.13 @@ -20,23 +23,6 @@ 4.14 exit 1 4.15 } 4.16 4.17 -# TazPanel QUERY_STRING parser returns: CASE WANT VAR_1 VAR_4 4.18 -# we use that to help get URL string variables and user names 4.19 -query_string_parser() { 4.20 - id=0 4.21 - for var in $(echo "$QUERY_STRING" | sed s'@=@ @'g) 4.22 - do 4.23 - id=$((id + 1)) 4.24 - var=${var#&} 4.25 - case "$id" in 4.26 - '1') CASE=${var% } ;; 4.27 - '2') WANT=${var% } ;; 4.28 - '3') VAR_1=${var% } ;; 4.29 - '4') VAR_2=${var% } ;; 4.30 - esac 4.31 - done 4.32 -} 4.33 - 4.34 # Syntax highlighting for config file and SHell scripts 4.35 # HTML entities: -e 's|&|\&|g' -e 's|<|\<|g' -e 's|>|\>|g' 4.36 syntax_highlighter() { 4.37 @@ -115,10 +101,29 @@ 4.38 xhtml_header() { 4.39 cat ${PANEL}$HEADER | sed s/'- %TITLE%'/"$TITLE"/ 4.40 if [ $DEBUG == "1" ]; then 4.41 + local i 4.42 + local j 4.43 + local x 4.44 + args="" 4.45 + for x in GET POST COOKIE ; do 4.46 + for i in $($x) ; do 4.47 + if [ $($x $i count) -gt 1 ]; then 4.48 + for j in $(seq 1 $($x $i count)); do 4.49 + args="$args $x($i,$j)='$($x $i $j)'" 4.50 + done 4.51 + else 4.52 + args="$args $x($i)='$($x $i)'" 4.53 + fi 4.54 + done 4.55 + done 4.56 + for i in $(FILE); do 4.57 + for j in name size type tmpname ; do 4.58 + args="$args FILE($i,$j)=$(FILE $i $j)" 4.59 + done 4.60 + done 4.61 cat << EOT 4.62 <pre class='debug'> 4.63 -QUERY_STRING="$QUERY_STRING" 4.64 -CASE="$CASE" WANT="$WANT" VAR_1="$VAR_1" 4.65 +QUERY_STRING="$QUERY_STRING"$args 4.66 </pre> 4.67 EOT 4.68 fi
5.1 --- a/live.cgi Wed Apr 13 12:40:15 2011 +0200 5.2 +++ b/live.cgi Wed Apr 13 16:41:02 2011 +0200 5.3 @@ -17,13 +17,10 @@ 5.4 esac 5.5 fi 5.6 5.7 -. /usr/bin/httpd_helper.sh 5.8 - 5.9 -header 5.10 - 5.11 # Common functions from libtazpanel 5.12 . lib/libtazpanel 5.13 get_config 5.14 +header 5.15 5.16 # Include gettext helper script. 5.17 . /usr/bin/gettext.sh 5.18 @@ -62,16 +59,14 @@ 5.19 # 5.20 5.21 case " $(GET) " in 5.22 - *\ write-iso\ *) 5.23 - comp=${QUERY_STRING#write-iso=} 5.24 + *\ write_iso\ *) 5.25 $TERMINAL $TERM_OPTS \ 5.26 -T "write-iso" \ 5.27 - -e "tazlito writeiso $comp" & ;; 5.28 - *\ gen-liveusb\ *) 5.29 - dev=`httpd -d ${QUERY_STRING#gen-liveusb=}` 5.30 + -e "tazlito writeiso $(GET write_iso)" & ;; 5.31 + *\ gen_liveusb\ *) 5.32 $TERMINAL $TERM_OPTS \ 5.33 -T "Tazusb gen-liveusb" \ 5.34 - -e "tazusb gen-liveusb $dev; \ 5.35 + -e "tazusb gen-liveusb $(GET gen_liveusb); \ 5.36 gettext \"ENTER to quit\"; read i" & ;; 5.37 *\ loramoutput\ *) 5.38 $TERMINAL $TERM_OPTS \ 5.39 @@ -91,8 +86,8 @@ 5.40 # Commands 5.41 # 5.42 5.43 -case "$QUERY_STRING" in 5.44 - create) 5.45 +case " $(GET) " in 5.46 + *\ create\ *) 5.47 # 5.48 # Create a flavor file and ISO in options with all settings 5.49 # Step by step interface and store files in cache. 5.50 @@ -118,7 +113,7 @@ 5.51 </p> 5.52 <form method="get" action="$SCRIPT_NAME"> 5.53 `gettext "USB Media to use:"` 5.54 - <select name="gen-liveusb"> 5.55 + <select name="gen_liveusb"> 5.56 EOT 5.57 # List disk if plugged USB device 5.58 if [ -d /proc/scsi/usb-storage ]; then 5.59 @@ -143,7 +138,7 @@ 5.60 </p> 5.61 <form method="get" action="$SCRIPT_NAME"> 5.62 `gettext "Compression type:"` 5.63 - <select name="write-iso"> 5.64 + <select name="write_iso"> 5.65 <option value="gzip">gzip</option> 5.66 <option value="lzma">lzma</option> 5.67 <option value="none">none</option>
6.1 --- a/network.cgi Wed Apr 13 12:40:15 2011 +0200 6.2 +++ b/network.cgi Wed Apr 13 16:41:02 2011 +0200 6.3 @@ -2,12 +2,11 @@ 6.4 # 6.5 # Network configuration CGI interface 6.6 # 6.7 -echo "Content-Type: text/html" 6.8 -echo "" 6.9 6.10 # Common functions from libtazpanel 6.11 . lib/libtazpanel 6.12 get_config 6.13 +header 6.14 6.15 # Include gettext helper script. 6.16 . /usr/bin/gettext.sh 6.17 @@ -19,13 +18,13 @@ 6.18 TITLE="- Network" 6.19 6.20 # Actions commands before page is displayed 6.21 -case "$QUERY_STRING" in 6.22 - start) 6.23 +case " $(GET) " in 6.24 + *\ start\ *) 6.25 # Here we sleep a bit to let udhcp get the lease before reloading 6.26 # page with status 6.27 /etc/init.d/network.sh start | log 6.28 sleep 2 ;; 6.29 - stop) 6.30 + *\ stop\ *) 6.31 /etc/init.d/network.sh stop | log ;; 6.32 *) 6.33 continue ;; 6.34 @@ -35,8 +34,8 @@ 6.35 # Main Commands for pages 6.36 # 6.37 6.38 -case "$QUERY_STRING" in 6.39 - eth) 6.40 +case " $(GET) " in 6.41 + *\ eth\ *) 6.42 # Wired connections settings 6.43 xhtml_header 6.44 6.45 @@ -47,7 +46,7 @@ 6.46 </pre> 6.47 EOT 6.48 ;; 6.49 - wifi) 6.50 + *\ wifi\ *) 6.51 # Wireless connections settings 6.52 xhtml_header 6.53
7.1 --- a/pkgs.cgi Wed Apr 13 12:40:15 2011 +0200 7.2 +++ b/pkgs.cgi Wed Apr 13 16:41:02 2011 +0200 7.3 @@ -9,12 +9,9 @@ 7.4 # (C) 2011 SliTaz GNU/Linux - GNU gpl v3 7.5 # 7.6 7.7 -. /usr/bin/httpd_helper.sh 7.8 - 7.9 -header 7.10 - 7.11 . lib/libtazpanel 7.12 get_config 7.13 +header 7.14 7.15 # Include gettext helper script. 7.16 . /usr/bin/gettext.sh 7.17 @@ -148,8 +145,8 @@ 7.18 # Commands 7.19 # 7.20 7.21 -case "$QUERY_STRING" in 7.22 - list*) 7.23 +case " $(GET) " in 7.24 + *\ list\ *) 7.25 # 7.26 # List installed packages. This is the default because parsing 7.27 # the full packages.desc can be long and take some resources 7.28 @@ -193,14 +190,14 @@ 7.29 done 7.30 table_end 7.31 echo '</form>' ;; 7.32 - cat*) 7.33 + *\ cat\ *) 7.34 # 7.35 # List all available packages by category on mirror. Listing all 7.36 # packages is too resource intensive and not useful. 7.37 # 7.38 cd $LOCALSTATE 7.39 - category=${QUERY_STRING#cat=} 7.40 - [ "${QUERY_STRING}" == "cat" ] && category="base-system" 7.41 + category=$(GET cat) 7.42 + [ "$category" == "cat" ] && category="base-system" 7.43 search_form 7.44 sidebar | sed s/"active_${category}"/"active"/ 7.45 LOADING_MSG="Listing packages..." 7.46 @@ -228,12 +225,12 @@ 7.47 grep "| $category |" packages.desc | parse_packages_desc 7.48 table_end 7.49 echo '</form>' ;; 7.50 - search=*) 7.51 + *\ search\ *) 7.52 # 7.53 # Search for packages. Here default is to search in packages.desc 7.54 # and so get result including packages names and descriptions 7.55 # 7.56 - pkg=${QUERY_STRING#*=} 7.57 + pkg=$(GET search) 7.58 cd $LOCALSTATE 7.59 search_form 7.60 sidebar 7.61 @@ -274,7 +271,7 @@ 7.62 fi 7.63 table_end 7.64 echo '</form>' ;; 7.65 - recharge*) 7.66 + *\ recharge\ *) 7.67 # 7.68 # Let recharge the packages list 7.69 # 7.70 @@ -311,7 +308,7 @@ 7.71 </p> 7.72 EOT 7.73 ;; 7.74 - up*) 7.75 + *\ up\ *) 7.76 # 7.77 # Ugrade packages 7.78 # 7.79 @@ -347,14 +344,15 @@ 7.80 done 7.81 table_end 7.82 echo '</form>' ;; 7.83 - do=*) 7.84 + *\ do\ *) 7.85 # 7.86 # Do an action on one or some packages 7.87 # 7.88 - cmdline=`echo ${QUERY_STRING#do=} | sed s'/&/ /g'` 7.89 - cmd=`echo ${cmdline} | awk '{print $1}'` 7.90 - pkgs=`echo $cmdline | sed -e s'/+/ /g' -e s'/pkg=//g' -e s/$cmd//` 7.91 - case $cmd in 7.92 + pkgs="" 7.93 + for i in $(seq 1 $(GET pkg count)); do 7.94 + pkgs="$pkgs$(GET pkg $i) " 7.95 + done 7.96 + case "$(GET do)" in 7.97 install|Install) 7.98 cmd=get-install opt=--forced ;; 7.99 remove|Remove) 7.100 @@ -390,11 +388,11 @@ 7.101 echo 'o' | tazpkg $cmd $pkg $opt 2>/dev/null | filter_tazpkg_msgs 7.102 echo '</pre>' 7.103 done ;; 7.104 - info=*) 7.105 + *\ info\ *) 7.106 # 7.107 # Packages info 7.108 # 7.109 - pkg=${QUERY_STRING#*=} 7.110 + pkg=$(GET info) 7.111 search_form 7.112 sidebar 7.113 if [ -d $INSTALLED/$pkg ]; then 7.114 @@ -463,20 +461,23 @@ 7.115 EOT 7.116 fi 7.117 ;; 7.118 - config*) 7.119 + *\ config\ *) 7.120 # 7.121 # Tazpkg configuration page 7.122 # 7.123 - cmd=${QUERY_STRING#*=} 7.124 + cmd=$(GET config) 7.125 case "$cmd" in 7.126 clean) 7.127 rm -rf /var/cache/tazpkg/* ;; 7.128 - add-mirror*=http*|add-mirror*=ftp*) 7.129 + add-mirror) 7.130 # Decode url 7.131 - mirror=`httpd -d ${cmd#*=}` 7.132 - echo "$mirror" >> $LOCALSTATE/mirrors ;; 7.133 + mirror=$(GET mirror) 7.134 + case "$mirror" in 7.135 + http://*|ftp://*) 7.136 + echo "$mirror" >> $LOCALSTATE/mirrors ;; 7.137 + esac ;; 7.138 rm-mirror=http://*|rm-mirror=ftp://*) 7.139 - mirror=${QUERY_STRING#*=rm-mirror=} 7.140 + mirror=${cmd#rm-mirror=} 7.141 sed -i -e "s@$mirror@@" -e '/^$/d' $LOCALSTATE/mirrors ;; 7.142 esac 7.143 cache_files=`find /var/cache/tazpkg -name *.tazpkg | wc -l`
8.1 --- a/settings.cgi Wed Apr 13 12:40:15 2011 +0200 8.2 +++ b/settings.cgi Wed Apr 13 16:41:02 2011 +0200 8.3 @@ -6,12 +6,11 @@ 8.4 # 8.5 # Copyright (C) 2011 SliTaz GNU/Linux - GNU gpl v3 8.6 # 8.7 -echo "Content-Type: text/html" 8.8 -echo "" 8.9 8.10 # Common functions from libtazpanel 8.11 . lib/libtazpanel 8.12 get_config 8.13 +header 8.14 8.15 # Include gettext helper script. 8.16 . /usr/bin/gettext.sh 8.17 @@ -35,41 +34,28 @@ 8.18 # Commands executed before page loading. 8.19 # 8.20 8.21 -case "$QUERY_STRING" in 8.22 - users|user=*) 8.23 +case " $(GET) " in 8.24 + *\ user*) 8.25 # 8.26 # Manage system user accounts 8.27 # 8.28 - cmdline=`echo ${QUERY_STRING#user*=} | sed s'/&/ /g'` 8.29 - # Parse cmdline 8.30 - for opt in $cmdline 8.31 - do 8.32 - case $opt in 8.33 - adduser=*) 8.34 - user=${opt#adduser=} 8.35 - cmd=adduser ;; 8.36 - deluser=*) 8.37 - user=${opt#deluser=} 8.38 - deluser $user ;; 8.39 - passwd=*) 8.40 - pass=${opt#passwd=} ;; 8.41 - esac 8.42 + for i in $(seq 1 $(GET deluser count)); do 8.43 + deluser $(GET deluser $i) 8.44 done 8.45 - case "$cmd" in 8.46 - adduser) 8.47 - adduser -D $user 8.48 - echo "$pass" | chpasswd 8.49 - for g in audio cdrom floppy video 8.50 - do 8.51 - addgroup $user $g 8.52 - done ;; 8.53 - *) continue ;; 8.54 - esac ;; 8.55 - gen-locale=*) 8.56 - new_locale=${QUERY_STRING#gen-locale=} ;; 8.57 - rdate) 8.58 + user=$(GET adduser) 8.59 + if [ -n "$user" ]; then 8.60 + adduser -D $user 8.61 + echo "$(GET passwd)" | chpasswd 8.62 + for g in audio cdrom floppy video 8.63 + do 8.64 + addgroup $user $g 8.65 + done 8.66 + fi ;; 8.67 + *\ gen_locale\ *) 8.68 + new_locale=$(GET gen_locale) ;; 8.69 + *\ rdate\ *) 8.70 rdate -s tick.greyware.com ;; 8.71 - hwclock) 8.72 + *\ hwclock\ *) 8.73 hwclock -w ;; 8.74 *) 8.75 continue ;; 8.76 @@ -177,7 +163,7 @@ 8.77 </p> 8.78 <form method="get" action="$SCRIPT_NAME"> 8.79 `gettext "Available locales:"` 8.80 - <select name="gen-locale"> 8.81 + <select name="gen_locale"> 8.82 <option value="en_US">en_US</options> 8.83 `list_locales` 8.84 </select>