sync-portage: Added script to sync Portage squashfs images
parent
fd0958e6eb
commit
2c5d930d0b
|
@ -0,0 +1,55 @@
|
|||
#!/bin/sh
|
||||
|
||||
REMOTE=${SYNC_REMOTE:-caithe.pyrocufflink.jazz::portage-squashfs/gentoo.sqxz}
|
||||
NO_EMAINT_SYNC=0
|
||||
NO_LAYMAN_SYNC=0
|
||||
NO_EIX=0
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--no-eix)
|
||||
NO_EIX=1
|
||||
shift
|
||||
;;
|
||||
--quiet|-q)
|
||||
QUIET=1
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
if [ -z "${REMOTE}" ]; then
|
||||
REMOTE="${arg}"
|
||||
elif [ -z "${LOCAL}" ]; then
|
||||
LOCAL="${arg}"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
: ${PORTDIR:=$(portageq get_repo_path ${ROOT:-/} ${REPO_NAME:-gentoo})}
|
||||
|
||||
[ x${QUIET} = x ] && RSYNC_ARGS=-v
|
||||
rsync -a ${RSYNC_ARGS} "${REMOTE}" "${LOCAL:-${PORTDIR%/*}}" || exit $?
|
||||
|
||||
if ! umount "${PORTDIR}"; then
|
||||
printf 'Failed to unmount %s\n' "${PORTDIR}"
|
||||
exit 1
|
||||
fi
|
||||
if ! mount "${PORTDIR}"; then
|
||||
printf 'Failed to mount %s\n' "${PORTDIR}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ${NO_EMAINT_SYNC} -ne 1 ]; then
|
||||
if portageq repos_config / | grep -q sync-uri; then
|
||||
PORTAGE_QUIET=${QUIET:+0} emaint sync --auto
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ${NO_LAYMAN_SYNC} -ne 1 ] && [ -x "$(command -v layman)" ]; then
|
||||
layman --sync-all ${QUIET:+--quiet}
|
||||
fi
|
||||
|
||||
if [ ${NO_EIX} -ne 1 ] && [ -x "$(command -v eix)" ]; then
|
||||
eix-update ${QUIET:+--quiet}
|
||||
fi
|
Loading…
Reference in New Issue