slitaz-dev-tools diff tazdev/tazdev @ rev 273
tazdev: add setup-cgi (only a proposal, adaptable via config file)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Mon Feb 27 22:08:17 2017 +0100 (2017-02-27) |
parents | 6f82a9600893 |
children | 66c023d0f82f |
line diff
1.1 --- a/tazdev/tazdev Mon Dec 12 21:42:12 2016 +0000 1.2 +++ b/tazdev/tazdev Mon Feb 27 22:08:17 2017 +0100 1.3 @@ -5,7 +5,7 @@ 1.4 # well commented please, also: configuration variables are $UPPERCASE 1.5 # and variables initialized by tazdev itself are $lowerspace 1.6 # 1.7 -# (c) 2014 SliTaz GNU/Linux - GNU gpl v3 1.8 +# (c) 2014-2017 SliTaz GNU/Linux - GNU gpl v3 1.9 # 1.10 # AUTHORS 1.11 # Christophe Lincoln <pankso@slitaz.org> 1.12 @@ -13,11 +13,12 @@ 1.13 # Eric Joseph-Alexandre <erjo@slitaz.org> 1.14 # 1.15 1.16 -VERSION=2.0 1.17 +VERSION=2.1 1.18 1.19 . /lib/libtaz.sh 1.20 1.21 [ -f /etc/slitaz/tazdev.conf ] && . /etc/slitaz/tazdev.conf 1.22 +[ -f ~/.config/slitaz/tazdev.conf ] && . ~/.config/slitaz/tazdev.conf 1.23 [ -f tazdev.conf ] && . ./tazdev.conf 1.24 1.25 if [ ! "$SLITAZ_HOME" ]; then 1.26 @@ -32,19 +33,20 @@ 1.27 SliTaz developers and build host tool v$VERSION 1.28 1.29 $(boldify "Commands:") 1.30 - usage Print this short usage and command list 1.31 - help Give help on a SliTaz tool or library. 1.32 - stats|-s Display statistics about your projects 1.33 - chroot|-c Mount virtual fs and chroot into the build env 1.34 - gen-chroot|-gc Generate a chroot using packages from config file 1.35 - umount-chroot|-uc Unmount chroot specified on cmdline 1.36 - clean-chroot|-cc Clean a chroot environment (skip root/ and home/) 1.37 - push|-p Upload new packages to the main mirror 1.38 - dry-push|-dp Show what will be uploaded to the mirror. Does nothing 1.39 - pull Download new packages from the main mirror 1.40 - dry-pull Show what will be downloaded from the mirror. Does nothing 1.41 - up-repos|-upr Update all your SliTaz projects repos in one command. 1.42 - relpkg|-rp Archive and upload new package/project version 1.43 + usage Print this short usage and command list 1.44 + help Give help on a SliTaz tool or library. 1.45 + -s stats Display statistics about your projects 1.46 + -c chroot Mount virtual fs and chroot into the build env 1.47 + -gc gen-chroot Generate a chroot using packages from config file 1.48 + -uc unchroot Unmount chroot specified on cmdline 1.49 + -cc clean-chroot Clean a chroot environment (skip root/ and home/) 1.50 + -p push Upload new packages to the main mirror 1.51 + -dp dry-push Show what will be uploaded to the mirror. 1.52 + pull Download new packages from the main mirror 1.53 + dry-pull Show what will be downloaded from the mirror. 1.54 + -ur up-repos Update all your SliTaz projects repos in one command. 1.55 + -rp relpkg Archive and upload new package/project version 1.56 + -sc setup-cgi Setup your CGI environment 1.57 1.58 $(boldify "Options:") 1.59 --rootfs= Path to the chroot to generate or clean 1.60 @@ -53,7 +55,6 @@ 1.61 1.62 $(boldify "Options:") 1.63 $(basename $0) gen-chroot undigest --clean 1.64 - $(basename $0) chroot stable 1.65 $(basename $0) -c --arch=arm 1.66 1.67 EOT 1.68 @@ -207,26 +208,22 @@ 1.69 1.70 case "$1" in 1.71 stats|-s) 1.72 - echo -e "\nStatistics for: $PROJECTS\n" 1.73 - echo -n "Project" && echo -ne "\033[24G Size" && echo -ne "\033[38G Revision" 1.74 - echo -ne "\033[48G Version" && echo -e "\033[64G Files" 1.75 + newline 1.76 + echo "Statistics for: $PROJECTS" 1.77 + newline 1.78 + echo "Project $(indent 24 Revision) $(indent 38 Version) $(indent 54 Files)" 1.79 separator 1.80 - cd $PROJECTS 1.81 + cd ${PROJECTS} 1.82 for proj in * 1.83 do 1.84 rev="" 1.85 - echo -n "$proj" 1.86 - size=`du -sh $proj | awk '{ print $1 }'` 1.87 - echo -ne "\033[24G $size" 1.88 - if [ -d $proj/.hg ]; then 1.89 - cd $proj 1.90 - rev=`hg head --template '{rev}\n'` 1.91 - vers=`hg tags | head -n 2 | tail -n 1 | cut -d " " -f 1` 1.92 - echo -ne "\033[38G $rev" 1.93 - echo -ne "\033[48G $vers" && cd .. 1.94 + if [ -d "${PROJECTS}/${proj}/.hg" ]; then 1.95 + cd ${PROJECTS}/${proj} 1.96 + rev=$(hg head --template '{rev}\n') 1.97 + vers=$(hg tags | head -n 2 | tail -n 1 | cut -d " " -f 1) 1.98 + files=$(find . -type f | wc -l) 1.99 + echo "$proj $(indent 24 $rev) $(indent 38 $vers) $(indent 54 $files)" 1.100 fi 1.101 - files=`find $proj -type f | wc -l` 1.102 - echo -e "\033[64G $files" 1.103 done 1.104 separator 1.105 echo "" ;; 1.106 @@ -239,7 +236,7 @@ 1.107 echo -e "Chrooting to: $rootfs\n" 1.108 chroot $rootfs /bin/sh --login 1.109 umount_chroot ;; 1.110 - umount-chroot|-uc) 1.111 + umchroot|-uc) 1.112 check_root 1.113 get_version $@ 1.114 [ -d "$2" ] && rootfs=$2 1.115 @@ -304,7 +301,7 @@ 1.116 check_mirror $@ 1.117 rsync -r -t -l -v -z --delete --dry-run \ 1.118 -e ssh $user@$MIRROR:$remote $local ;; 1.119 - up-repos|-upr) 1.120 + up-repos|-ur) 1.121 # Update all at once. 1.122 newline 1.123 boldify "Update all SliTaz Hg repos" 1.124 @@ -367,9 +364,31 @@ 1.125 sed -i s"/VERSION=.*/VERSION=\"$version\"/" $pkg*/receipt 1.126 status 1.127 fi ;; 1.128 + 1.129 + setup-cgi|-sc) 1.130 + . /etc/slitaz/slitaz.conf 1.131 + echo "$(boldify 'Public :') $PUBLIC" 1.132 + mkdir -p ${PUBLIC}/cgi-bin 1.133 + cd ${PUBLIC}/cgi-bin 1.134 + for proj in tazbug tinycm mediabox; do 1.135 + if [ ! -d "$proj" ]; then 1.136 + hg clone ttp://hg.slitaz.org/${proj} 1.137 + fi 1.138 + done 1.139 + if [ ! -d "$INSTALLED/lighttpd" ]; then 1.140 + sudo tazpkg -gi lighttpd 1.141 + fi 1.142 + echo 1.143 + echo "TODO: setup SCN (tinycm install + plugins from slitaz-forge" 1.144 + echo 1.145 + echo "$(boldify 'URL :') http://localhost/~${USER}/cgi-bin/" ;; 1.146 + 1.147 help) 1.148 - [ ! "$2" ] && echo "Missing tool/library name" && exit 0 1.149 - echo "" 1.150 + if [ ! "$2" ]; then 1.151 + echo "Missing tool/library name" 1.152 + echo "Example: tazdev help httphelper"; exit 0 1.153 + fi 1.154 + newline 1.155 boldify "Help for: $2" 1.156 separator 1.157 if [ -f "/usr/share/doc/slitaz/$2.txt" ]; then 1.158 @@ -377,9 +396,10 @@ 1.159 else 1.160 echo "No help found" 1.161 fi 1.162 - separator && echo "" ;; 1.163 - usage|*) 1.164 - usage ;; 1.165 + separator && newline ;; 1.166 + 1.167 + usage|*) usage ;; 1.168 + 1.169 esac 1.170 1.171 exit 0