X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;ds=inline;f=buster%2Fsetup_scripts%2Fsetup_website.sh;h=d1dc91d7b756907ebedf1aecbade35eed0812839;hb=6dc9cfee290e3ec99ea4d52fb4c3bbe0ff6b8697;hp=f781905cc6ce4ea10770c7bde7cf55a66d26ea91;hpb=6b847de2430565e7cd7b654b5cffb6aa1b64a44b;p=config
diff --git a/buster/setup_scripts/setup_website.sh b/buster/setup_scripts/setup_website.sh
index f781905..d1dc91d 100755
--- a/buster/setup_scripts/setup_website.sh
+++ b/buster/setup_scripts/setup_website.sh
@@ -9,7 +9,7 @@ if [ ! "$4" = "copy" ] && [ ! "$4" = "new" ] && [ ! "$4" = "upgrade" ]; then
echo "Need init state to be either 'copy' or 'new' or 'upgrade'"
false
fi
-if [ ! "$4" = "new" ] and [ "$#" -ne 5 ]; then
+if [ ! "$4" = "new" ] && [ "$#" -ne 5 ]; then
echo "With init state != 'new' need fifth argument old server IP."
false
fi
@@ -19,6 +19,8 @@ gpg_key="$3"
init_state="$4"
old_server="$5"
+# NOTE: init_state=upgrade is for migration from older stretch server setup
+
# Install configs, set up firewall.
config_tree_prefix="${HOME}/config/buster"
./install_for_target.sh web website
@@ -49,7 +51,7 @@ if [ "${init_state}" = "new" ]; then
else
cp "${config_tree_prefix}/setup_scripts/mirror_dir.sh" /home/plom/
chmod a+w /var
- if ["${init_state}" = "copy" ]; then
+ if [ "${init_state}" = "copy" ]; then
su -lc "./mirror_dir.sh ${old_server} /var/repos" plom
else
su -lc "./mirror_dir.sh ${old_server} /var/public_repos" plom
@@ -69,11 +71,10 @@ mkdir /var/www
chown plom:plom /var/www
if [ "${init_state}" = "upgrade" ]; then
# This assumes the old core.plomlompom.com filesystem hierarchy.
- su -lc "cd /var/repos && git clone --mirror ${old_server}:repos/website" plom
+ su -lc "cd /var/repos && git clone --mirror plom@core.plomlompom.com:repos/website" plom
elif [ "${init_state}" = "new" ]; then
- su -lc "cd /var/repos && git init --bare website" plom
+ su -lc "cd /var/repos && git init --bare website.git" plom
fi
-# TODO: find out whether this can be part of cloned repo �
cp "${config_tree_prefix}/other_files/website_hook_post-receive" /var/repos/website.git/hooks/post-receive
su -lc 'cd /var/www && git clone /var/repos/website.git .' plom
@@ -123,12 +124,14 @@ else
su -lc "scp plom@${old_server}:.plomlombot ~" plom
su -lc "ssh plom@${old_server} \"su -lc 'service plomlombot stop'\"" plom
fi
-
systemctl enable plomlombot.service
service plomlombot start
+# In the above step, we might have created a root-owned /var/www/html â
+# fix this here.
+chown -R plom:plom /var/www/html
+
# TODO:
-# - commit git-daemon-export-ok directly into the public repos; rename
-# /home/plom/public_repos to /home/plom/repos
+# - rename /home/plom/public_repos to /home/plom/repos
service nginx restart