]> git.decadent.org.uk Git - dak.git/blobdiff - scripts/debian/link_morgue.sh
And check for existance, not type too
[dak.git] / scripts / debian / link_morgue.sh
index 4fb040ea81ce8123b337bc22a5658dbf1951f4b7..0dc693be845fd6755af0602adc784e8509b8c93f 100755 (executable)
@@ -51,7 +51,22 @@ function log () {
         echo "$(date +"%b %d %H:%M:%S") $(hostname -s) ${prefix}[$$]: $@"
 }
 
-export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
+case "$(hostname)" in
+    franck)
+       SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
+       archive=ftp-master
+        ;;
+    seger)
+       SCRIPTVARS=/srv/security-master.debian.org/dak/config/debian-security/vars
+       archive=security-master
+       ;;
+    *)
+       echo "Unknown host $(hostname)" >&2
+       exit 1
+       ;;
+esac
+
+export SCRIPTVARS
 . $SCRIPTVARS
 
 function byebye_lock() {
@@ -70,6 +85,11 @@ cd "${PROCESSDIR}"
 log "Processing ${PROCESSDIR}"
 find ${PROCESSDIR} -type f |
 while read mfile; do
+    if [[ -e ${mfile}.nosnapshot ]]; then
+        # We know this file does not exist on snapshot, don't check again
+        continue
+    fi
+
     # Get the files sha1sum
     mshasum=$(sha1sum ${mfile})
     mshasum=${mshasum%% *}
@@ -96,6 +116,8 @@ while read mfile; do
             # Yay for tons of dangling symlinks, but when this is done a rsync
             # will run and transfer the whole shitload of links over to the morgue host.
             ln -sf "${FARMBASE}/${LVL1}/${LVL2}/${mshasum}" "${mfile}"
+        else
+            touch "${mfile}.nosnapshot" || true
         fi
     fi
 done # for mfile in...
@@ -113,7 +135,7 @@ if [ "$(hostname -s)" != "stabile" ]; then
     # on the other side should contain (one line, no #)
 # command="rsync --server -lHogDtpRe.Lsf --remove-source-files . /srv/morgue.debian.org/sync/ftp-master",
 # no-port-forwarding,no-X11-forwarding,no-agent-forwarding,from="ftp-master.debian.org" ssh-rsa...
-    rsync -aHq -e "ssh -o Batchmode=yes -o ConnectTimeout=30 -o SetupTimeout=30 " --remove-source-files --from0 --files-from=${LISTFILE} $base/morgue/ morgue-sync:/srv/morgue.debian.org/sync/ftp-master
+    rsync -aHq -e "ssh -o Batchmode=yes -o ConnectTimeout=30 -o SetupTimeout=30 " --remove-source-files --from0 --files-from=${LISTFILE} $base/morgue/ morgue-sync:/srv/morgue.debian.org/sync/$archive
 
     # And remove empty subdirs. To remove entire hierarchies we probably should run this
     # in a loop, but why bother? They'll be gone in a few days then, so meh.