slitaz-forge view pangolin/pangolin @ rev 711

Update pangolin
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jan 01 18:26:56 2020 +0100 (5 months ago)
parents beb069382492
children
line source
1 #!/bin/sh
2 #
3 # Pangolin admin utility
4 #
5 # Copyright (C) 2012-2017 SliTaz GNU/Linux - BSD License
6 # Authors : Christophe Lincoln <pankso@slitaz.org>
7 #
9 REPOS="/home/slitaz/repos"
10 WWW="/home/vhost"
11 WEBSITE="$WWW/www.slitaz.org/website"
12 PYTHON_LIB="/usr/lib/python2.7"
13 HGUSERS="/home/slitaz/auth/hgusers"
15 usage() {
16 cat << EOT
18 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 mypizza.slitaz.org
26 up-play Update Gamers web interface play.slitaz.me
27 up-pangolin Update pangolin.slitaz.org virtual host
28 adduser Add a new user to Hg
29 stats Display some server stats
31 EOT
32 }
34 # While libtaz.sh is not installed on Pangolin
35 #
36 newline() {
37 echo ""
38 }
40 boldify() {
41 echo -e "\\033[1m$@\\033[0m"
42 }
44 separator() {
45 echo "================================================================================"
46 }
48 #
49 # handle commands
50 #
52 case "$1" in
54 up-www)
55 # Update website from repo.
56 newline
57 boldify "Updating: www.slitaz.org..."
58 cd ${WEBSITE} && hg pull -u
59 newline ;;
61 up-forum)
62 # Update forum.slitaz.org theme
63 newline
64 boldify "Updating: forum.slitaz.org..."
65 cd ${REPOS}/slitaz-forge && hg up
66 cp -a forum/my-templates ${WWW}/forum.slitaz.org/public_html
67 newline ;;
69 up-doc)
70 # Update doc.slitaz.org theme
71 newline
72 boldify "Updating: doc.slitaz.org..."
73 cd ${REPOS}/slitaz-forge && hg up
74 cp -a doc/* ${WWW}/doc.slitaz.org/public_html
75 chown www.www ${WWW}/doc.slitaz.org/public_html/conf
76 chown www.www ${WWW}/doc.slitaz.org/public_html/conf/local.php
77 newline ;;
79 up-hg)
80 # Update hg.slitaz.org template
81 newline
82 boldify "Updating Mercurial template..."
83 cd ${REPOS}/slitaz-dev-tools && hg update
84 cp -a slitaz-mercurial-style/* ${PYTHON_LIB}/site-packages/mercurial
85 chown -R root.root ${PYTHON_LIB}/site-packages/mercurial/templates
86 newline ;;
88 up-pizza)
89 # Update mypizza.slitaz.org
90 newline
91 boldify "Updating Pizza builder..."
92 cd ${REPOS}/slitaz-pizza && hg update
93 cp /etc/slitaz/pizza.conf /etc/slitaz/pizza.conf.bak
94 make install; cd ..
95 cp -f /etc/slitaz/pizza.conf.bak /etc/slitaz/pizza.conf
96 pizza up-files
97 newline ;;
99 up-play)
100 # Update play.slitaz.me
101 newline
102 boldify "Updating play.slitaz.org..."
103 cd ${REPOS}/slitaz-forge && hg update
104 cp -rf play.slitaz.me/* ${WWW}/play.slitaz.me/public_html
105 # Tazcraft
106 root="${WWW}/play.slitaz.me/public_html/tazcraft"
107 cd ${REPOS}/tazcraft && hg update
108 rm -rf ${root}
109 cp -rf web ${root}
110 make install-server
111 newline ;;
113 up-pangolin)
114 # Update pangolin.slitaz.org and tools
115 newline
116 boldify "Updating tool: pangolin"
117 cd ${REPOS}/slitaz-forge/pangolin && hg up
118 make install
120 newline
121 boldify "Updating tool: slitaz-release"
122 cd ${REPOS}/slitaz-dev-tools/slitaz-release && hg up
123 make install
125 newline
126 boldify "Updating: pangolin.slitaz.org..."
127 cd ${REPOS}/slitaz-forge && hg up
128 cp -a pangolin/web/* ${WWW}/pangolin.slitaz.org/public_html
129 newline ;;
131 adduser)
132 [ ! "$2" ] && echo "Missing user name arg" && exit 0
133 [ ! "$3" ] && echo "Missing password arg" && exit 0
134 htpasswd -b ${HGUSERS} "$2" "$3" ;;
136 stats)
137 # Echo some stats.
138 newline
139 boldify "Memory usage"
140 separator
141 free -m | grep ^Mem
142 newline
143 boldify "Connected users"
144 separator
145 who
146 newline
147 boldify "HG users"
148 cat ${HGUSERS} | wc -l ;;
150 *)
151 usage ;;
152 esac
153 exit 0