From: Christian Heller Date: Sat, 18 Apr 2020 17:42:07 +0000 (+0200) Subject: Differentiate init_state options for *site scripts. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/static/%7B%7Bdb.prefix%7D%7D/%7B%7Bprefix%7D%7D/%27%29;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20chunks.push%28escapeHTML%28span%5B2%5D%29%29;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20chunks.push%28%27?a=commitdiff_plain;h=dcebca7ba214a0a7961c84176606f6e4ae696e02;p=config Differentiate init_state options for *site scripts. --- diff --git a/buster/setup_scripts/setup_dumpsite.sh b/buster/setup_scripts/setup_dumpsite.sh index 4a72003..da4c441 100755 --- a/buster/setup_scripts/setup_dumpsite.sh +++ b/buster/setup_scripts/setup_dumpsite.sh @@ -6,8 +6,8 @@ if [ "$#" -ne 4 ]; then 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" diff --git a/buster/setup_scripts/setup_website.sh b/buster/setup_scripts/setup_website.sh index ac2d731..1702560 100755 --- a/buster/setup_scripts/setup_website.sh +++ b/buster/setup_scripts/setup_website.sh @@ -5,8 +5,8 @@ if [ "$#" -ne 5 ]; then 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" @@ -43,7 +43,11 @@ if [ "${init_state}" = "new" ]; then 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 @@ -57,11 +61,14 @@ ln -s /etc/nginx/sites-available/website.nginx /etc/nginx/sites-enabled/website. 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.