echo 'Need domain name and mail and old server and init state (old, new?).'
false
fi
-if [ ! "$4" = "old" ] && [ ! "$4" = "new" ]; then
- echo "Need init state to be either 'old' or 'new'"
+if [ ! "$4" = "copy" ] && [ ! "$4" = "new" ]; then
+ echo "Need init state to be either 'copy' or 'new'"
false
fi
domain="$1"
echo 'Need domain name and mail and old server IP and key ID and init state (old, new?) as argument.'
false
fi
-if [ ! "$5" = "old" ] && [ ! "$5" = "new" ]; then
- echo "Need init state to be either 'old' or 'new'"
+if [ ! "$5" = "copy" ] && [ ! "$5" = "new" ] && [ ! "$5" = "upgrade" ]; then
+ echo "Need init state to be either 'copy' or 'new' or 'upgrade'"
false
fi
domain="$1"
else
cp "${config_tree_prefix}/setup_scripts/mirror_dir.sh" /home/plom/
chmod a+w /var
- su -lc "./mirror_dir.sh ${old_server} /var/repos" plom
+ 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
+ fi
chmod a-w /var
rm /home/plom/mirror_dir.sh
fi
rm -rf /var/www
mkdir /var/www
chown plom:plom /var/www
-if [ "${init_state}" = "new" ]; then
+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
- cp "${config_tree_prefix}/other_files/website_hook_post-receive" /var/repos/website.git/hooks/post-receive
+elif [ "${init_state}" = "new" ]; then
+ su -lc "cd /var/repos && git init --bare website" 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
# Add encryption key.