# HG changeset patch # User Christophe Lincoln # Date 1394900747 -3600 # Node ID 45169f4d9df04017ef468965502df422b731d6b8 # Parent 1b4800da5288fd6de288bdd01ddb9965852d0c30 Add slitaz-config (will go in slitaz-tools but needed to rel an RPi distro) diff -r 1b4800da5288 -r 45169f4d9df0 rootfs/etc/init.d/rcS --- a/rootfs/etc/init.d/rcS Sat Mar 15 16:48:27 2014 +0100 +++ b/rootfs/etc/init.d/rcS Sat Mar 15 17:25:47 2014 +0100 @@ -68,8 +68,8 @@ echo "$ARCH" > /var/lib/slitaz/post-install [ -s /etc/keymap.conf ] || tazkeymap #[ -s /etc/locale.conf ] || tazlocale - # change root password - # add a user + slitaz-config root_passwd + # add a user: slitaz-config add_user fi # Load all modules from config file diff -r 1b4800da5288 -r 45169f4d9df0 rootfs/usr/bin/slitaz-config --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rootfs/usr/bin/slitaz-config Sat Mar 15 17:25:47 2014 +0100 @@ -0,0 +1,84 @@ +#!/bin/sh +# +# SliTaz Config - A tool with all SliTaz Ncurses config in one place for +# text mode system (server, ARM devices) +# +# Copyright (C) 2014 SliTaz ARM - BSD License +# Author: Christophe Lincoln +# +. /lib/libtaz.sh +check_root + +title="{ SliTaz Config }" +tmpdir="/tmp/$(basename $0)" +tmp="$tmpdir/$$" +height="20" +width="72" + +# Use a tmp directory +mkdir -p ${tmpdir} + +# +# GUI Functions +# + +# Set root passwd +root_passwd() { + dialog \ + --inputbox "Enter new root password:" \ + 10 ${width} 2>${tmp} + passwd=$(cat $tmp) + [ "$passwd" == "" ] && return 0 + echo "root:$passwd" | chpasswd --md5 +} + +# Main Dialog menu +main_box() { + dialog \ + --clear \ + --title "$title" \ + --ok-label "Exec" \ + --cancel-label "Quit" \ + --menu "" ${height} ${width} 14 \ +"keyboard" "$(gettext 'System keyboard setting')" \ +"locale" "$(gettext 'System language setting')" \ +"root-passwd" "$(gettext 'Change root password')" \ +"quit" "$(gettext 'Exit from TazBerry tool')" 2>${tmp} + + # Handle options + opt=${?} + case "$opt" in + 1|255) rm -rf ${tmpdir} && exit 0 ;; + esac + + # Handle actions + action=$(cat $tmp) + case "$action" in + keyboard) + tazkeymap ;; + locale) + tazlocale ;; + root-passwd) + root_passwd ;; + quit) + rm -rf ${tmpdir} && exit 0 ;; + esac +} + +# +# Handle commands +# + +case "$1" in + *_*) + # Execute functions + $@ ;; + *) + while true; do + main_box + done ;; +esac + +# Clean exit +rm -rf ${tmpdir} +exit 0 diff -r 1b4800da5288 -r 45169f4d9df0 rpi/tazberry --- a/rpi/tazberry Sat Mar 15 16:48:27 2014 +0100 +++ b/rpi/tazberry Sat Mar 15 17:25:47 2014 +0100 @@ -159,6 +159,7 @@ "oclock" "$(gettext 'Overclocking information and config')" \ "packages" "$(gettext 'Packages info and upgrade (spk)')" \ "keyboard" "$(gettext 'System keyboard setting')" \ +"root-passwd" "$(gettext 'Change root password')" \ "reboot" "$(gettext 'Reboot SliTaz')" \ "halt" "$(gettext 'Halt the Raspberry Pi')" \ "quit" "$(gettext 'Exit from TazBerry tool')" 2>${tmp} @@ -189,6 +190,8 @@ tazkeymap ;; reboot) reboot ;; + root-passwd) + slitaz-config root_passwd ;; halt) halt ;; quit)