diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-04-26 14:59:44 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-04-26 14:59:44 -0700 |
commit | fa651f44178fa2d7a6e10f6ce2be7b36217022ca (patch) | |
tree | f4625d87d2fc9fe4da4c52a8a8e5aa1a7e7ba7ea | |
parent | 4628db03bdb74f37c0804e5cad72a8fd590c0d24 (diff) | |
download | portage-fa651f44178fa2d7a6e10f6ce2be7b36217022ca.tar.gz portage-fa651f44178fa2d7a6e10f6ce2be7b36217022ca.tar.bz2 portage-fa651f44178fa2d7a6e10f6ce2be7b36217022ca.zip |
Add a SYNC sanity check to help prevent people like funtoo users
from accidentally wiping out their git tree. It will bail out
if SYNC does not refer to an rsync URI.
-rwxr-xr-x | bin/emerge-webrsync | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index 9b2fcbb95..6964168b6 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -34,7 +34,7 @@ fi eval $(portageq envvar -v FEATURES FETCHCOMMAND GENTOO_MIRRORS \ PORTAGE_BIN_PATH PORTAGE_GPG_DIR \ PORTAGE_NICENESS PORTAGE_RSYNC_EXTRA_OPTS PORTAGE_TMPDIR PORTDIR \ - http_proxy ftp_proxy) + SYNC http_proxy ftp_proxy) DISTDIR="${PORTAGE_TMPDIR}/emerge-webrsync" export http_proxy ftp_proxy @@ -434,6 +434,20 @@ main() { *) usage "Invalid option '${arg}'" ;; esac done + + # This is a sanity check to help prevent people like funtoo users + # from accidentally wiping out their git tree. + if [[ -n $SYNC && ${SYNC#rsync:} = $SYNC ]] ; then + echo "The current SYNC variable setting does not refer to an rsync URI:" >&2 + echo >&2 + echo " SYNC=$SYNC" >&2 + echo >&2 + echo "If you intend to use emerge-webrsync then please" >&2 + echo "adjust SYNC to refer to an rsync URI." >&2 + echo "emerge-webrsync exiting due to abnormal SYNC setting." >&2 + exit 1 + fi + [[ ${do_debug} -eq 1 ]] && set -x if [[ -n ${revert_date} ]] ; then |