-
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathrun
More file actions
executable file
·85 lines (74 loc) · 2.42 KB
/
run
File metadata and controls
executable file
·85 lines (74 loc) · 2.42 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
# make our folders
mkdir -p \
/config/www \
/gallery/upload \
/gallery/galleries
# Migrate old data
if [[ -f /gallery/index.php ]]; then
echo "*******************************************************************************"
echo ""
echo "Migrating old install..."
mv /gallery/_data/ /config/www/_data
mv /gallery/language/ /config/www/language
mv /gallery/plugins/ /config/www/plugins
mv /gallery/themes/ /config/www/themes
mv /gallery/local/ /config/www/local
mv /gallery/template-extension/ /config/www/template-extension
rm /gallery/index.php
rm /config/www/gallery
sed -i "s|root /config/www/gallery;|root /app/www/public;|" /config/nginx/site-confs/default.conf
echo "Migration completed."
echo ""
echo "You can now safely delete everything in /gallery *except* for the upload and"
echo "galleries directories. If your photos are stored elsewhere you can ignore this."
echo ""
echo "*******************************************************************************"
fi
shopt -s globstar dotglob
symlinks=(
/app/www/public/upload
/app/www/public/galleries
)
for i in "${symlinks[@]}"; do
if [[ -d /gallery/"$(basename "$i")" && ! -L "$i" ]]; then
rm -rf "$i"
fi
if [[ -d /gallery/"$(basename "$i")" && ! -L "$i" ]]; then
ln -s /gallery/"$(basename "$i")" "$i"
fi
done
# Update standard pages & default theme
if [[ -d /config/www/themes ]]; then
cp -R /app/www/public/themes/standard_pages/ /config/www/themes/
cp -R /app/www/public/themes/default/ /config/www/themes/
fi
symlinks=(
/app/www/public/language
/app/www/public/plugins
/app/www/public/local
/app/www/public/themes
/app/www/public/_data
/app/www/public/template-extension
)
for i in "${symlinks[@]}"; do
if [[ -d /config/www/"$(basename "$i")" && ! -L "$i" ]]; then
rm -rf "$i"
fi
if [[ ! -d /config/www/"$(basename "$i")" && ! -L "$i" ]]; then
mv "$i" /config/www/
fi
if [[ -d /config/www/"$(basename "$i")" && ! -L "$i" ]]; then
ln -s /config/www/"$(basename "$i")" "$i"
fi
done
shopt -u globstar dotglob
# copy config
if [[ ! -f "/config/www/local/config/config.inc.php" ]]; then
cp /app/www/public/include/config_default.inc.php /config/www/local/config/config.inc.php
fi
# permissions
lsiown -R abc:abc \
/config \
/gallery