slitaz-forge view pangolin/pangolin @ rev 674

Fix path in pangolin admin tool (I will do it!!!)
author Christophe Lincoln <pankso@slitaz.org>
date Thu Mar 16 19:34:10 2017 +0100 (2017-03-16)
parents a1148d85361d
children ee64bc14ebd9
line source
1 #!/bin/sh
2 #
3 # Pangolin admin utility
4 #
5 # Copyright (C) 2012-2014 SliTaz GNU/Linux - BSD License
6 #
7 # Authors : Christophe Lincoln <pankso@slitaz.org>
8 #
10 REPOS="/home/slitaz/repos"
11 WWW="/home/vhost"
12 WEBSITE="$WWW/www.slitaz.org/website"
13 PYTHON_LIB="/usr/lib/python2.7"
14 HGUSERS="/home/slitaz/auth/hgusers"
16 usage() {
17 cat << EOT
19 Usage: $(basename $0) [command]
20 Commands:
21 up-www Update website www.slitaz.org
22 up-forum Update forum.slitaz.org theme
23 up-doc Update doc.slitaz.org theme and configs
24 up-hg Update Hg web interface hg.slitaz.org
25 up-pizza Update Pizza web interface pizza.slitaz.me
26 up-pangolin Update pangolin.slitaz.org virtual host
27 adduser Add a new user to Hg
28 stats Display some server stats
30 EOT
31 }
33 # While libtaz.sh is not installed on Pangolin
34 #
35 newline() {
36 echo ""
37 }
39 boldify() {
40 echo -e "\\033[1m$@\\033[0m"
41 }
43 separator() {
44 echo "================================================================================"
45 }
47 #
48 # handle commands
49 #
51 case "$1" in
53 up-www)
54 # Update website from repo.
55 newline
56 boldify "Updating: www.slitaz.org..."
57 cd ${WEBSITE} && hg pull -u
58 newline ;;
60 up-forum)
61 # Update forum.slitaz.org theme
62 newline
63 boldify "Updating: forum.slitaz.org..."
64 cd ${REPOS}/slitaz-forge && hg up
65 cp -a forum/my-templates ${WWW}/forum.slitaz.org/public_html
66 newline ;;
68 up-doc)
69 # Update doc.slitaz.org theme
70 newline
71 boldify "Updating: doc.slitaz.org..."
72 cd ${REPOS}/slitaz-forge && hg up
73 cp -a doc/* ${WWW}/doc.slitaz.org/public_html
74 chown www.www ${WWW}/doc.slitaz.org/public_html/conf
75 chown www.www ${WWW}/doc.slitaz.org/public_html/conf/local.php
76 newline ;;
78 up-hg)
79 # Update hg.slitaz.org template
80 newline
81 boldify "Updating Mercurial template..."
82 cd $REPOS/slitaz-dev-tools && hg update
83 cp -a slitaz-mercurial-style/* $PYTHON_LIB/site-packages/mercurial
84 chown -R root.root $PYTHON_LIB/site-packages/mercurial/templates
85 newline ;;
87 up-pizza)
88 # Update pizza.slitaz.me
89 newline
90 boldify "Updating Pizza builder..."
91 cd $REPOS/slitaz-pizza && hg update
92 cp /etc/slitaz/pizza.conf /etc/slitaz/pizza.conf.bak
93 make install; cd ..
94 cp -f /etc/slitaz/pizza.conf.bak /etc/slitaz/pizza.conf
95 pizza up-files
96 newline ;;
98 up-play)
99 # Update play.slitaz.me
100 newline
101 boldify "Updating play.slitaz.org..."
102 cd ${REPOS}/slitaz-forge && hg update
103 cp -rf play.slitaz.me/* ${WWW}/play.slitaz.me/public_html
104 # Tazcraft
105 cd ${REPOS}/slitaz-dev-tools && hg update
106 cp -rf tazcraft/cgi-bin ${WWW}/play.slitaz.me/public_html/tazcraft
107 newline ;;
109 up-pangolin)
110 # Update pangolin.slitaz.org
111 newline
112 boldify "Updating: pangolin.slitaz.org..."
113 cd ${REPOS}/slitaz-forge && hg up
114 cp -a pangolin/web/* ${www}/pangolin.slitaz.org/public_html
115 newline ;;
117 adduser)
118 [ ! "$2" ] && echo "Missing user name arg" && exit 0
119 [ ! "$3" ] && echo "Missing password arg" && exit 0
120 htpasswd -b ${HGUSERS} $2 $3 ;;
122 stats)
123 # Echo some stats.
124 newline
125 boldify "Disk usage"
126 separator
127 df -h | grep ^/dev
128 boldify "Memory usage"
129 separator
130 free -m | grep ^Mem
131 boldify "Connected users"
132 separator
133 who
134 newline ;;
135 *)
136 usage ;;
137 esac
138 exit 0