Created
April 29, 2018 18:29
-
-
Save jamestomasino/8241f9e3daf2a0fa49e5a9d35679a427 to your computer and use it in GitHub Desktop.
Update script to mirror my gopher repo on SDF, updating relative links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Config | |
GOPHER_DIR="/ftp/pub/users/tomasino/" | |
GOPHERMAP="${GOPHER_DIR}/gophermap" | |
# Overrides | |
pushd () { | |
command pushd "$@" > /dev/null | |
} | |
popd () { | |
command popd "$@" > /dev/null | |
} | |
pushd "${GOPHER_DIR}" | |
git fetch origin master -q | |
remotesha=$(git rev-parse origin/master) | |
localsha=$(git rev-parse HEAD) | |
if [ remotesha != localsha ]; then | |
git reset --hard HEAD -q | |
git pull -q origin master | |
find . -name "gophermap" -exec /usr/pkg/bin/gsed -i"" 's|\t\(/[A-Za-z0-9\/\-]*\)$|\t/users/tomasino\1|g' {} \; | |
touch . | |
fi | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment