tazpanel view tazpanel @ rev 464

Add CSS for prism.js; tiny edits.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Apr 24 16:38:13 2015 +0300 (2015-04-24)
parents 3b7af62b1a2e
children 12e726724a74
line source
1 #!/bin/sh
2 #
3 # Tiny Tazpanel cmdline interface
4 #
5 # Copyright (C) 2012-2015 SliTaz GNU/Linux - BSD License
6 #
7 VERSION=1.8.2
10 # Get the configuration file and functions
12 CONFIG="/etc/slitaz/tazpanel.conf"
13 [ -f "$CONFIG" ] && . $CONFIG
14 [ -f "data/tazpanel.conf" ] && . data/tazpanel.conf
15 [ ! "$PANEL" ] && echo "No config file found: $CONFIG" && exit 1
17 . /lib/libtaz.sh
20 # I18n
22 TEXTDOMAIN='tazpanel'
23 export TEXTDOMAIN
26 #
27 # Commands
28 #
30 NAME=tazpanel
31 DESC="SliTaz administration and configuration panel."
32 DAEMON=/usr/sbin/httpd
33 PIDFILE=/run/$NAME.pid
35 case "$1" in
36 -h|*help|*usage)
37 cat <<EOT
38 Usage: tazpanel [command]
40 Commands:
41 start Start tazpanel daemon
42 stop Stop tazpanel daemon
43 restart Restart tazpanel daemon
44 passwd Changing TazPanel password for root (also, short command -p)
45 <app> Open TazPanel page in the browser, where <app> is one of:
46 boot, hardware, help, index, installer, live, network, settings, pkgs
47 If <app> is empty, index page will open in the browser.
49 EOT
50 ;;
51 start)
52 if [ -f $PIDFILE ]; then
53 _ 'TazPanel is already running.'
54 exit 1
55 fi
56 _n 'Starting TazPanel web server on port %d...' $HTTPD_PORT
57 httpd -p $HTTPD_PORT -u root -c $HTTPD_CONF \
58 -r "$(_ 'TazPanel Authentication - Default: root:root')" &
59 ps | grep "httpd -p $HTTPD_PORT " | grep -v grep | \
60 awk '{ print $1 }' > $PIDFILE
61 [ ! -f /var/lib/tazpkg/installed.info ] && tazpkg -l>/dev/null&
62 status ;;
63 stop)
64 if [ ! -f $PIDFILE ]; then
65 _ 'TazPanel is not running.'
66 exit 1
67 fi
68 _n 'Stopping TazPanel web server...'
69 kill $(pgrep -f TazPanel)
70 rm -f $PIDFILE
71 status ;;
72 restart)
73 tazpanel stop; sleep 1; tazpanel start;;
74 passwd|-p)
75 echo
76 _ 'Changing password for TazPanel'
77 _n 'New password: ' && read pass
78 sed -i "s/\/:root:.*/\/:root:$pass/" $HTTPD_CONF
79 _ 'Password changed successfully'
80 echo ;;
81 *)
82 . /etc/slitaz/applications.conf
83 USER_CONFIG="$HOME/.config/slitaz/applications.conf"
84 [ -f "$USER_CONFIG" ] && . $USER_CONFIG
85 [ -n "$1" ] && app="/${1}.cgi"
86 echo http://localhost:82${app}
87 case "$BROWSER" in
88 tazweb) tazweb --notoolbar http://localhost:82${app} & ;;
89 midori) midori --app=http://localhost:82${app} & ;;
90 *) $BROWSER http://localhost:82${app} & ;;
91 esac ;;
92 esac
94 exit 0