slitaz-arm rev 61

Add slitaz-config (will go in slitaz-tools but needed to rel an RPi distro)
author Christophe Lincoln <pankso@slitaz.org>
date Sat Mar 15 17:25:47 2014 +0100 (2014-03-15)
parents 1b4800da5288
children f74a9206fdd0
files rootfs/etc/init.d/rcS rootfs/usr/bin/slitaz-config rpi/tazberry
line diff
     1.1 --- a/rootfs/etc/init.d/rcS	Sat Mar 15 16:48:27 2014 +0100
     1.2 +++ b/rootfs/etc/init.d/rcS	Sat Mar 15 17:25:47 2014 +0100
     1.3 @@ -68,8 +68,8 @@
     1.4  	echo "$ARCH" > /var/lib/slitaz/post-install
     1.5  	[ -s /etc/keymap.conf ] || tazkeymap
     1.6  	#[ -s /etc/locale.conf ] || tazlocale
     1.7 -	# change root password
     1.8 -	# add a user
     1.9 +	slitaz-config root_passwd
    1.10 +	# add a user: slitaz-config add_user
    1.11  fi
    1.12  
    1.13  # Load all modules from config file
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/rootfs/usr/bin/slitaz-config	Sat Mar 15 17:25:47 2014 +0100
     2.3 @@ -0,0 +1,84 @@
     2.4 +#!/bin/sh
     2.5 +#
     2.6 +# SliTaz Config - A tool with all SliTaz Ncurses config in one place for
     2.7 +# text mode system (server, ARM devices)
     2.8 +#
     2.9 +# Copyright (C) 2014 SliTaz ARM - BSD License
    2.10 +# Author: Christophe Lincoln <pankso@slitaz.org>
    2.11 +#
    2.12 +. /lib/libtaz.sh
    2.13 +check_root
    2.14 +
    2.15 +title="{ SliTaz Config }"
    2.16 +tmpdir="/tmp/$(basename $0)"
    2.17 +tmp="$tmpdir/$$"
    2.18 +height="20"
    2.19 +width="72"
    2.20 +
    2.21 +# Use a tmp directory
    2.22 +mkdir -p ${tmpdir}
    2.23 +
    2.24 +#
    2.25 +# GUI Functions
    2.26 +#
    2.27 +
    2.28 +# Set root passwd
    2.29 +root_passwd() {
    2.30 +	dialog \
    2.31 +		--inputbox "Enter new root password:" \
    2.32 +		10 ${width} 2>${tmp}
    2.33 +    passwd=$(cat $tmp)
    2.34 +    [ "$passwd" == "" ] && return 0
    2.35 +    echo "root:$passwd" | chpasswd --md5
    2.36 +}
    2.37 +
    2.38 +# Main Dialog menu
    2.39 +main_box() {
    2.40 +	dialog \
    2.41 +		--clear \
    2.42 +		--title "$title" \
    2.43 +		--ok-label "Exec" \
    2.44 +		--cancel-label "Quit" \
    2.45 +		--menu "" ${height} ${width} 14 \
    2.46 +"keyboard"       "$(gettext 'System keyboard setting')" \
    2.47 +"locale"         "$(gettext 'System language setting')" \
    2.48 +"root-passwd"    "$(gettext 'Change root password')" \
    2.49 +"quit"           "$(gettext 'Exit from TazBerry tool')" 2>${tmp}
    2.50 +	
    2.51 +	# Handle options
    2.52 +	opt=${?}
    2.53 +	case "$opt" in
    2.54 +		1|255) rm -rf ${tmpdir} && exit 0 ;;
    2.55 +	esac
    2.56 +	
    2.57 +	# Handle actions
    2.58 +	action=$(cat $tmp)
    2.59 +	case "$action" in
    2.60 +		keyboard)
    2.61 +			tazkeymap ;;
    2.62 +		locale)
    2.63 +			tazlocale ;;
    2.64 +		root-passwd)
    2.65 +			root_passwd ;;
    2.66 +		quit)
    2.67 +			rm -rf ${tmpdir} && exit 0 ;;
    2.68 +	esac
    2.69 +}
    2.70 +
    2.71 +#
    2.72 +# Handle commands
    2.73 +#
    2.74 +
    2.75 +case "$1" in
    2.76 +	*_*) 
    2.77 +		# Execute functions 
    2.78 +		$@ ;;
    2.79 +	*)
    2.80 +		while true; do
    2.81 +			main_box
    2.82 +		done ;;
    2.83 +esac
    2.84 +
    2.85 +# Clean exit
    2.86 +rm -rf ${tmpdir}
    2.87 +exit 0
     3.1 --- a/rpi/tazberry	Sat Mar 15 16:48:27 2014 +0100
     3.2 +++ b/rpi/tazberry	Sat Mar 15 17:25:47 2014 +0100
     3.3 @@ -159,6 +159,7 @@
     3.4  "oclock"         "$(gettext 'Overclocking information and config')" \
     3.5  "packages"       "$(gettext 'Packages info and upgrade (spk)')" \
     3.6  "keyboard"       "$(gettext 'System keyboard setting')" \
     3.7 +"root-passwd"    "$(gettext 'Change root password')" \
     3.8  "reboot"         "$(gettext 'Reboot SliTaz')" \
     3.9  "halt"           "$(gettext 'Halt the Raspberry Pi')" \
    3.10  "quit"           "$(gettext 'Exit from TazBerry tool')" 2>${tmp}
    3.11 @@ -189,6 +190,8 @@
    3.12  			tazkeymap ;;
    3.13  		reboot)
    3.14  			reboot ;;
    3.15 +		root-passwd)
    3.16 +			slitaz-config root_passwd ;;
    3.17  		halt)
    3.18  			halt ;;
    3.19  		quit)