aboutsummaryrefslogtreecommitdiffstats
path: root/modules/planet/templates/deploy_new-planet.sh
blob: cc60f46a9ecb14ad065857584af44ed525147f83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh

# Initialization
PATH_TO_FILE=${PATH_TO_FILE:-/var/lib/planet}
PATH_TO_PLANET=${PATH_TO_PLANET:-/var/www/html/planet.<%= domain %>}

#Ask for new locale name
echo -n "Locale name: "
read locale

# Display the answer and ask for confirmation
echo -e -n "Do you confirm the entry: \"$locale\"? (y/n) "
read answer
if [ "$answer" == "y" ] 
then
	FILE="$PATH_TO_PLANET/$locale/"
	if test -d $FILE
	then
		echo "Aborted, $FILE already exist."
		exit 2
	else
		# Deploy new planet with locale given
		/bin/mkdir $FILE
		/bin/chown planet:apache $FILE
		/usr/bin/wget -O $PATH_TO_FILE"/moonmoon.tar.gz" http://damsweb.net/files/moonmoon_mageia.tar.gz
		if [ $? -ne 0 ]
		then
			echo "Aborted, can't download GZIP file"
			exit 2
		fi
		/bin/tar zxvf $PATH_TO_FILE/moonmoon.tar.gz -C $FILE
		/bin/chmod g+w $FILEcustom $FILEcustom/people.opml $FILEadmin/inc/pwd.inc.php
		/bin/mkdir $FILEcache
		/bin/chown g+w $FILEcache
	fi
else
	echo "Aborted, please try again."
	exit 2
fi