slitaz-modular annotate initramfs/usr/bin/local-mirror @ rev 160

local-mirror: Add piratebox website support.
author Christopher Rogers <slaxemulator@gmail.com>
date Tue Jan 24 04:50:04 2012 -0500 (2012-01-24)
parents dc3284c77140
children 87aa12b14afa
rev   line source
slaxemulator@30 1 #!/bin/sh
slaxemulator@30 2
slaxemulator@32 3 source /usr/lib/slitaz/libtaz
slaxemulator@32 4 source_lib commons
slaxemulator@32 5 check_root
slaxemulator@79 6 . /etc/slitaz/slitaz.conf
slaxemulator@32 7
slaxemulator@30 8 . /etc/local-mirror.conf
slaxemulator@30 9
slaxemulator@112 10 COMMAND="$1"
slaxemulator@32 11 VERSION="0.1"
slaxemulator@32 12 usage() {
slaxemulator@32 13 echo "$0 $VERSION"
slaxemulator@46 14 echo "$0 [on|off|update-repos|tank-only|mirror-only]"
slaxemulator@101 15 echo "$0 [backup-mirror|up-src-links]"
slaxemulator@32 16 exit 1
slaxemulator@32 17 }
slaxemulator@32 18
slaxemulator@101 19 #[ -d /mnt/live/memory/mirror/packages ] && PKGDIR="/mnt/live/memory/mirror/packages"
slaxemulator@101 20 #[ -d /mnt/live/memory/mirror/src ] && SRCDIR="/mnt/live/memory/mirror/src"
slaxemulator@144 21 sync_mirror=$(find /mnt/live -maxdepth 3 -name "mirror" -type d | head -1)
slaxemulator@101 22
slaxemulator@144 23 COOKORDER="$(find /mnt/live/mnt/* -maxdepth 1 -name "cookorder.list")"
slaxemulator@80 24 CUR_PWD="$PWD"
slaxemulator@112 25 version="$(cat /etc/slitaz-release)"
slaxemulator@80 26
slaxemulator@112 27 [ -d $SLITAZ_DIR/$version ] || mkdir -p $SLITAZ_DIR/$version
slaxemulator@101 28 [ -d $SLITAZ_DIR/repos ] || ln -sf $REPOS_DIR $SLITAZ_DIR/repos
slaxemulator@89 29 [ -d $SLITAZ_DIR/repos ] && REPOS_DIR="$SLITAZ_DIR/repos"
slaxemulator@89 30
slaxemulator@138 31 if [ -d $PKGDIR ]; then
slaxemulator@138 32 [ -d $SLITAZ_DIR/$version/packages ] || ln -sf $PKGDIR $SLITAZ_DIR/$version/packages
slaxemulator@138 33 [ -d $SLITAZ_DIR/packages ] || ln -sf $PKGDIR $SLITAZ_DIR/packages
slaxemulator@138 34 fi
slaxemulator@138 35 if [ -d $SRCDIR ]; then
slaxemulator@138 36 [ -d $SLITAZ_DIR/$version/src ] || ln -sf $SRCDIR $SLITAZ_DIR/$version/src
slaxemulator@138 37 [ -d $SLITAZ_DIR/src ] || ln -sf $SRCDIR $SLITAZ_DIR/src
slaxemulator@138 38 fi
slaxemulator@138 39
slaxemulator@89 40 #repos folders for website
slaxemulator@89 41 PEOPLE_WWW_DIR="$REPOS_DIR/slitaz-forge/people"
slaxemulator@89 42 DOC_WWW_DIR="$REPOS_DIR/slitaz-forge/doc"
slaxemulator@89 43 PIZZA_WWW_DIR="$REPOS_DIR/slitaz-pizza/php"
slaxemulator@89 44 BOOT_WWW_DIR="$REPOS_DIR/slitaz-forge/boot"
slaxemulator@89 45 TANK_WWW_DIR="$REPOS_DIR/slitaz-forge/tank/web"
slaxemulator@89 46
slaxemulator@36 47 if [ "$COMMAND" = "tank-only" ]; then
slaxemulator@36 48 WWW="${WWW/mirror/}"
slaxemulator@36 49 ADDRESS="${ADDRESS/mirror.slitaz.org/}"
slaxemulator@36 50 VHOST_FILE="$VHOST_TANK_FILE"
slaxemulator@36 51 fi
slaxemulator@36 52
slaxemulator@36 53 if [ "$COMMAND" = "mirror-only" ]; then
slaxemulator@36 54 WWW="${WWW/tank/}"
slaxemulator@36 55 ADDRESS="mirror.slitaz.org"
slaxemulator@36 56 VHOST_FILE="$VHOST_MIRROR_FILE"
slaxemulator@36 57 fi
slaxemulator@36 58
slaxemulator@138 59 if [ ! -d $PKGDIR ]; then
slaxemulator@138 60 WWW="${WWW/pkg/}"
slaxemulator@138 61 ADDRESS="${ADDRESS/pkg.slitaz.org}"
slaxemulator@138 62 fi
slaxemulator@30 63 [ -d $REPOS_DIR ] || continue
slaxemulator@32 64
slaxemulator@102 65 INCOMING_REPOSITORY="$COOKING/packages-incoming"
slaxemulator@115 66 INCOMING="$SLITAZ_DIR/$version/incoming"
slaxemulator@89 67 CRON_FILE="/var/spool/cron/crontabs/root"
slaxemulator@89 68
slaxemulator@32 69 www() {
slaxemulator@32 70 b=$1
slaxemulator@101 71 [ -d $(dirname $CRON_FILE) ] || mkdir -p $(dirname $CRON_FILE)
slaxemulator@101 72 [ -f $CRON_FILE ] || touch $CRON_FILE
slaxemulator@101 73 [ -d $MAIN_WWW_DIR ] || mkdir -p $MAIN_WWW_DIR
slaxemulator@101 74 [ -L /var/www/vhosts ] || ln -sf $MAIN_WWW_DIR /var/www/vhosts
slaxemulator@101 75
slaxemulator@110 76 if [ -d $REPOS_DIR/wok-tank ]; then
slaxemulator@110 77 REPO_WOK=$REPOS_DIR/wok-tank
slaxemulator@101 78 if [ -x /usr/bin/hg ]; then
slaxemulator@101 79 cd $REPO_WOK
slaxemulator@101 80 if [ ! "$(hg branch)" = "cooking" ]; then
slaxemulator@101 81 hg update cooking
slaxemulator@101 82 fi
slaxemulator@101 83 cd $CUR_PWD
slaxemulator@101 84 fi
slaxemulator@101 85 elif [ -d $REPOS_DIR/wok ]; then
slaxemulator@101 86 REPO_WOK=$REPOS_DIR/wok
slaxemulator@101 87 fi
slaxemulator@102 88 [ -d $STABLE ] || mkdir -p $STABLE
slaxemulator@102 89 [ -d $COOKING ] || mkdir -p $COOKING
slaxemulator@149 90 [ -d $MAIN_WWW_DIR/pics/rrd ] || mkdir -p $MAIN_WWW_DIR/pics/rrd
slaxemulator@149 91
slaxemulator@34 92 case "$b" in
slaxemulator@34 93 website)
slaxemulator@160 94 cd $REPOS_DIR/$b
slaxemulator@160 95 hg update testing
slaxemulator@160 96 cd $CUR_DIR
slaxemulator@46 97 [ -d $REPOS_DIR/$b ] && ln -s $REPOS_DIR/$b $MAIN_WWW_DIR
slaxemulator@108 98 if [ -f $MAIN_WWW_DIR/$b/libs/get-feeds.sh ]; then
slaxemulator@108 99 if [ ! $(grep -l "$MAIN_WWW_DIR/$b/libs/get-feeds.sh" $CRON_FILE) ]; then
slaxemulator@89 100 echo "#Update SliTaz stuff" >> $CRON_FILE
slaxemulator@108 101 echo "*/20 * * * * $MAIN_WWW_DIR/$b/libs/get-feeds.sh" >> $CRON_FILE
slaxemulator@89 102 fi
slaxemulator@89 103 fi
slaxemulator@34 104 ;;
slaxemulator@34 105 people)
slaxemulator@46 106 [ -d $REPOS_DIR/slitaz-forge/people ] && ln -s $REPOS_DIR/slitaz-forge/people $MAIN_WWW_DIR/people
slaxemulator@34 107 ;;
slaxemulator@34 108 doc)
slaxemulator@46 109 [ -d $DOC_WWW_DIR ] && cp -a $DOC_WWW_DIR $MAIN_WWW_DIR/doc
slaxemulator@46 110 [ -d /var/www/dokuwiki ] && cp -a /var/www/dokuwiki/* $MAIN_WWW_DIR/doc
slaxemulator@138 111 VAR="index attic meta media pages"
slaxemulator@34 112 for i in $VAR; do
slaxemulator@46 113 [ -d $REPOS_DIR/slitaz-doc-wiki-data ] && cp -a $REPOS_DIR/slitaz-doc-wiki-data/$i $MAIN_WWW_DIR/doc/data
slaxemulator@32 114 done
slaxemulator@138 115 #[ -d $REPOS_DIR/slitaz-doc-wiki-data/plugins ] && cp -a $REPOS_DIR/slitaz-doc-wiki-data/plugins $MAIN_WWW_DIR/doc/lib
slaxemulator@46 116 chown root.root -R $MAIN_WWW_DIR/doc
slaxemulator@46 117 chmod 777 -R $MAIN_WWW_DIR/doc
slaxemulator@34 118 ;;
slaxemulator@89 119 bugs)
slaxemulator@89 120 [ -d $SLITAZ_DIR/bugs ] || mkdir -p $SLITAZ_DIR/bugs
slaxemulator@89 121 [ -d $MAIN_WWW_DIR/bugs ] || mkdir -p $MAIN_WWW_DIR/bugs
slaxemulator@89 122 [ -d $REPOS_DIR/slitaz-forge/bugs ] && cp -a $REPOS_DIR/slitaz-forge/bugs/roundup.wsgi $SLITAZ_DIR/bugs/roundup.wsgi
slaxemulator@89 123 [ -d $REPOS_DIR/slitaz-forge/bugs ] && cp -a $REPOS_DIR/slitaz-forge/bugs/server.ini $SLITAZ_DIR/bugs/server.ini
slaxemulator@89 124 [ -d $REPOS_DIR/slitaz-forge/bugs/templates/slitaz ] && cp -a $REPOS_DIR/slitaz-forge/bugs/templates/slitaz/* $SLITAZ_DIR/bugs
slaxemulator@89 125 [ -f /usr/share/roundup/cgi-bin/roundup.cgi ] && ln -sf /usr/share/roundup/cgi-bin/roundup.cgi $MAIN_WWW_DIR/bugs/roundup.cgi
slaxemulator@89 126 ;;
slaxemulator@34 127 pizza)
slaxemulator@46 128 [ -d $PIZZA_WWW_DIR ] && ln -sf $PIZZA_WWW_DIR $MAIN_WWW_DIR/pizza
slaxemulator@34 129 ;;
slaxemulator@34 130 bb)
slaxemulator@46 131 [ -d /usr/share/slitaz/web-bb ] && cp -a /usr/share/slitaz/web-bb $MAIN_WWW_DIR/bb
slaxemulator@46 132 #[ -d /usr/share/slitaz/web ] && cp -a /usr/share/slitaz/web $MAIN_WWW_DIR/bb/web
slaxemulator@89 133 [ -d $REPOS_DIR/website/images ] && ln -sf $REPOS_DIR/website/images $MAIN_WWW_DIR/bb/images
slaxemulator@80 134 [ -d $INCOMING_REPOSITORY ] || mkdir -p $INCOMING_REPOSITORY
slaxemulator@80 135 [ -f $INCOMING_REPOSITORY/packages.desc ] || touch $INCOMING_REPOSITORY/packages.desc
slaxemulator@80 136 [ -f $INCOMING_REPOSITORY/packages.equiv ] || touch $INCOMING_REPOSITORY/packages.equiv
slaxemulator@80 137 [ -f $INCOMING_REPOSITORY/packages.list ] || touch $INCOMING_REPOSITORY/packages.list
slaxemulator@80 138 [ -f $INCOMING_REPOSITORY/packages.md5 ] || touch $INCOMING_REPOSITORY/packages.md5
slaxemulator@80 139 [ -f $INCOMING_REPOSITORY/packages.txt ] || touch $INCOMING_REPOSITORY/packages.txt
slaxemulator@102 140 [ -d $PKGDIR ] && ln -sf $PKGDIR $COOKING/packages
slaxemulator@102 141 [ -d $SRCDIR ] && ln -sf $SRCDIR $COOKING/src
slaxemulator@89 142 if [ "$CUSTOM_WOK" = "yes" ]; then
slaxemulator@89 143 tazwok gen-wok-db --WOK=$REPO_WOK
slaxemulator@89 144 if [ -f $COOKORDER ]; then
slaxemulator@89 145 [ -d $COOKING/wok ] || mkdir -p $COOKING/wok
slaxemulator@89 146 [ -d $COOKING/clean-wok ] || mkdir -p $COOKING/clean-wok
slaxemulator@89 147 cat $COOKORDER | while read pkg; do
slaxemulator@89 148 rwanted=$(grep $'\t'$pkg$ $INCOMING_REPOSITORY/wok-wanted.txt | cut -f 1)
slaxemulator@89 149 for i in $rwanted; do
slaxemulator@89 150 [ -f $COOKING/clean-wok/$i/receipt ] || cp -a $REPO_WOK/$i $COOKING/clean-wok/$i
slaxemulator@89 151 [ -f $COOKING/wok/$i/receipt ] || cp -a $REPO_WOK/$i $COOKING/wok/$i
slaxemulator@89 152 done
slaxemulator@89 153 [ -f $COOKING/clean-wok/$pkg/receipt ] || cp -a $REPO_WOK/$pkg $COOKING/clean-wok/$pkg
slaxemulator@89 154 [ -f $COOKING/wok/$pkg/receipt ] || cp -a $REPO_WOK/$pkg $COOKING/wok/$pkg
slaxemulator@80 155 done
slaxemulator@89 156 unset i
slaxemulator@89 157 tazwok gen-wok-db --WOK=$COOKING/clean-wok
slaxemulator@89 158 fi
slaxemulator@80 159 else
slaxemulator@80 160 [ -d $COOKING/clean-wok ] || ln -sf $REPO_WOK $COOKING/clean-wok
slaxemulator@80 161 [ -d $COOKING/wok ] || ln -sf $REPO_WOK $COOKING/wok
slaxemulator@80 162 fi
slaxemulator@80 163 [ -d $STABLE/clean-wok ] || ln -sf $REPOS_DIR/wok-stable $STABLE/clean-wok
slaxemulator@46 164 [ -d $STABLE/wok ] || ln -sf $REPOS_DIR/wok-stable $STABLE/wok
slaxemulator@80 165 [ -f $SRCDIR/sources.list ] || tazwok gen-src $SRCDIR --WOK=$REPO_WOK
slaxemulator@54 166 [ -d $REPOS_DIR/slitaz-modular ] && ln -sf $REPOS_DIR/slitaz-modular $COOKING/slitaz-modular
slaxemulator@46 167 echo -e "$MAIN_WWW_DIR/bb" | tazwok webserver on
slaxemulator@34 168 ;;
slaxemulator@112 169 cook)
slaxemulator@115 170 #pwd=$(pwd)
slaxemulator@115 171 #if [ -d $REPOS_DIR/my-cookutils ]; then
slaxemulator@115 172 # cd $REPOS_DIR/my-cookutils
slaxemulator@115 173 # if [ "$(hg branch)" != "testing" ]; then
slaxemulator@115 174 # hg update testing
slaxemulator@115 175 # fi
slaxemulator@115 176 # make install
slaxemulator@115 177 # cd $pwd
slaxemulator@115 178 #fi
slaxemulator@124 179 echo "$SLITAZ_DIR/$version/packages" > $LOCALSTATE/mirror
slaxemulator@115 180 [ -d $LOCALSTATE/undigest/incoming ] || mkdir -p $LOCALSTATE/undigest/incoming
slaxemulator@115 181 [ -f $LOCALSTATE/undigest/incoming/mirror ] || echo "$INCOMING" > $LOCALSTATE/undigest/incoming/mirror
slaxemulator@121 182 echo "incoming" > $LOCALSTATE/priority
slaxemulator@115 183 [ -d $SLITAZ_DIR/$version/incoming ] || mkdir -p $SLITAZ_DIR/$version/incoming
slaxemulator@149 184 [ -d /var/www/cooker ] && cp -a /var/www/cooker $MAIN_WWW_DIR/$b
slaxemulator@149 185 [ -f /usr/share/$b/header.html ] && cp -a /usr/share/$b/header.html $MAIN_WWW_DIR/$b/header.html
slaxemulator@149 186 [ -f /etc/slitaz/$b.conf ] && cp -a /etc/slitaz/$b.conf $MAIN_WWW_DIR/$b/$b.conf
slaxemulator@112 187 if [ "$MKCHROOT" = "yes" ]; then
slaxemulator@138 188 if [ -d $PKGDIR ]; then
slaxemulator@142 189 tazpkg recharge
slaxemulator@138 190 tazdev gen-chroot $version
slaxemulator@138 191 [ -d $SLITAZ_DIR/$version/chroot ] && mkdir -p $SLITAZ_DIR/$version/chroot$(dirname $CRON_FILE)
slaxemulator@138 192 [ -d $SLITAZ_DIR/$version/chroot ] && echo "0 */2 * * * /usr/bin/cooker" > $SLITAZ_DIR/$version/chroot${CRON_FILE}
slaxemulator@138 193 [ -d $SLITAZ_DIR/$version/chroot ] && echo "$SLITAZ_DIR/$version/packages" > $SLITAZ_DIR/$version/chroot${LOCALSTATE}/mirror
slaxemulator@138 194 mkdir -p $SLITAZ_DIR/$version/chroot${LOCALSTATE}/undigest/incoming
slaxemulator@138 195 echo "$SLITAZ_DIR/$version/incoming" > $SLITAZ_DIR/$version/chroot${LOCALSTATE}/undigest/incoming/mirror
slaxemulator@138 196 fi
slaxemulator@112 197 fi
slaxemulator@112 198 [ -d $REPOS_DIR/wok-tank ] && ln -sf $REPOS_DIR/wok-tank $SLITAZ_DIR/$version/wok-hg
slaxemulator@112 199 #[ -d $REPOS_DIR/wok-tank ] && ln -sf $REPOS_DIR/wok-tank $SLITAZ_DIR/$version/wok
slaxemulator@149 200 [ -d $MAIN_WWW_DIR/$b/packages ] || ln -sf $SLITAZ_DIR/$version/packages $MAIN_WWW_DIR/$b/packages
slaxemulator@149 201 [ -d $MAIN_WWW_DIR/$b/incoming ] || ln -sf $SLITAZ_DIR/$version/incoming $MAIN_WWW_DIR/$b/incoming
slaxemulator@112 202 ;;
slaxemulator@34 203 pkgs)
slaxemulator@46 204 [ -d $MAIN_WWW_DIR/pkgs ] || mkdir -p $MAIN_WWW_DIR/pkgs
slaxemulator@112 205 pwd=$(pwd)
slaxemulator@142 206 #if [ -d $REPOS_DIR/slitaz-dev-tools/tazpkg-web ]; then
slaxemulator@142 207 # cd $REPOS_DIR/slitaz-dev-tools/tazpkg-web
slaxemulator@142 208 # make install
slaxemulator@142 209 # cd $pwd
slaxemulator@142 210 #fi
slaxemulator@158 211 [ -d /var/lib/tazpkg-web/style ] && cp -a /var/lib/tazpkg-web/style $MAIN_WWW_DIR/pkgs
slaxemulator@142 212 [ -f /var/lib/tazpkg-web/search.cgi ] && cp -a /var/lib/tazpkg-web/search.cgi $MAIN_WWW_DIR/pkgs
slaxemulator@142 213 #[ -d $REPOS_DIR/slitaz-dev-tools/tazpkg-web/style ] && cp -a $REPOS_DIR/slitaz-dev-tools/tazpkg-web/style/* $MAIN_WWW_DIR/pkgs
slaxemulator@142 214 #[ -f $REPOS_DIR/slitaz-dev-tools/tazpkg-web/search.cgi ] && cp -a $REPOS_DIR/slitaz-dev-tools/tazpkg-web/search.cgi $MAIN_WWW_DIR/pkgs
slaxemulator@34 215 [ -d $REPOS_DIR/flavors ] && ln -sf $REPOS_DIR/flavors $COOKING/flavors
slaxemulator@112 216 #[ -d $REPOS_DIR/flavors-stable ] && ln -sf $REPOS_DIR/flavors-stable $STABLE/flavors
slaxemulator@80 217 #[ -d $COOKING/wok ] || ln -sf $REPOS_DIR/wok $COOKING/clean-wok
slaxemulator@112 218 #[ -d $STABLE/clean-wok ] || ln -sf $REPOS_DIR/wok-stable $STABLE/clean-wok
slaxemulator@97 219 if [ -f "/usr/bin/tazpkg-web" ]; then
slaxemulator@97 220 tazpkg-web cooking
slaxemulator@97 221 if [ ! $(grep -l "/usr/bin/tazpkg-web cooking" $CRON_FILE) ]; then
slaxemulator@97 222 echo "# Update pkgs.slitaz.org pages" >> $CRON_FILE
slaxemulator@97 223 echo "20 02 * * * /usr/bin/tazpkg-web cooking" >> $CRON_FILE
slaxemulator@97 224 fi
slaxemulator@97 225 fi
slaxemulator@34 226 ;;
slaxemulator@34 227 mirror)
slaxemulator@46 228 [ -d $REPOS_DIR/slitaz-dev-tools/mirror-tools/mirror-info ] && cp -a $REPOS_DIR/slitaz-dev-tools/mirror-tools/mirror-info $MAIN_WWW_DIR
slaxemulator@46 229 [ -d $REPOS_DIR/slitaz-dev-tools/mirror-tools/slitaz ] && cp -a $REPOS_DIR/slitaz-dev-tools/mirror-tools/slitaz $MAIN_WWW_DIR
slaxemulator@46 230 [ -d $MAIN_WWW_DIR/slitaz/mirror/packages ] || mkdir -p $MAIN_WWW_DIR/slitaz/mirror/packages
slaxemulator@115 231 [ -d $PKGDIR ] && ln -sf $PKGDIR $MAIN_WWW_DIR/slitaz/mirror/packages/$version
slaxemulator@129 232 [ -d /var/www/slitaz ] || ln -sf $MAIN_WWW_DIR/slitaz /var/www/slitaz
slaxemulator@129 233 [ -d /var/www/mirror-info ] || ln -sf $MAIN_WWW_DIR/mirror-info /var/www/mirror-info
slaxemulator@146 234 [ -d $MAIN_WWW_DIR/mirror-info/pics ] || mkdir -p $MAIN_WWW_DIR/mirror-info/pics
slaxemulator@146 235 [ -d $MAIN_WWW_DIR/mirror-info/pics/rrd ] || ln -sf $MAIN_WWW_DIR/pics/rrd $MAIN_WWW_DIR/mirror-info/pics/rrd
slaxemulator@146 236 if [ -f /usr/bin/makegraphs ]; then
slaxemulator@148 237 [ -f $MAIN_WWW_DIR/pics/makegraphs ] || cp -a /usr/bin/makegraphs $MAIN_WWW_DIR/pics/makegraphs
slaxemulator@148 238 if [ ! $(grep -l "$MAIN_WWW_DIR/pics/makegraphs" $CRON_FILE) ]; then
slaxemulator@146 239 echo "# Update system load graphics" >> $CRON_FILE
slaxemulator@148 240 echo "*/5 * * * * $MAIN_WWW_DIR/pics/makegraphs" >> $CRON_FILE
slaxemulator@129 241 fi
slaxemulator@34 242 fi
slaxemulator@34 243 ;;
slaxemulator@34 244 boot)
slaxemulator@46 245 [ -d $BOOT_WWW_DIR ] && cp -a $BOOT_WWW_DIR $MAIN_WWW_DIR/$b
slaxemulator@89 246 #[ -d $REPOS_DIR/website/pics ] && ln -sf $REPOS_DIR/website/images $MAIN_WWW_DIR/$b/images
slaxemulator@34 247 ;;
slaxemulator@34 248 tank)
slaxemulator@144 249 [ -d $TANK_WWW_DIR ] && cp -a $TANK_WWW_DIR $MAIN_WWW_DIR/$b
slaxemulator@34 250 [ -f /usr/share/awstats/extras/update ] && ln -sf /usr/share/awstats/extras/update /usr/sbin/awsupdate_all
slaxemulator@34 251 [ -d $REPOS_DIR/slitaz-forge/$b/files/etc/awstats ] && cp -a $REPOS_DIR/slitaz-forge/$b/files/etc/awstats/* /etc/awstats
slaxemulator@34 252 for i in $ADDRESS; do
slaxemulator@34 253 if [ -f /etc/awstats/awstats.$i.conf ]; then
slaxemulator@34 254 dirlog=$(grep ^DirData= /etc/awstats/awstats.$i.conf | cut -d "=" -f2 | sed -e 's/"//g')
slaxemulator@34 255 mkdir -p $dirlog
slaxemulator@34 256 fi
slaxemulator@34 257 done
slaxemulator@146 258 [ -d $MAIN_WWW_DIR/$b/pics ] || mkdir -p $MAIN_WWW_DIR/$b/pics
slaxemulator@146 259 [ -d $MAIN_WWW_DIR/$b/pics/rrd ] || ln -sf $MAIN_WWW_DIR/pics/rrd $MAIN_WWW_DIR/$b/pics/rrd
slaxemulator@97 260 if [ -f /usr/share/awstats/extras/update ]; then
slaxemulator@97 261 if [ ! $(grep -l "/usr/share/awstats/extras/update" $CRON_FILE) ]; then
slaxemulator@97 262 echo "# Update Web stats" >> $CRON_FILE
slaxemulator@97 263 echo "*/5 * * * * /usr/share/awstats/extras/update" >> $CRON_FILE
slaxemulator@97 264 fi
slaxemulator@97 265 fi
slaxemulator@146 266 if [ -f /usr/bin/makegraphs ]; then
slaxemulator@148 267 [ -f $MAIN_WWW_DIR/pics/makegraphs ] || cp -a /usr/bin/makegraphs $MAIN_WWW_DIR/pics/makegraphs
slaxemulator@148 268 if [ ! $(grep -l "$MAIN_WWW_DIR/pics/makegraphs" $CRON_FILE) ]; then
slaxemulator@146 269 echo "# Update system load graphics" >> $CRON_FILE
slaxemulator@148 270 echo "*/5 * * * * $MAIN_WWW_DIR/pics/makegraphs" >> $CRON_FILE
slaxemulator@97 271 fi
slaxemulator@97 272 fi
slaxemulator@34 273 ;;
slaxemulator@34 274 hg)
slaxemulator@46 275 [ -d $MAIN_WWW_DIR/hg ] || mkdir -p $MAIN_WWW_DIR/hg
slaxemulator@46 276 [ -f /usr/share/examples/mercurial/hgwebdir.cgi ] && cp -a /usr/share/examples/mercurial/hgwebdir.cgi $MAIN_WWW_DIR/hg
slaxemulator@142 277 [ -f /usr/share/examples/mercurial/hgwebdir.cgi ] && cp -a /usr/share/examples/mercurial/hgwebdir.cgi $MAIN_WWW_DIR/hg/hgwebdir.py
slaxemulator@142 278 [ -f $REPOS_DIR/slitaz-forge/tank/files/etc/mercurial/hgweb.config ] && cp -a $REPOS_DIR/slitaz-forge/tank/files/etc/mercurial/hgweb.config /etc/mercurial
slaxemulator@142 279 [ -f $REPOS_DIR/slitaz-forge/tank/files/etc/mercurial/hgweb.config-mirror ] && cp -a $REPOS_DIR/slitaz-forge/tank/files/etc/mercurial/hgweb.config-mirror /etc/mercurial
slaxemulator@142 280 sed -i 's|/etc/mercurial/hgweb.config|/etc/mercurial/hgweb.config-mirror|g' $MAIN_WWW_DIR/hg/hgwebdir.py
slaxemulator@34 281 #[ -f /etc/mercurial/hgweb.conf ] && sed -i 's|style = slitaz|style = gitweb|g' /etc/mercurial/hgweb.config
slaxemulator@34 282 ;;
slaxemulator@42 283 lfs)
slaxemulator@154 284 #[ -d $MAIN_WWW_DIR/lfs ] || ln -sf /usr/share/doc/lfs-book $MAIN_WWW_DIR/lfs ;;
slaxemulator@154 285 fake-website /usr/share/doc/lfs-book lfs.slitaz.org ;;
slaxemulator@131 286 hgbook)
slaxemulator@154 287 #if [ -d /usr/share/hgbook ]; then
slaxemulator@154 288 # [ -d $MAIN_WWW_DIR/hgbook ] || ln -sf /usr/share/hgbook $MAIN_WWW_DIR/hgbook
slaxemulator@154 289 #fi ;;
slaxemulator@154 290 fake-website /usr/share/hgbook hgbook.slitaz.org ;;
slaxemulator@131 291 absguide)
slaxemulator@154 292 #if [ -d /usr/share/absguide ]; then
slaxemulator@154 293 # [ -d $MAIN_WWW_DIR/absguide ] || ln -sf /usr/share/absguide $MAIN_WWW_DIR/absguide
slaxemulator@154 294 #fi ;;
slaxemulator@154 295 fake-website /usr/share/absguide absguide.slitaz.org ;;
slaxemulator@151 296 man-html)
slaxemulator@154 297 #if [ -d /usr/share/man-html ]; then
slaxemulator@154 298 # [ -d $MAIN_WWW_DIR/man-html ] || ln -sf /usr/share/man-html $MAIN_WWW_DIR/man-html
slaxemulator@154 299 #fi ;;
slaxemulator@156 300 fake-website /usr/share/man-html man-html.slitaz.org ;;
slaxemulator@131 301 gimp.en)
slaxemulator@154 302 #if [ -d /usr/share/gimp/2.0/help/en ]; then
slaxemulator@154 303 # [ -d $MAIN_WWW_DIR/gimp_en ] || ln -sf /usr/share/gimp/2.0/help/en $MAIN_WWW_DIR/gimp_en
slaxemulator@154 304 #fi ;;
slaxemulator@154 305 fake-website /usr/share/gimp/2.0/help/en gimp.en.slitaz.org ;;
slaxemulator@131 306 gimp.fr)
slaxemulator@154 307 #if [ -d /usr/share/gimp/2.0/help/fr ]; then
slaxemulator@154 308 # [ -d $MAIN_WWW_DIR/gimp_fr ] || ln -sf /usr/share/gimp/2.0/help/fr $MAIN_WWW_DIR/gimp_fr
slaxemulator@154 309 #fi ;;
slaxemulator@154 310 fake-website /usr/share/gimp/2.0/help/fr gimp.fr.slitaz.org ;;
slaxemulator@131 311 gimp.es)
slaxemulator@154 312 #if [ -d /usr/share/gimp/2.0/help/es ]; then
slaxemulator@154 313 # [ -d $MAIN_WWW_DIR/gimp_es ] || ln -sf /usr/share/gimp/2.0/help/es $MAIN_WWW_DIR/gimp_es
slaxemulator@154 314 #fi ;;
slaxemulator@154 315 fake-website /usr/share/gimp/2.0/help/es gimp.es.slitaz.org ;;
slaxemulator@160 316 piratebox)
slaxemulator@160 317 cd $REPOS_DIR/piratebox
slaxemulator@160 318 hg update lighttpd
slaxemulator@160 319 cd $CUR_PWD
slaxemulator@160 320 if [ -d $REPOS_DIR/piratebox/piratebox/www ]; then
slaxemulator@160 321 cp -a $REPOS_DIR/piratebox/piratebox/www $MAIN_WWW_DIR/piratebox
slaxemulator@160 322 fi
slaxemulator@160 323 if [ -f $MAIN_WWW_DIR/piratebox/cgi-bin/data.pso ]; then
slaxemulator@160 324 chmod -R 777 $MAIN_WWW_DIR/piratebox/cgi-bin/data.pso
slaxemulator@160 325 fi
slaxemulator@160 326 if [ ! -d $MAIN_WWW_DIR/piratebox/share ]; then
slaxemulator@160 327 mkdir -p $MAIN_WWW_DIR/piratebox/share
slaxemulator@160 328 chmod -R 777 $MAIN_WWW_DIR/piratebox/share
slaxemulator@160 329 fi
slaxemulator@160 330 ;;
slaxemulator@151 331 linuxgazette)
slaxemulator@154 332 #if [ -d /repos/linuxgazette ]; then
slaxemulator@154 333 # [ -d $MAIN_WWW_DIR/linuxgazette ] || ln -sf /repos/linuxgazette $MAIN_WWW_DIR/linuxgazette
slaxemulator@154 334 #fi ;;
slaxemulator@156 335 fake-website /repos/linuxgazette linuxgazette.net ;;
slaxemulator@34 336 esac
slaxemulator@32 337 }
slaxemulator@30 338
slaxemulator@32 339 repos() {
slaxemulator@32 340 for repo in $REPOS; do
slaxemulator@32 341 [ -d $REPOS_DIR/$repo ] || continue
slaxemulator@36 342 if [ -d $REPOS_DIR/$repo/.hg ]; then
slaxemulator@36 343 mkdir -p $REPOS_WEB_DIR/$repo
slaxemulator@36 344 [ -d $REPOS_WEB_DIR/$repo/.hg ] || ln -s $REPOS_DIR/$repo/.hg $REPOS_WEB_DIR/$repo/.hg
slaxemulator@36 345 if [ ! $(grep -l "$REPOS_WEB_DIR" /etc/mercurial/hgweb.config) ]; then
slaxemulator@36 346 [ -f /etc/mercurial/hgweb.config ] && sed -i "s|$REPOS_DIR|$REPOS_WEB_DIR|g" /etc/mercurial/hgweb.config
slaxemulator@36 347 fi
slaxemulator@36 348 fi
slaxemulator@32 349 if [ ! -f $REPOS_DIR/$repo/.hg/hgrc-web ]; then
slaxemulator@36 350 touch $REPOS_DIR/$repo/.hg/hgrc-web
slaxemulator@97 351 cat "$REPOS_DIR/$repo/.hg/hgrc" >> $REPOS_DIR/$repo/.hg/hgrc-web
slaxemulator@36 352 echo "[web]" >> $REPOS_DIR/$repo/.hg/hgrc-web
slaxemulator@36 353 #[ -d $REPOS_DIR/$repo/.hg ] && echo "style = slitaz" >> $REPOS_DIR/$repo/.hg/hgrc-web
slaxemulator@36 354 echo "staticurl = http://hg.slitaz.org/static/" >> $REPOS_DIR/$repo/.hg/hgrc-web
slaxemulator@36 355 echo "push_ssl = false" >> $REPOS_DIR/$repo/.hg/hgrc-web
slaxemulator@36 356 echo "allow_push = *" >> $REPOS_DIR/$repo/.hg/hgrc-web
slaxemulator@36 357 #[ ! -f $REPOS_DIR/$repo/.hg/hgrc-pull ] && mv $REPOS_DIR/$repo/.hg/hgrc $REPOS_DIR/$repo/.hg/hgrc-pull
slaxemulator@36 358 cp -a $REPOS_DIR/$repo/.hg/hgrc-web $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 359 fi
slaxemulator@30 360
slaxemulator@32 361 if [ ! $(grep -l 'name = ' $REPOS_DIR/$repo/.hg/hgrc ) ]; then
slaxemulator@32 362 echo "name = $repo" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 363 fi
slaxemulator@30 364
slaxemulator@32 365 if [ ! $(grep -l 'contact = ' $REPOS_DIR/$repo/.hg/hgrc ) ]; then
slaxemulator@97 366 [ "$repo" = "cookutils" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@112 367 [ "$repo" = "my-cookutils" ] && echo "contact = Christopher Rogers" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 368 [ "$repo" = "flavors" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 369 [ "$repo" = "flavors-stable" ] && echo "contact = Pascal Bellard" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 370 [ "$repo" = "slitaz-base-files" ] && echo "contact = Pascal Bellard" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 371 [ "$repo" = "slitaz-boot-scripts" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 372 [ "$repo" = "slitaz-configs" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 373 [ "$repo" = "slitaz-dev-tools" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 374 [ "$repo" = "slitaz-doc" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 375 [ "$repo" = "slitaz-doc-wiki-data" ] && echo "contact = Christopher Rogers" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 376 [ "$repo" = "slitaz-forge" ] && echo "contact = Eric Joseph-Alexandre" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 377 [ "$repo" = "slitaz-modular" ] && echo "contact = Christopher Rogers" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 378 [ "$repo" = "slitaz-pizza" ] && echo "contact = Pascal Bellard" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 379 [ "$repo" = "slitaz-tools" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@79 380 [ "$repo" = "slitaz-vz" ] && echo "contact = Eric Joseph-Alexandre" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@121 381 [ "$repo" = "ssfs" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 382 [ "$repo" = "tazlito" ] && echo "contact = Pascal Bellard" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@80 383 [ "$repo" = "tazpanel" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 384 [ "$repo" = "tazpkg" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 385 [ "$repo" = "tazusb" ] && echo "contact = Eric Joseph-Alexandre" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 386 [ "$repo" = "tazwok" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 387 [ "$repo" = "website" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 388 [ "$repo" = "wok" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 389 [ "$repo" = "wok-stable" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@110 390 [ "$repo" = "wok-tank" ] && echo "contact = Christopher Rogers" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 391 [ "$repo" = "wok-tiny" ] && echo "contact = Pascal Bellard" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 392 [ "$repo" = "wok-undigest" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 393 fi
slaxemulator@30 394
slaxemulator@32 395 if [ ! $(grep -l 'description = ' $REPOS_DIR/$repo/.hg/hgrc) ]; then
slaxemulator@97 396 [ "$repo" = "cookutils" ] && echo "description = Utils to cook SliTaz packages" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@112 397 [ "$repo" = "my-cookutils" ] && echo "description = More powerful version of cookutils" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 398 [ "$repo" = "flavors" ] && echo "description = SliTaz Cooking flavors" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 399 [ "$repo" = "flavors-stable" ] && echo "description = SliTaz Stable flavors" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 400 [ "$repo" = "slitaz-base-files" ] && echo "description = SliTaz base files" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 401 [ "$repo" = "slitaz-boot-scripts" ] && echo "description = SliTaz boot scripts" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 402 [ "$repo" = "slitaz-configs" ] && echo "description = SliTaz configuration files" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 403 [ "$repo" = "slitaz-dev-tools" ] && echo "description = SliTaz Developers Tools" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 404 [ "$repo" = "slitaz-doc" ] && echo "description = SliTaz system doc" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 405 [ "$repo" = "slitaz-doc-wiki-data" ] && echo "description = SliTaz documentation wiki content" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 406 [ "$repo" = "slitaz-forge" ] && echo "description = SliTaz Forge Config" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 407 [ "$repo" = "slitaz-modular" ] && echo "description = Scripts to make SliTaz Modular" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 408 [ "$repo" = "slitaz-pizza" ] && echo "description = SliTaz Online flavor builder" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 409 [ "$repo" = "slitaz-tools" ] && echo "description = SliTaz Tools and Tinyutils" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@79 410 [ "$repo" = "slitaz-vz" ] && echo "description = SliTaz OpenVZ integration" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@118 411 [ "$repo" = "ssfs" ] && echo "description = SliTaz Secure File Storage" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 412 [ "$repo" = "tazlito" ] && echo "description = SliTaz Live Tool" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@79 413 [ "$repo" = "tazpanel" ] && echo "description = Slitaz Administration Panel" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 414 [ "$repo" = "tazpkg" ] && echo "description = SliTaz Packages manager" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 415 [ "$repo" = "tazusb" ] && echo "description = SliTaz LiveUSB utility" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@79 416 [ "$repo" = "tazwok" ] && echo "description = SliTaz Packages builder" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 417 [ "$repo" = "website" ] && echo "description = SliTaz Website" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 418 [ "$repo" = "wok" ] && echo "description = SliTaz Cooking wok" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 419 [ "$repo" = "wok-stable" ] && echo "description = SliTaz Stable wok" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@110 420 [ "$repo" = "wok-tank" ] && echo "description = SliTaz Tank Mirror wok" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 421 [ "$repo" = "wok-tiny" ] && echo "description = Tiny SliTaz wok" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 422 [ "$repo" = "wok-undigest" ] && echo "description = SliTaz Undigest wok" >> $REPOS_DIR/$repo/.hg/hgrc
slaxemulator@32 423 fi
slaxemulator@32 424 done
slaxemulator@32 425 }
slaxemulator@30 426
slaxemulator@129 427 up_src_links() {
slaxemulator@129 428 local i
slaxemulator@129 429 if [ -d $SRCDIR ]; then
slaxemulator@129 430 [ -d $MAIN_WWW_DIR/slitaz/mirror/sources/packages ] && rm -rf $MAIN_WWW_DIR/slitaz/mirror/sources/packages
slaxemulator@129 431 for i in $(ls $SRCDIR); do
slaxemulator@129 432 [ -d $MAIN_WWW_DIR/slitaz/mirror/sources/packages/${i:0:1} ] || mkdir -p $MAIN_WWW_DIR/slitaz/mirror/sources/packages/${i:0:1}
slaxemulator@129 433 [ -f $MAIN_WWW_DIR/slitaz/mirror/sources/packages/${i:0:1}/$i ] || ln -sf $SRCDIR/$i $MAIN_WWW_DIR/slitaz/mirror/sources/packages/${i:0:1}/$i
slaxemulator@129 434 done
slaxemulator@129 435 fi
slaxemulator@129 436 }
slaxemulator@129 437
slaxemulator@32 438 case "$COMMAND" in
slaxemulator@89 439 start|on|tank-only|mirror-only)
slaxemulator@46 440 [ -d $MAIN_WWW_DIR/mirror-info ] && WWW="${WWW/mirror /}"
slaxemulator@32 441 for c in $WWW; do
slaxemulator@46 442 if [ ! -d $MAIN_WWW_DIR/$c ]; then
slaxemulator@32 443 www $c
slaxemulator@36 444 [ "$c" = "hg" ] && repos
slaxemulator@32 445 fi
slaxemulator@32 446 done
slaxemulator@154 447 #echo "127.0.0.1 localhost $(cat /etc/hostname)" > /etc/hosts
slaxemulator@154 448 [ "$IP_ADDR" == "127.0.0.1" ] && echo "127.0.0.1 tazpanel.slitaz.org" >> /etc/hosts
slaxemulator@32 449 for hostname in $ADDRESS; do
slaxemulator@89 450 if [ "$hostname" = "www.slitaz.org" ]; then
slaxemulator@93 451 echo "$IP_ADDR $hostname slitaz.org" >> /etc/hosts
slaxemulator@89 452 else
slaxemulator@42 453 echo "$IP_ADDR $hostname" >> /etc/hosts
slaxemulator@89 454 fi
slaxemulator@133 455 done
slaxemulator@133 456 if [ ! -L /usr/share/awstats/icon/other/slitaz-spider-48x48.png ]; then
slaxemulator@144 457 ln -s $REPOS_DIR/website/images/artwork/slitaz-spider-48x48.png /usr/share/awstats/icon/other/slitaz-spider-48x48.png
slaxemulator@133 458 fi
slaxemulator@42 459 if [ "$IP_ADDR" != "127.0.0.1" ]; then
slaxemulator@89 460 if [ ! $(grep -l "dhcp-option=option:router,$ROUTER_IP" /etc/dnsmasq.conf) ]; then
slaxemulator@89 461 echo "$IP_ADDR tazpanel tazpanel.slitaz.org" >> /etc/hosts
slaxemulator@42 462 echo "dhcp-option=option:router,$ROUTER_IP" >> /etc/dnsmasq.conf
slaxemulator@42 463 fi
slaxemulator@42 464 fi
slaxemulator@124 465 if [ -d "$SLITAZ_DIR/$version/packages" ]; then
slaxemulator@124 466 echo "$SLITAZ_DIR/$version/packages" > $LOCALSTATE/mirror
slaxemulator@124 467 fi
slaxemulator@36 468 if [ "$COMMAND" = "tank-only" ]; then
slaxemulator@36 469 [ -f $VHOST_TANK_FILE ] && ln -sf $VHOST_TANK_FILE /etc/lighttpd/vhosts.conf
slaxemulator@36 470 elif [ "$COMMAND" = "mirror-only" ]; then
slaxemulator@36 471 [ -f $VHOST_MIRROR_FILE ] && ln -sf $VHOST_MIRROR_FILE /etc/lighttpd/vhosts.conf
slaxemulator@36 472 else
slaxemulator@36 473 [ -f $VHOST_FILE ] && ln -sf $VHOST_FILE /etc/lighttpd/vhosts.conf
slaxemulator@36 474 fi
slaxemulator@146 475 [ -d $MAIN_WWW_DIR/pics/rrd ] || mkdir -p $MAIN_WWW_DIR/pics/rrd
slaxemulator@146 476 chown -R www.www $MAIN_WWW_DIR
slaxemulator@146 477 up_src_links
slaxemulator@89 478 [ -x /etc/init.d/lighttpd ] && /etc/init.d/lighttpd start
slaxemulator@89 479 [ -x /etc/init.d/crond ] && /etc/init.d/crond start
slaxemulator@32 480 ;;
slaxemulator@46 481 update-repos)
slaxemulator@101 482 pwd=$(pwd)
slaxemulator@46 483 for i in $(ls $REPOS_DIR); do
slaxemulator@46 484 if [ -d $REPOS_DIR/$i/.hg ]; then
slaxemulator@46 485 cd $REPOS_DIR/$i
slaxemulator@46 486 echo "Updaing $i repo..."
slaxemulator@46 487 hg pull -u
slaxemulator@46 488 fi
slaxemulator@46 489 done
slaxemulator@101 490 cd $pwd
slaxemulator@46 491 ;;
slaxemulator@89 492 up-src-links)
slaxemulator@129 493 up_src_links
slaxemulator@89 494 ;;
slaxemulator@101 495 backup-mirror|-bm)
slaxemulator@101 496 case "$2" in
slaxemulator@101 497 pkgs-dry-push)
slaxemulator@101 498 rsync -avrtlz --delete --dry-run $PKGDIR ${sync_mirror} ;;
slaxemulator@101 499 src-dry-push)
slaxemulator@101 500 rsync -avrtlz --delete --dry-run $SRCDIR ${sync_mirror} ;;
slaxemulator@101 501 repos-dry-push)
slaxemulator@101 502 rsync -avrtlz --delete --dry-run $REPOS_DIR ${sync_mirror} ;;
slaxemulator@101 503 pkgs-push)
slaxemulator@101 504 rsync -avrtlz --delete $PKGDIR ${sync_mirror} ;;
slaxemulator@101 505 src-push)
slaxemulator@101 506 rsync -avrtlz --delete $SRCDIR ${sync_mirror} ;;
slaxemulator@101 507 repos-push)
slaxemulator@101 508 rsync -avrtlz --delete $REPOS_DIR ${sync_mirror} ;;
slaxemulator@101 509 pkgs-dry-pull)
slaxemulator@101 510 rsync -avrtlz --delete --dry-run ${sync_mirror}${PKGDIR} $(dirname ${PKGDIR}) ;;
slaxemulator@101 511 src-dry-pull)
slaxemulator@101 512 rsync -avrtlz --delete --dry-run ${sync_mirror}${SRCDIR} $(dirname ${SRCDIR}) ;;
slaxemulator@101 513 repos-dry-pull)
slaxemulator@101 514 rsync -avrtlz --delete --dry-run ${sync_mirror}${REPOS_DIR} $(dirname ${REPOS_DIR}) ;;
slaxemulator@101 515 pkgs-pull)
slaxemulator@101 516 rsync -avrtlz --delete ${sync_mirror}${PKGDIR} $(dirname ${PKGDIR}) ;;
slaxemulator@101 517 src-pull)
slaxemulator@101 518 rsync -avrtlz --delete ${sync_mirror}${SRCDIR} $(dirname ${SRCDIR}) ;;
slaxemulator@101 519 repos-pull)
slaxemulator@101 520 rsync -avrtlz --delete ${sync_mirror}${REPOS_DIR} $(dirname ${REPOS_DIR}) ;;
slaxemulator@101 521 *)
slaxemulator@101 522 echo "$0 backup-mirror pkgs-dry-{push|pull}"
slaxemulator@101 523 echo "$0 backup-mirorr pkgs-{push|pull}"
slaxemulator@101 524 echo "$0 backup-mirror src-dry-{push|pull}"
slaxemulator@101 525 echo "$0 backup-mirror src-{push|pull}"
slaxemulator@101 526 echo "$0 backup-mirror repos-dry-{push|pull}"
slaxemulator@101 527 echo "$0 backup-mirror repos-{push|pull}" ;;
slaxemulator@101 528 esac ;;
slaxemulator@129 529 off|stop)
slaxemulator@89 530 [ -x /etc/init.d/lighttpd ] && /etc/init.d/lighttpd stop
slaxemulator@89 531 [ -x /etc/init.d/crond ] && /etc/init.d/crond stop
slaxemulator@89 532 echo "127.0.0.1 localhost $(cat /etc/hostname) tazpanel" > /etc/hosts
slaxemulator@32 533 exit 1
slaxemulator@32 534 ;;
slaxemulator@32 535 *)
slaxemulator@32 536 usage
slaxemulator@32 537 ;;
slaxemulator@32 538 esac