# HG changeset patch # User Christophe Lincoln # Date 1227559029 -3600 # Node ID e1be9642557873a642d08a6ae621e9e210480726 # Parent 682760cabf368f619318a05e8c72567f60383f43 Add SliTaz Control Box (gui, icon and desktop file) diff -r 682760cabf36 -r e1be96425578 rootfs/usr/share/applications/tazctrlbox.desktop --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rootfs/usr/share/applications/tazctrlbox.desktop Mon Nov 24 21:37:09 2008 +0100 @@ -0,0 +1,9 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Control Box +Name[fr]=Boîte de contrôle +Comment=Manage your SliTaz system +Exec=subox tazctrlbox +Icon=tazctrlbox.png +Type=Application +Categories=System;Application; diff -r 682760cabf36 -r e1be96425578 rootfs/usr/share/pixmaps/tazctrlbox.png Binary file rootfs/usr/share/pixmaps/tazctrlbox.png has changed diff -r 682760cabf36 -r e1be96425578 tinyutils/tazctrlbox --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tinyutils/tazctrlbox Mon Nov 24 21:37:09 2008 +0100 @@ -0,0 +1,452 @@ +#!/bin/sh +# +# SliTaz Control Box is a tool to configure and manage a SliTaz system. +# The script use GTKdialog for the UI interface, some shell functions +# are called by argument. Individual window dialog are put into +# functions. +# +# (C) GNU gpl v3 - SliTaz GNU/Linux 2008. +# Author: Christophe Lincoln +# +VERSION=1.0 + +# Get init configuration. +. /etc/rcS.conf + +# Tazctrlbox is only for root. +if test $(id -u) != 0 ; then + exec subox $0 + exit 0 +fi + +# Change Grub menu.lst timeout. +sed_grub_timeout() +{ + CURRENT=`cat /boot/grub/menu.lst | grep ^timeout | cut -d " " -f2` + sed -i s/"timeout $CURRENT"/"timeout $GRUB_TIMEOUT"/ /boot/grub/menu.lst +} + +# Change Grub menu.lst timeout. +sed_grub_color() +{ + CURRENT=`cat /boot/grub/menu.lst | grep ^color | cut -d " " -f2-3` + sed -i s#"color $CURRENT"#"color $GRUB_COLOR"# /boot/grub/menu.lst +} + +# Set checked fs on boot. +sed_check_fs() +{ + sed -i s#"CHECK_FS=\"$CHECK_FS\""#"CHECK_FS=\"$NEW_CHECK_FS\""# \ + /etc/rcS.conf +} + +# Set loaded modules on boot. +sed_load_modules() +{ + sed -i s/"LOAD_MODULES=\"$LOAD_MODULES\""/"LOAD_MODULES=\"$NEW_MODULES\""/ \ + /etc/rcS.conf +} + +# Set daemons to run on boot. +sed_run_daemons() +{ + sed -i s/"RUN_DAEMONS=\"$RUN_DAEMONS\""/"RUN_DAEMONS=\"$NEW_DAEMONS\""/ \ + /etc/rcS.conf +} + +# Get user list +get_users() +{ + for i in `cat /etc/passwd | cut -d ":" -f 1` + do + if [ -d /home/$i ]; then + login=$i + uid=`cat /etc/passwd | grep $i | cut -d ":" -f 3` + gid=`cat /etc/passwd | grep $i | cut -d ":" -f 4` + name=`cat /etc/passwd | grep $i | cut -d ":" -f 5 | sed s/,,,//` + home=`cat /etc/passwd | grep $i | cut -d ":" -f 6` + shell=`cat /etc/passwd | grep $i | cut -d ":" -f 7` + echo "$login | $uid:$gid | $name | $home | $shell" + fi + done +} + +# Remove a user or change passwd. +manage_user() +{ + export MANAGE_DIALOG=" + + + + + + + + + + + + + PASSWD + + + + + + + + + +" + gtkdialog --center --program=MANAGE_DIALOG >/dev/null +} + +# Add a new user. +add_user() +{ + export ADD_USER_DIALOG=' + + + + + + + + + + + + + NEW_USER + + + + + + + + PASSWD + + + + + + + + +' + gtkdialog --center --program=ADD_USER_DIALOG >/dev/null +} + +# Main dialog with notebook. +# +export MAIN_DIALOG=' + + + + + + + + + /usr/share/pixmaps/tazctrlbox.png + + + + + + + + + + + + + + + + + + + + date + DATE + + + + + + + + + cat /etc/TZ + NEW_TZ + + + + + ' +# Boot +MAIN_DIALOG=${MAIN_DIALOG}" + + + + + + + + cat /boot/grub/menu.lst | grep ^timeout | cut -d \" \" -f2 + GRUB_TIMEOUT + + + + + + + + + cat /boot/grub/menu.lst | grep ^color | cut -d \" \" -f2-3 + GRUB_COLOR + + + + + + + + + + + + + + + + + echo $CHECK_FS + NEW_CHECK_FS + + + + + + + + + echo $LOAD_MODULES + NEW_MODULES + + + + + + + + + echo $RUN_DAEMONS + NEW_DAEMONS + + + + + + + + + + + " +# Login +MAIN_DIALOG=${MAIN_DIALOG}' + + + + + + + + cat /etc/slim.conf | grep ^session | sed s/"sessions "// + SLIM_SESSIONS + + + + + + + + + cat /etc/slim.conf | grep ^default_user | sed s/"default_user "// + SLIM_DEF_USER + + + + + + + + + NEW_SLIM_THEME' +# List all installed Slim themes. +for dir in $(ls /usr/share/slim/themes) +do + THEME_ITEMS="$dir" + MAIN_DIALOG=${MAIN_DIALOG}${THEME_ITEMS} +done +MAIN_DIALOG=${MAIN_DIALOG}' + + + + + + + + + + + + ' +# Display users list throught get_users. +MAIN_DIALOG=${MAIN_DIALOG}" + + + 650300 + USER + + $0 get_users + $0 manage_user + refresh:USER + + + + + " +export MAIN_DIALOG=${MAIN_DIALOG}' + + + + + + + + + +' + +# Script can be called with an arg to exec a function. +if [ -n "$1" ]; then + $1 +else + gtkdialog --center --program=MAIN_DIALOG >/dev/null +fi + +exit 0