Skip to content

Instantly share code, notes, and snippets.

@jamestomasino
Created April 29, 2018 18:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamestomasino/8241f9e3daf2a0fa49e5a9d35679a427 to your computer and use it in GitHub Desktop.
Save jamestomasino/8241f9e3daf2a0fa49e5a9d35679a427 to your computer and use it in GitHub Desktop.
Update script to mirror my gopher repo on SDF, updating relative links
#!/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