slitaz-forge rev 43

taztank: add up-www from tazdev and short option for commands
author Christophe Lincoln <pankso@slitaz.org>
date Wed Mar 30 23:07:16 2011 +0200 (2011-03-30)
parents 0e91bc735875
children f9644aebc4a8
files tank/taztank
line diff
     1.1 --- a/tank/taztank	Wed Mar 30 22:33:58 2011 +0200
     1.2 +++ b/tank/taztank	Wed Mar 30 23:07:16 2011 +0200
     1.3 @@ -1,5 +1,6 @@
     1.4  #!/bin/sh
     1.5  # Taztank - Admin Tank, backup, update and give stats.
     1.6 +#
     1.7  # (C) 2011 SliTaz - GNU General Public License.
     1.8  # Author: Christophe Lincoln <pankso@slitaz.org>
     1.9  #
    1.10 @@ -7,6 +8,7 @@
    1.11  REPOS="/home/slitaz/repos"
    1.12  WWW="/home/slitaz/www"
    1.13  VHOST="$WWW/tank"
    1.14 +WEBSITE="$WWW/website"
    1.15  BACKUPS="/home/backups"
    1.16  
    1.17  usage() {
    1.18 @@ -15,15 +17,15 @@
    1.19    stats         Display some Tank stats
    1.20    backup        Backup files and MySQL DB
    1.21    chroot        Move a user into a new chroot location
    1.22 -  up-web        Update http://tank.slitaz.org/
    1.23 +  up-www        Update website http://www.slitaz.org/
    1.24 +  up-tank       Update http://tank.slitaz.org/
    1.25    up-people     Update http://people.slitaz.org/
    1.26    up-boot       Update http://boot.slitaz.org/
    1.27 -  up-web-stats  Update Awstats statistics (run by cron)
    1.28 -  clean-labs    Clean Redmine Labs (no longer on Tank)\n"
    1.29 +  up-stats      Update Awstats statistics (run by cron)\n"
    1.30  }
    1.31  
    1.32  case "$1" in
    1.33 -	stats)
    1.34 +	stats|-s)
    1.35  		# Report some stats
    1.36  		clear
    1.37  		cat << EOF
    1.38 @@ -40,7 +42,7 @@
    1.39  
    1.40  EOF
    1.41  		;;
    1.42 -	chroot)
    1.43 +	chroot|-c)
    1.44  		if [ -s $2/bin/sh ] && grep -qs $3: /etc/password ; then
    1.45  			grep -q ^chroot /etc/busybox.conf ||
    1.46  			echo 'chroot = ssx root.root' >> /etc/busybox.conf
    1.47 @@ -84,31 +86,36 @@
    1.48  EOF
    1.49  		fi
    1.50  		;;
    1.51 -	backup)
    1.52 +	backup|-b)
    1.53  		# Backup config files and SQL db.
    1.54  		echo "Not yet implemented..." ;;
    1.55 -	up-web)
    1.56 +	update-www|-uw)
    1.57 +		# Update website from repo.
    1.58 +		echo ""
    1.59 +		cd $WEBSITE && hg pull && hg update
    1.60 +		echo "" ;;
    1.61 +	up-tank|-ut)
    1.62  		# Update Tank web interface: http://tank.slitaz.org/
    1.63  		echo -e "\nUpdating: tank.slitaz.org..."
    1.64  		cd $REPOS/slitaz-forge
    1.65  		hg update
    1.66  		rm -rf $VHOST/*.* $VHOST/pics/website $VHOST/images
    1.67  		cp -a tank/web/* $VHOST ;;
    1.68 -	up-people)
    1.69 +	up-people|-up)
    1.70  		# Update People web interface: http://people.slitaz.org/
    1.71  		echo -e "\nUpdating: people.slitaz.org..."
    1.72  		cd $REPOS/slitaz-forge
    1.73  		hg update
    1.74  		rm -rf $WWW/people/*
    1.75  		cp -a people/* $WWW/people ;;
    1.76 -	up-boot)
    1.77 +	up-boot|-ub)
    1.78  		# Update Web Boot interface: http://boot.slitaz.org/
    1.79  		echo -e "\nUpdating: boot.slitaz.org..."
    1.80  		cd $REPOS/slitaz-forge
    1.81  		hg update
    1.82  		rm -rf $WWW/boot/*
    1.83  		cp -a boot/* $WWW/boot ;;
    1.84 -	up-web-stats)
    1.85 +	up-stats|-us)
    1.86  		echo -e "\nUpdating all awstats databases...\n"
    1.87  		for vh in www boot pkgs
    1.88  		do