etc/conf: implement XBPS_MIRROR for remote repos
Setting this variable will make xbps-src use an alternative mirror for remote repositories. Using this variable one can change the remote repository for all architectures in a single setting and without the need to modify `etc/xbps.d/repos-remote*.conf`. This is much more convenient as it allows changing remote repos without a dirty worktree. To use just add a line like the following to `etc/conf`: XBPS_MIRROR=https://repo-us.voidlinux.org/current We also disable 00-repository-main.conf for cross so we don't use the remote repo from the xbps package.
This commit is contained in:
parent
65cff7c577
commit
7231f47b26
2 changed files with 26 additions and 12 deletions
|
@ -237,26 +237,33 @@ chroot_sync_repodata() {
|
||||||
$confdir/12-repository-local-multilib.conf
|
$confdir/12-repository-local-multilib.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# mirror_sed is a sed script: nop by default
|
||||||
|
local mirror_sed
|
||||||
|
if [ -n "$XBPS_MIRROR" ]; then
|
||||||
|
# when XBPS_MIRROR is set, mirror_sed rewrites remote repos
|
||||||
|
mirror_sed="s|^repository=http.*/current|repository=${XBPS_MIRROR}|"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$XBPS_SKIP_REMOTEREPOS" ]; then
|
if [ "$XBPS_SKIP_REMOTEREPOS" ]; then
|
||||||
rm -f $confdir/*remote*
|
rm -f $confdir/*remote*
|
||||||
else
|
else
|
||||||
if [ -s "${XBPS_DISTDIR}/etc/xbps.d/repos-remote-${XBPS_MACHINE}.conf" ]; then
|
if [ -s "${XBPS_DISTDIR}/etc/xbps.d/repos-remote-${XBPS_MACHINE}.conf" ]; then
|
||||||
# If per-architecture base remote repo config exists, use that
|
# If per-architecture base remote repo config exists, use that
|
||||||
install -Dm644 ${XBPS_DISTDIR}/etc/xbps.d/repos-remote-${XBPS_MACHINE}.conf \
|
sed -e "$mirror_sed" ${XBPS_DISTDIR}/etc/xbps.d/repos-remote-${XBPS_MACHINE}.conf \
|
||||||
$confdir/20-repository-remote.conf
|
> $confdir/20-repository-remote.conf
|
||||||
else
|
else
|
||||||
# Otherwise use generic base for musl or glibc
|
# Otherwise use generic base for musl or glibc
|
||||||
local suffix=
|
local suffix=
|
||||||
case "$XBPS_MACHINE" in
|
case "$XBPS_MACHINE" in
|
||||||
*-musl) suffix="-musl";;
|
*-musl) suffix="-musl";;
|
||||||
esac
|
esac
|
||||||
install -Dm644 ${XBPS_DISTDIR}/etc/xbps.d/repos-remote${suffix}.conf \
|
sed -e "$mirror_sed" ${XBPS_DISTDIR}/etc/xbps.d/repos-remote${suffix}.conf \
|
||||||
$confdir/20-repository-remote.conf
|
> $confdir/20-repository-remote.conf
|
||||||
fi
|
fi
|
||||||
# Install multilib conf for remote repos if it exists for the architecture
|
# Install multilib conf for remote repos if it exists for the architecture
|
||||||
if [ -s "${XBPS_DISTDIR}/etc/xbps.d/repos-remote-${XBPS_MACHINE}-multilib.conf" ]; then
|
if [ -s "${XBPS_DISTDIR}/etc/xbps.d/repos-remote-${XBPS_MACHINE}-multilib.conf" ]; then
|
||||||
install -Dm644 ${XBPS_DISTDIR}/etc/xbps.d/repos-remote-${XBPS_MACHINE}-multilib.conf \
|
sed -e "$mirror_sed" ${XBPS_DISTDIR}/etc/xbps.d/repos-remote-${XBPS_MACHINE}-multilib.conf \
|
||||||
$confdir/22-repository-remote-multilib.conf
|
> $confdir/22-repository-remote-multilib.conf
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -266,6 +273,8 @@ chroot_sync_repodata() {
|
||||||
if [ -n "$XBPS_CROSS_BUILD" ]; then
|
if [ -n "$XBPS_CROSS_BUILD" ]; then
|
||||||
rm -rf $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
|
rm -rf $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
|
||||||
mkdir -p $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
|
mkdir -p $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
|
||||||
|
# Disable 00-repository-main.conf from share/xbps.d (part of xbps)
|
||||||
|
ln -s /dev/null $XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d/00-repository-main.conf
|
||||||
# copy xbps.d files from host for local repos
|
# copy xbps.d files from host for local repos
|
||||||
cp ${XBPS_MASTERDIR}/etc/xbps.d/*local*.conf \
|
cp ${XBPS_MASTERDIR}/etc/xbps.d/*local*.conf \
|
||||||
$XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
|
$XBPS_MASTERDIR/$XBPS_CROSS_BASE/etc/xbps.d
|
||||||
|
@ -274,15 +283,15 @@ chroot_sync_repodata() {
|
||||||
else
|
else
|
||||||
# Same general logic as above, just into cross root, and no multilib
|
# Same general logic as above, just into cross root, and no multilib
|
||||||
if [ -s "${XBPS_DISTDIR}/etc/xbps.d/repos-remote-${XBPS_TARGET_MACHINE}.conf" ]; then
|
if [ -s "${XBPS_DISTDIR}/etc/xbps.d/repos-remote-${XBPS_TARGET_MACHINE}.conf" ]; then
|
||||||
install -Dm644 ${XBPS_DISTDIR}/etc/xbps.d/repos-remote-${XBPS_TARGET_MACHINE}.conf \
|
sed -e "$mirror_sed" ${XBPS_DISTDIR}/etc/xbps.d/repos-remote-${XBPS_TARGET_MACHINE}.conf \
|
||||||
$crossconfdir/20-repository-remote.conf
|
> $crossconfdir/20-repository-remote.conf
|
||||||
else
|
else
|
||||||
local suffix=
|
local suffix=
|
||||||
case "$XBPS_TARGET_MACHINE" in
|
case "$XBPS_TARGET_MACHINE" in
|
||||||
*-musl) suffix="-musl"
|
*-musl) suffix="-musl"
|
||||||
esac
|
esac
|
||||||
install -Dm644 ${XBPS_DISTDIR}/etc/xbps.d/repos-remote${suffix}.conf \
|
sed -e "$mirror_sed" ${XBPS_DISTDIR}/etc/xbps.d/repos-remote${suffix}.conf \
|
||||||
$crossconfdir/20-repository-remote.conf
|
> $crossconfdir/20-repository-remote.conf
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -14,13 +14,18 @@
|
||||||
# rely on this to work properly.
|
# rely on this to work properly.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# [OPTIONAL]
|
||||||
|
# Use an alternative mirror for remote repositories. This is more
|
||||||
|
# convenient than modifying etc/xbps.d/repos-remote*.conf.
|
||||||
|
#
|
||||||
|
#XBPS_MIRROR=https://repo-us.voidlinux.org/current
|
||||||
|
|
||||||
# [OPTIONAL]
|
# [OPTIONAL]
|
||||||
# Enable optional arguments to xbps-install(1) for the host system.
|
# Enable optional arguments to xbps-install(1) for the host system.
|
||||||
# Currently used in the 'binary-bootstrap' and 'bootstrap-update' targets.
|
# Currently used in the 'binary-bootstrap' and 'bootstrap-update' targets.
|
||||||
#
|
#
|
||||||
# NOTE: local repositories are handled automatically by xbps-src,
|
# NOTE: local repositories are handled automatically by xbps-src,
|
||||||
# but you can modify the default remote repositories at
|
# and remote repositories can be changed by setting XBPS_MIRROR
|
||||||
# 'etc/xbps.d/repos-remote*.conf'
|
|
||||||
#
|
#
|
||||||
#XBPS_INSTALL_ARGS=""
|
#XBPS_INSTALL_ARGS=""
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue