xbps-src: use default hostdir if unset; added support for x86 chroots ootb.
- If -H (hostdir) is unset, it now defaults to xbps-packages/hostdir. This way a single hostdir can be shared by multiple masterdirs without any tweak. - If bootstrap pkg are installed via 'binary-bootstrap arch', add support to reexec xbps-src with linux32 to allow 32bit builds without any tweak or additional commands.
This commit is contained in:
parent
15a7d3c779
commit
1fb261bb97
2 changed files with 27 additions and 14 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,4 +4,5 @@
|
||||||
\#*#
|
\#*#
|
||||||
*.o
|
*.o
|
||||||
masterdir*
|
masterdir*
|
||||||
|
hostdir*
|
||||||
etc/conf
|
etc/conf
|
||||||
|
|
40
xbps-src
40
xbps-src
|
@ -119,6 +119,7 @@ Options:
|
||||||
Absolute path to a directory to be bind mounted at <masterdir>/host.
|
Absolute path to a directory to be bind mounted at <masterdir>/host.
|
||||||
The host directory stores binary packages, sources and package dependencies
|
The host directory stores binary packages, sources and package dependencies
|
||||||
downloaded from remote repositories.
|
downloaded from remote repositories.
|
||||||
|
If unset defaults to xbps-packages/hostdir.
|
||||||
|
|
||||||
-h Usage output.
|
-h Usage output.
|
||||||
|
|
||||||
|
@ -131,6 +132,7 @@ Options:
|
||||||
-m <masterdir>
|
-m <masterdir>
|
||||||
Absolute path to a directory to be used as masterdir.
|
Absolute path to a directory to be used as masterdir.
|
||||||
The masterdir is the main directory to build/store/compile packages.
|
The masterdir is the main directory to build/store/compile packages.
|
||||||
|
If unset defaults to xbps-packages/masterdir.
|
||||||
|
|
||||||
-N Disable use of remote repositories to resolve dependencies.
|
-N Disable use of remote repositories to resolve dependencies.
|
||||||
|
|
||||||
|
@ -175,6 +177,10 @@ check_config_vars() {
|
||||||
fi
|
fi
|
||||||
if [ -z "$XBPS_MASTERDIR" ]; then
|
if [ -z "$XBPS_MASTERDIR" ]; then
|
||||||
export XBPS_MASTERDIR="${XBPS_DISTDIR}/masterdir"
|
export XBPS_MASTERDIR="${XBPS_DISTDIR}/masterdir"
|
||||||
|
fi
|
||||||
|
if [ -z "$XBPS_HOSTDIR" ]; then
|
||||||
|
export XBPS_HOSTDIR="${XBPS_DISTDIR}/hostdir"
|
||||||
|
[ ! -d $XBPS_HOSTDIR ] && mkdir -p $XBPS_HOSTDIR
|
||||||
fi
|
fi
|
||||||
if [ -d "$XBPS_MASTERDIR" -a ! -w "$XBPS_MASTERDIR" ]; then
|
if [ -d "$XBPS_MASTERDIR" -a ! -w "$XBPS_MASTERDIR" ]; then
|
||||||
echo "ERROR: not enough perms for masterdir $XBPS_MASTERDIR."
|
echo "ERROR: not enough perms for masterdir $XBPS_MASTERDIR."
|
||||||
|
@ -228,12 +234,12 @@ install_bbotstrap() {
|
||||||
_subarch="-${XBPS_TARGET_PKG#*-}"
|
_subarch="-${XBPS_TARGET_PKG#*-}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
${_bootstrap_arch} xbps-install -S ${XBPS_INSTALL_ARGS} -c host/repocache -r $XBPS_MASTERDIR -y base-chroot${_subarch}
|
${_bootstrap_arch} xbps-install -S ${XBPS_INSTALL_ARGS} -c ${XBPS_HOSTDIR}/repocache -r $XBPS_MASTERDIR -y base-chroot${_subarch}
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
msg_error "Failed to install bootstrap packages!\n"
|
msg_error "Failed to install bootstrap packages!\n"
|
||||||
fi
|
fi
|
||||||
# Reconfigure base-directories.
|
# Reconfigure base-directories.
|
||||||
xbps-reconfigure -r $XBPS_MASTERDIR -f base-directories &>/dev/null
|
XBPS_ARCH=$XBPS_TARGET_PKG xbps-reconfigure -r $XBPS_MASTERDIR -f base-directories &>/dev/null
|
||||||
msg_normal "Installed bootstrap successfully!\n"
|
msg_normal "Installed bootstrap successfully!\n"
|
||||||
chroot_prepare $XBPS_TARGET_PKG || msg_error "Failed to initialize chroot!\n"
|
chroot_prepare $XBPS_TARGET_PKG || msg_error "Failed to initialize chroot!\n"
|
||||||
}
|
}
|
||||||
|
@ -294,21 +300,23 @@ readonly XBPS_MACHINE=$(uname -m)
|
||||||
#
|
#
|
||||||
# main()
|
# main()
|
||||||
#
|
#
|
||||||
|
XBPS_OPTIONS=
|
||||||
|
|
||||||
while getopts "a:CfghH:Ij:Lm:No:r:V" opt; do
|
while getopts "a:CfghH:Ij:Lm:No:r:V" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
a) readonly XBPS_CROSS_BUILD="$OPTARG";;
|
a) readonly XBPS_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+="-a $OPTARG ";;
|
||||||
C) readonly XBPS_KEEP_ALL=1;;
|
C) readonly XBPS_KEEP_ALL=1; XBPS_OPTIONS+="-C ";;
|
||||||
f) readonly XBPS_BUILD_FORCEMODE=1;;
|
f) readonly XBPS_BUILD_FORCEMODE=1; XBPS_OPTIONS+="-f ";;
|
||||||
g) readonly XBPS_DEBUG_PKGS=1;;
|
g) readonly XBPS_DEBUG_PKGS=1; XBPS_OPTIONS+="-g ";;
|
||||||
H) readonly XBPS_HOSTDIR="$(readlink -m $OPTARG 2>/dev/null)";;
|
H) readonly XBPS_HOSTDIR="$(readlink -m $OPTARG 2>/dev/null)"; XBPS_OPTIONS+="-H $XBPS_HOSTDIR ";;
|
||||||
h) usage && exit 0;;
|
h) usage && exit 0;;
|
||||||
I) readonly XBPS_SKIP_DEPS=1;;
|
I) readonly XBPS_SKIP_DEPS=1; XBPS_OPTIONS+="-I ";;
|
||||||
j) readonly XBPS_MAKEJOBS="$OPTARG";;
|
j) readonly XBPS_MAKEJOBS="$OPTARG"; XBPS_OPTIONS+="-j $OPTARG ";;
|
||||||
L) export NOCOLORS=1;;
|
L) export NOCOLORS=1; XBPS_OPTIONS+="-L ";;
|
||||||
m) readonly XBPS_MASTERDIR=$(readlink -m $OPTARG 2>/dev/null);;
|
m) readonly XBPS_MASTERDIR=$(readlink -m $OPTARG 2>/dev/null); XBPS_OPTIONS+="-m $XBPS_MASTERDIR ";;
|
||||||
N) readonly XBPS_SKIP_REMOTEREPOS=1;;
|
N) readonly XBPS_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+="-N ";;
|
||||||
o) readonly XBPS_BUILD_OPTS="$OPTARG";;
|
o) readonly XBPS_BUILD_OPTS="$OPTARG"; XBPS_OPTIONS+="-o $OPTARG ";;
|
||||||
r) readonly XBPS_ALT_REPOSITORY="$OPTARG";;
|
r) readonly XBPS_ALT_REPOSITORY="$OPTARG"; XBPS_OPTIONS+="-r $OPTARG ";;
|
||||||
V) echo $XBPS_SRC_VERSION && exit 0;;
|
V) echo $XBPS_SRC_VERSION && exit 0;;
|
||||||
--) shift; break;;
|
--) shift; break;;
|
||||||
esac
|
esac
|
||||||
|
@ -409,6 +417,10 @@ fi
|
||||||
|
|
||||||
if [ -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
|
if [ -s $XBPS_MASTERDIR/.xbps_chroot_init ]; then
|
||||||
export XBPS_ARCH=$(cat $XBPS_MASTERDIR/.xbps_chroot_init)
|
export XBPS_ARCH=$(cat $XBPS_MASTERDIR/.xbps_chroot_init)
|
||||||
|
if [ "$XBPS_MACHINE" = "x86_64" -a "$XBPS_ARCH" = "i686" -a -z "$IN_CHROOT" ]; then
|
||||||
|
# reexec itself via linux32
|
||||||
|
exec linux32 $0 ${XBPS_OPTIONS} $@
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
|
export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
|
||||||
|
|
Loading…
Reference in a new issue