tinycm rev 117

fix tinycm install functions
author Christophe Lincoln <pankso@slitaz.org>
date Sun Mar 19 23:34:25 2017 +0100 (2017-03-19)
parents 26809676b304
children 49d179cd32d2
files tinycm
line diff
     1.1 --- a/tinycm	Tue Feb 28 22:58:11 2017 +0100
     1.2 +++ b/tinycm	Sun Mar 19 23:34:25 2017 +0100
     1.3 @@ -30,8 +30,10 @@
     1.4  $(boldify "Usage:") $(basename $0) [command] [path|list]
     1.5  
     1.6  $(boldify "Commands:")
     1.7 -  inst       Install TinyCM and set permissions
     1.8 -  up         Update one or a list of TinyCM installations
     1.9 +  -i  inst       Install TinyCM and set permissions
    1.10 +  -u  up         Update one or a list of TinyCM installations
    1.11 +  -g  get        Download latest source tarball from repository
    1.12 +  -p  plugins    List installed/avalaible plugins
    1.13  
    1.14  EOT
    1.15  }
    1.16 @@ -100,7 +102,7 @@
    1.17  # Max length for messages on the Wall
    1.18  WALL_MESSAGES_LENGTH="$WALL_MESSAGES_LENGTH"
    1.19  
    1.20 -# Twitter user name and/or Facebook page URL name 
    1.21 +# Twitter user name and/or Facebook page URL name
    1.22  TWITTER_USER="$TWITTER_USER"
    1.23  FACEBOOK_PAGE="$FACEBOOK_PAGE"
    1.24  EOT
    1.25 @@ -112,25 +114,39 @@
    1.26  #
    1.27  
    1.28  case "$1" in
    1.29 -	inst)
    1.30 +
    1.31 +	-i|inst*)
    1.32  		check_source
    1.33  		check_path
    1.34 +
    1.35  		echo ""
    1.36 -		boldify "Installing TinyCM..."
    1.37 -		echo "Path:"; echo "$path"
    1.38 -		mkdir -p $path
    1.39 -		for file in index.cgi style.css images lib plugins
    1.40 +		boldify "TinyCM installation"
    1.41 +		echo "Path: $path"
    1.42 +		mkdir -p ${path}
    1.43 +		for file in index.cgi config.cgi style.css images lib plugins
    1.44  		do
    1.45 -			echo "* Installing: $file"
    1.46 -			cp -a $file $path
    1.47 +			echo "  * Installing: $file"
    1.48 +			cp -a ${file} ${path}
    1.49  		done
    1.50 -		if [ $(id) == 0 ]; then
    1.51 -			echo root
    1.52 +		
    1.53 +		# Content with wiki/*/help.txt
    1.54 +		for lang in en
    1.55 +		do
    1.56 +			mkdir -p ${path}/content/wiki/${lang}
    1.57 +			cp content/wiki/${lang}/help.txt ${path}/content/wiki/${lang}
    1.58 +		done
    1.59 +
    1.60 +		# Set permissions
    1.61 +		if [ $(id -u) == 0 ]; then
    1.62 +			chown -R www.www ${path}/content
    1.63 +			install -d -o www -g www ${path}/cache
    1.64  		else
    1.65 -			echo user
    1.66 +			chmod 0777 ${path}/content ${path}/content/*
    1.67 +			install -d -m 0777 ${path}/cache
    1.68  		fi
    1.69  		echo "" ;;
    1.70 -	up)
    1.71 +
    1.72 +	-u|up*)
    1.73  		check_source
    1.74  		if [ ! "$path" ] && [ ! -f "$list" ]; then
    1.75  			error "Missing path argument or paths list: $list"
    1.76 @@ -139,14 +155,14 @@
    1.77  		echo ""
    1.78  		boldify "Updating TinyCM install(s)..."
    1.79  		echo ""
    1.80 -		
    1.81 +
    1.82  		# File list of args
    1.83  		if [ -f "$path" ]; then
    1.84  			paths="$(cat ${list})"
    1.85  		else
    1.86  			paths="$path"
    1.87  		fi
    1.88 -		
    1.89 +
    1.90  		for path in ${paths}
    1.91  		do
    1.92  			check_tiny
    1.93 @@ -165,8 +181,20 @@
    1.94  			done
    1.95  			update_config
    1.96  		done && echo "" ;;
    1.97 -	*)
    1.98 -		usage ;;
    1.99 +
   1.100 +	-p|plug*)
   1.101 +		echo ""
   1.102 +		boldify "TinyCM plugins:"
   1.103 +		ls -1 plugins
   1.104 +		echo "" ;;
   1.105 +
   1.106 +	-g|get)
   1.107 +		tarball="tinycm-tip.tar.bz2"
   1.108 +		if [ ! -f "$tarball" ]; then
   1.109 +			wget ${dlurl} -O ${tarball}
   1.110 +		fi ;;
   1.111 +
   1.112 +	*) usage ;;
   1.113  esac
   1.114  
   1.115  exit 0