seb rev 5
Add tools
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Mon Mar 06 16:41:26 2017 +0100 (2017-03-06) |
parents | 76b480637165 |
children | 85937e3de0b0 |
files | tools/isolinux.bin tools/kilo tools/sebos |
line diff
1.1 Binary file tools/isolinux.bin has changed
2.1 Binary file tools/kilo has changed
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/tools/sebos Mon Mar 06 16:41:26 2017 +0100 3.3 @@ -0,0 +1,202 @@ 3.4 +#!/bin/sh 3.5 +# 3.6 +# sebos: SliTaz Embedded OS - A tool to help getting hand on a Seb-OS 3.7 +# system with some cmdline and Ncurses configs functions. The main goal 3.8 +# is to manage a web server. Without gettext dependencies please :-) 3.9 +# 3.10 +# Copyright (C) 2017 SliTaz GNU/Linux - BSD License 3.11 +# Author: Christophe Lincoln <pankso@slitaz.org> 3.12 +# 3.13 + 3.14 +# /lib/libseb.sh && seb.conf 3.15 +if [ -f "../libseb.sh" ]; then 3.16 + . ../libseb.sh 3.17 +else 3.18 + if ! . /lib/libseb.sh; then 3.19 + echo "Can't source any: libseb.sh"; exit 1 3.20 + fi 3.21 +fi 3.22 +[ -f "/etc/seb.conf" ] && . /etc/seb.conf 3.23 + 3.24 +title="SliTaz Embedded OS" 3.25 +doc="/usr/share/doc/seb-os.txt" 3.26 +packages="/var/lib/packages" 3.27 +tmpdir="/tmp/$(basename $0)" 3.28 +tmp="$tmpdir/$$" 3.29 +height='20' 3.30 +width='72' 3.31 + 3.32 +# Functions 3.33 + 3.34 +help() { 3.35 + cat << EOT 3.36 + 3.37 +$(colorize 35 'Usage:') $(basename $0) [command] [file|daemon] 3.38 + 3.39 +$(colorize 035 'Commands:') 3.40 + 3.41 + -c config Configure the system 3.42 + -i info Seb system informations 3.43 + -d daemon Run/kill a daemon 3.44 + -p packages List installed packages 3.45 + -v view File viewer 3.46 + doc Built-in documentation 3.47 + 3.48 +EOT 3.49 +} 3.50 + 3.51 +info() { 3.52 + cat << EOT 3.53 +Hostname : $host_name 3.54 +Seb build date : $build_date 3.55 +SliTaz release : $seb_os_release 3.56 +Seb OS config : /etc/seb.conf 3.57 +Netwotk interface : $network_interface 3.58 +Installed packages : $(cat /var/lib/packages | wc -l) 3.59 +Running processes : $(ps -o pid | wc -l) 3.60 +System time : $(date) 3.61 +EOT 3.62 +} 3.63 + 3.64 +read_on() { 3.65 + echo -n "Press ENTER to continue"; read 3.66 +} 3.67 + 3.68 +quit() { 3.69 + rm -rf ${tmpdir}; exit 0 3.70 +} 3.71 + 3.72 +# 3.73 +# GUI Functions 3.74 +# 3.75 + 3.76 +# Display any command output: exec_box [title] [command] 3.77 +exec_box() { 3.78 + dialog --cr-wrap --title "{ $1 }" \ 3.79 + --ok-label "Close" --msgbox "$($2)" ${height} ${width} 3.80 +} 3.81 + 3.82 +# Display a text file: text_box [title] [file] 3.83 +text_box() { 3.84 + dialog --cr-wrap --title "{ $1 }" \ 3.85 + --exit-label "Close" --textbox "$2" ${height} ${width} 3.86 +} 3.87 + 3.88 +# Show message and percentage on a gauge dialog 3.89 +gauge_msg() { 3.90 + sleep 1; echo -e "XXX\n$1\n$MSG\nXXX" 3.91 +} 3.92 + 3.93 +# Set root passwd 3.94 +root_passwd() { 3.95 + dialog --title "{ Root Password }" --colors \ 3.96 + --inputbox "\nEnter new password for root" \ 3.97 + 12 $width 2>${tmp} 3.98 + passwd=$(cat $tmp) 3.99 + [ -z "$passwd" ] && return 0 3.100 + echo "root:$passwd" | chpasswd --md5 >/dev/null 3.101 +} 3.102 + 3.103 +# Add a new user 3.104 +add_user() { 3.105 + dialog --title "{ Add User }" --colors \ 3.106 + --inputbox "\nEnter login name for the new \Zb\Z4user" 12 ${width} 2>${tmp} 3.107 + user=$(cat $tmp) 3.108 + [ ! "$user" ] && return 0 3.109 + 3.110 + dialog --title "{ Add User }" --colors \ 3.111 + --inputbox "\nEnter password for user \Zb\Z4${user}" 12 ${width} 2>${tmp} 3.112 + passwd=$(cat $tmp) 3.113 + [ ! "$passwd" ] && return 0 3.114 + 3.115 + adduser -D -g "SliTaz User" ${user} 3.116 + echo "$user:$passwd" | chpasswd --md5 2>/dev/null 3.117 +} 3.118 + 3.119 +set_date() { 3.120 + echo ""; echo "Old date: $(date)" 3.121 + rdate -s tick.greyware.com 2>/dev/null 3.122 + echo "New date: $(date)"; echo "" 3.123 +} 3.124 + 3.125 +# Main Dialog menu 3.126 +main_box() { 3.127 + mkdir -p ${tmpdir} 3.128 + dialog \ 3.129 + --clear --title "{ $title }" \ 3.130 + --ok-label "Exec" --cancel-label "Quit" \ 3.131 + --menu "" ${height} ${width} 14 \ 3.132 +"info" "Seb OS info and status" \ 3.133 +"add-user" "Add a new user to Seb-OS" \ 3.134 +"root-passwd" "Change root password" \ 3.135 +"set-date" "Set system date from the web" \ 3.136 +"packages" "List installed packages" \ 3.137 +"commands" "Display sebos commands" \ 3.138 +"quit" "Exit from SliTaz Config" 2>${tmp} 3.139 + 3.140 + # Handle options 3.141 + case "$?" in 3.142 + 1|255) quit ;; 3.143 + esac 3.144 + 3.145 + # Handle actions 3.146 + action=$(cat $tmp) 3.147 + case "$action" in 3.148 + info) exec_box "Seb OS Info" info ;; 3.149 + add-user) add_user ;; 3.150 + root-passwd) root_passwd ;; 3.151 + set-date) clear; set_date; read_on ;; 3.152 + packages) clear; ${0} -p; read_on ;; 3.153 + commands) clear; ${0} help; read_on ;; 3.154 + quit) quit ;; 3.155 + esac 3.156 +} 3.157 + 3.158 +# 3.159 +# Handle commands 3.160 +# 3.161 + 3.162 +case "$1" in 3.163 + 3.164 + -c|config) 3.165 + check_root 3.166 + while true; do 3.167 + main_box 3.168 + done ;; 3.169 + 3.170 + -i|info) 3.171 + title "SliTaz Embedded OS" 3.172 + info; footer ;; 3.173 + 3.174 + -d|daemon) 3.175 + # Start/stop Busybox httpd server 3.176 + #pid=$(ps | grep "httpd" | grep -v "grep" | awk '{print $1}') 3.177 + daemon="$2" 3.178 + pid=$(pidof $daemon) 3.179 + if [ "$pid" != "" ]; then 3.180 + echo -n "Starting $daemon daemon..." 3.181 + case "$daemon" in 3.182 + httpd) 3.183 + httpd -u 80:80 -r "Seb OS Authentication" ;; 3.184 + esac; status 3.185 + else 3.186 + echo -n "Stopping $daemon daemon..." 3.187 + kill ${pid}; status 3.188 + fi ;; 3.189 + 3.190 + -p|packages) 3.191 + title "Installed packages" 3.192 + IFS="|" 3.193 + cat /var/lib/packages | while read pkg desc; do 3.194 + echo -n "$(colorize 036 $pkg)"; indent 20 "$desc" 3.195 + done; unset IFS; footer ;; 3.196 + 3.197 + -v|view) text_box "$(basename $2)" ${2} ;; 3.198 + 3.199 + *_*) $@ ;; # Execute any fun_ctions 3.200 + 3.201 + *|help) help ;; 3.202 +esac 3.203 + 3.204 +# Clean exit 3.205 +rm -rf ${tmpdir} && exit 0