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

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