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