1 |
dams |
1107 |
#!/bin/sh |
2 |
|
|
|
3 |
|
|
# Initialization |
4 |
|
|
PATH_TO_FILE=${PATH_TO_FILE:-/var/lib/planet} |
5 |
dams |
1110 |
PATH_TO_PLANET=${PATH_TO_PLANET:-/var/www/html/planet.<%= domain %>} |
6 |
dams |
1107 |
|
7 |
dams |
1114 |
#Ask for new locale name |
8 |
dams |
1107 |
echo -n "Locale name: " |
9 |
|
|
read locale |
10 |
|
|
|
11 |
|
|
# Display the answer and ask for confirmation |
12 |
|
|
echo -e -n "Do you confirm the entry: \"$locale\"? (y/n) " |
13 |
|
|
read answer |
14 |
|
|
if [ "$answer" == "y" ] |
15 |
|
|
then |
16 |
dams |
1109 |
FILE="$PATH_TO_PLANET/$locale/" |
17 |
dams |
1107 |
if test -d $FILE |
18 |
|
|
then |
19 |
|
|
echo "Aborted, $FILE already exist." |
20 |
|
|
exit 2 |
21 |
|
|
else |
22 |
dams |
1114 |
# Deploy new planet with locale given |
23 |
dams |
1107 |
/bin/mkdir $FILE |
24 |
dams |
1114 |
/bin/chown planet:apache $FILE |
25 |
|
|
/usr/bin/wget -O $PATH_TO_FILE"/moonmoon.tar.gz" http://damsweb.net/files/moonmoon_mageia.tar.gz |
26 |
|
|
if [ $? -ne 0 ] |
27 |
|
|
then |
28 |
|
|
echo "Aborted, can't download GZIP file" |
29 |
|
|
exit 2 |
30 |
|
|
fi |
31 |
|
|
/bin/tar zxvf $PATH_TO_FILE/moonmoon.tar.gz -C $FILE |
32 |
dams |
1117 |
/bin/chmod g+w $FILE"custom" $FILE"custom/people.opml" $FILE"admin/inc/pwd.inc.php" |
33 |
|
|
/bin/mkdir $FILE"cache" |
34 |
|
|
/bin/chown g+w $FILE"cache" |
35 |
dams |
1107 |
fi |
36 |
|
|
else |
37 |
|
|
echo "Aborted, please try again." |
38 |
|
|
exit 2 |
39 |
|
|
fi |