tazpanel view tazpanel @ rev 638

boot.iso: allow /dev/cdrom
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jan 05 15:14:01 2022 +0000 (2022-01-05)
parents 6e5673c7fa08
children
line source
1 #!/bin/sh
2 #
3 # Tiny Tazpanel cmdline interface
4 #
5 # Copyright (C) 2012-2015 SliTaz GNU/Linux - BSD License
6 #
8 VERSION=522
11 # Get the configuration file and functions
13 CONFIG="/etc/slitaz/tazpanel.conf"
14 [ -f "$CONFIG" ] && . $CONFIG
15 [ -f "data/tazpanel.conf" ] && . ./data/tazpanel.conf
16 [ ! "$PANEL" ] && echo "No config file found: $CONFIG" && exit 1
18 . /lib/libtaz.sh
21 # I18n
23 TEXTDOMAIN='tazpanel'
24 export TEXTDOMAIN
27 #
28 # Commands
29 #
31 NAME=tazpanel
32 DESC="SliTaz administration and configuration panel."
33 DAEMON=/usr/sbin/httpd
34 PIDFILE=/run/$NAME.pid
36 case "$1" in
37 -h|*help|*usage)
38 cat <<EOT
39 Usage: tazpanel [command]
41 Commands:
42 start Start tazpanel daemon
43 stop Stop tazpanel daemon
44 restart Restart tazpanel daemon
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.
48 You can also open sub-pages, so "pkgs#list" will open packages list.
49 cc Clean cache: remove interface's header from cache
51 EOT
52 ;;
53 start)
54 if [ -f $PIDFILE ]; then
55 _ 'TazPanel is already running.'
56 exit 1
57 fi
58 _n 'Starting TazPanel web server on port %d...' $HTTPD_PORT
59 $DAEMON -p $HTTPD_PORT -u root -c $HTTPD_CONF \
60 -r "$(_ 'TazPanel Authentication - Default: root:root')" &
61 ps 2>/dev/null | grep "$DAEMON -p $HTTPD_PORT " | grep -v grep | \
62 awk '{ print $1 }' > $PIDFILE
63 [ ! -f /var/lib/tazpkg/installed.info ] && tazpkg -l>/dev/null&
64 status ;;
65 stop)
66 if [ ! -f $PIDFILE ]; then
67 _ 'TazPanel is not running.'
68 exit 1
69 fi
70 _n 'Stopping TazPanel web server...'
71 kill $(pgrep -f TazPanel)
72 rm -f $PIDFILE
73 status ;;
74 restart)
75 tazpanel stop; sleep 1; tazpanel start;;
76 cc)
77 find /var/cache/tazpanel -name 'header.*' -delete;;
78 *)
79 . /etc/slitaz/applications.conf
80 USER_CONFIG="$HOME/.config/slitaz/applications.conf"
81 [ -f "$USER_CONFIG" ] && . $USER_CONFIG
83 applet=${1:-index}
84 case $1 in
85 *#*) url="http://127.0.0.1:$HTTPD_PORT/${applet%%#*}.cgi?${applet#*#}&guiuser=$(id -un)";;
86 *) url="http://127.0.0.1:$HTTPD_PORT/$applet.cgi?guiuser=$(id -un)";;
87 esac
88 echo "$url"
90 case "$BROWSER" in
91 tazweb) tazweb --notoolbar "$url" & ;;
92 midori) midori "--app=$url" & ;;
93 *) $BROWSER "$url" & ;;
94 esac ;;
95 esac
97 exit 0