mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-13 09:56:18 +02:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a1594ae1f6 | ||
![]() |
49ad7e6dbe | ||
![]() |
85705363cd | ||
![]() |
4a9ecdfe15 | ||
![]() |
33fda4e8ff | ||
![]() |
db135e9013 | ||
![]() |
443aedca9a | ||
![]() |
b58fb33482 | ||
![]() |
f743f58682 | ||
![]() |
98166e3454 | ||
![]() |
273d5a7a43 | ||
![]() |
e5fe74102d | ||
![]() |
28140068ce | ||
![]() |
bf7dc83bab | ||
![]() |
cae954ddb5 | ||
![]() |
285a4e94cd | ||
![]() |
a78bdb841d | ||
![]() |
12a1300694 | ||
![]() |
625e6bd412 | ||
![]() |
6dce935b99 | ||
![]() |
98841eb694 | ||
![]() |
be00fcd47b | ||
![]() |
651f8f834f | ||
![]() |
d83805bc54 | ||
![]() |
af6c0a0f6a |
@@ -26,6 +26,8 @@ usage() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
orig_argv=("$@")
|
||||||
|
|
||||||
while getopts 'hC:M:c:' arg; do
|
while getopts 'hC:M:c:' arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
C) pac_conf="$OPTARG" ;;
|
C) pac_conf="$OPTARG" ;;
|
||||||
@@ -38,7 +40,7 @@ done
|
|||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
(( $# < 1 )) && die 'You must specify a directory.'
|
(( $# < 1 )) && die 'You must specify a directory.'
|
||||||
check_root "$0" "$@"
|
check_root "$0" "${orig_argv[@]}"
|
||||||
|
|
||||||
working_dir=$(readlink -f "$1")
|
working_dir=$(readlink -f "$1")
|
||||||
shift 1
|
shift 1
|
||||||
@@ -84,7 +86,7 @@ umask 0022
|
|||||||
|
|
||||||
# Sanity check
|
# Sanity check
|
||||||
if [[ ! -f "$working_dir/.arch-chroot" ]]; then
|
if [[ ! -f "$working_dir/.arch-chroot" ]]; then
|
||||||
die "'%s' does not appear to be a Arch chroot." "$working_dir"
|
die "'%s' does not appear to be an Arch chroot." "$working_dir"
|
||||||
elif [[ $(cat "$working_dir/.arch-chroot") != $CHROOT_VERSION ]]; then
|
elif [[ $(cat "$working_dir/.arch-chroot") != $CHROOT_VERSION ]]; then
|
||||||
die "chroot '%s' is not at version %s. Please rebuild." "$working_dir" "$CHROOT_VERSION"
|
die "chroot '%s' is not at version %s. Please rebuild." "$working_dir" "$CHROOT_VERSION"
|
||||||
fi
|
fi
|
||||||
@@ -94,11 +96,8 @@ copy_hostconf
|
|||||||
|
|
||||||
eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf")
|
eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf")
|
||||||
|
|
||||||
machine_name="${working_dir//[![:alnum:]_-]/-}"
|
|
||||||
machine_name="${machine_name#-}"
|
|
||||||
|
|
||||||
exec ${CARCH:+setarch "$CARCH"} systemd-nspawn 2>/dev/null \
|
exec ${CARCH:+setarch "$CARCH"} systemd-nspawn 2>/dev/null \
|
||||||
-D "$working_dir" \
|
-D "$working_dir" \
|
||||||
--machine "$machine_name" \
|
--register=no \
|
||||||
"${mount_args[@]}" \
|
"${mount_args[@]}" \
|
||||||
"$@"
|
"$@"
|
||||||
|
@@ -29,6 +29,8 @@ usage() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
orig_argv=("$@")
|
||||||
|
|
||||||
while getopts 'hcr:' arg; do
|
while getopts 'hcr:' arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
c) clean_first=true ;;
|
c) clean_first=true ;;
|
||||||
@@ -37,11 +39,11 @@ while getopts 'hcr:' arg; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
check_root "$0" "${orig_argv[@]}"
|
||||||
|
|
||||||
# Pass all arguments after -- right to makepkg
|
# Pass all arguments after -- right to makepkg
|
||||||
makechrootpkg_args+=("${@:$OPTIND}")
|
makechrootpkg_args+=("${@:$OPTIND}")
|
||||||
|
|
||||||
check_root "$0" "$@"
|
|
||||||
|
|
||||||
if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
|
if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
|
||||||
msg "Creating chroot for [${repo}] (${arch})..."
|
msg "Creating chroot for [${repo}] (${arch})..."
|
||||||
|
|
||||||
@@ -49,7 +51,7 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
|
|||||||
[[ -d $copy ]] || continue
|
[[ -d $copy ]] || continue
|
||||||
msg2 "Deleting chroot copy '$(basename "${copy}")'..."
|
msg2 "Deleting chroot copy '$(basename "${copy}")'..."
|
||||||
|
|
||||||
lock 9 "$copydir.lock" "Locking chroot copy '$copy'"
|
lock 9 "$copy.lock" "Locking chroot copy '$copy'"
|
||||||
|
|
||||||
if [[ "$(stat -f -c %T "${copy}")" == btrfs ]]; then
|
if [[ "$(stat -f -c %T "${copy}")" == btrfs ]]; then
|
||||||
{ type -P btrfs && btrfs subvolume delete "${copy}"; } &>/dev/null
|
{ type -P btrfs && btrfs subvolume delete "${copy}"; } &>/dev/null
|
||||||
|
11
checkpkg.in
11
checkpkg.in
@@ -63,12 +63,11 @@ for _pkgname in "${pkgname[@]}"; do
|
|||||||
|
|
||||||
sdiff -s "$TEMPDIR/filelist-$_pkgname-old" "$TEMPDIR/filelist-$_pkgname"
|
sdiff -s "$TEMPDIR/filelist-$_pkgname-old" "$TEMPDIR/filelist-$_pkgname"
|
||||||
|
|
||||||
if diff "$TEMPDIR/filelist-$_pkgname"{-old,} | grep '\.so' &>/dev/null; then
|
find-libprovides "$TEMPDIR/$oldpkg" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname-old"
|
||||||
mkdir -p "$TEMPDIR/pkg"
|
find-libprovides "$pkgfile" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname"
|
||||||
bsdtar -x -C "$TEMPDIR" -f "$pkgfile" #> /dev/null
|
if ! diff_output="$(sdiff -s "$TEMPDIR/libraries-$_pkgname-old" "$TEMPDIR/libraries-$_pkgname")"; then
|
||||||
comm -13 <(sort "$TEMPDIR/filelist-$_pkgname-old") <(sort "$TEMPDIR/filelist-$_pkgname") | grep .so$ | while read i; do
|
msg "Sonames differ in $_pkgname!"
|
||||||
echo "${i}: " "$(objdump -p "$TEMPDIR/$i" | grep SONAME)"
|
echo "$diff_output"
|
||||||
done
|
|
||||||
else
|
else
|
||||||
msg "No soname differences for $_pkgname."
|
msg "No soname differences for $_pkgname."
|
||||||
fi
|
fi
|
||||||
|
@@ -32,11 +32,11 @@ else
|
|||||||
setup_workdir
|
setup_workdir
|
||||||
|
|
||||||
case ${script_mode} in
|
case ${script_mode} in
|
||||||
deps) bsdtar -C $WORKDIR -xf "$1";;
|
deps) bsdtar -C "$WORKDIR" -xf "$1";;
|
||||||
provides) bsdtar -C $WORKDIR -xf "$1" --include="*.so*";;
|
provides) bsdtar -C "$WORKDIR" -xf "$1" --include="*.so*";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
pushd $WORKDIR >/dev/null
|
pushd "$WORKDIR" >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
process_sofile() {
|
process_sofile() {
|
||||||
@@ -50,16 +50,16 @@ process_sofile() {
|
|||||||
if ! in_array "${soname}=${soversion}-${soarch}" ${soobjects[@]}; then
|
if ! in_array "${soname}=${soversion}-${soarch}" ${soobjects[@]}; then
|
||||||
# libfoo.so=1-64
|
# libfoo.so=1-64
|
||||||
echo "${soname}=${soversion}-${soarch}"
|
echo "${soname}=${soversion}-${soarch}"
|
||||||
soobjects=(${soobjects[@]} "${soname}=${soversion}-${soarch}")
|
soobjects+=("${soname}=${soversion}-${soarch}")
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
case $script_mode in
|
case $script_mode in
|
||||||
deps) find_args="-perm -u+x";;
|
deps) find_args=(-perm -u+x);;
|
||||||
provides) find_args="-name *.so*";;
|
provides) find_args=(-name '*.so*');;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
find . -type f $find_args | while read filename; do
|
find . -type f "${find_args[@]}" | while read filename; do
|
||||||
if [[ $script_mode = "provides" ]]; then
|
if [[ $script_mode = "provides" ]]; then
|
||||||
# ignore if we don't have a shared object
|
# ignore if we don't have a shared object
|
||||||
if ! LC_ALL=C readelf -h "$filename" 2>/dev/null | grep -q '.*Type:.*DYN (Shared object file).*'; then
|
if ! LC_ALL=C readelf -h "$filename" 2>/dev/null | grep -q '.*Type:.*DYN (Shared object file).*'; then
|
||||||
|
@@ -79,8 +79,9 @@ trap_abort() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
trap_exit() {
|
trap_exit() {
|
||||||
|
local r=$?
|
||||||
trap - EXIT INT QUIT TERM HUP
|
trap - EXIT INT QUIT TERM HUP
|
||||||
cleanup
|
cleanup $r
|
||||||
}
|
}
|
||||||
|
|
||||||
die() {
|
die() {
|
||||||
@@ -237,7 +238,6 @@ check_root() {
|
|||||||
if type -P sudo >/dev/null; then
|
if type -P sudo >/dev/null; then
|
||||||
exec sudo -- "$@"
|
exec sudo -- "$@"
|
||||||
else
|
else
|
||||||
exec su root -c "$(printf '%q' "$@")"
|
exec su root -c "$(printf ' %q' "$@")"
|
||||||
fi
|
fi
|
||||||
die 'This script must be run as root.'
|
|
||||||
}
|
}
|
||||||
|
175
makechrootpkg.in
175
makechrootpkg.in
@@ -12,7 +12,7 @@ m4_include(lib/common.sh)
|
|||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
makepkg_args='-s --noconfirm -L --holdver'
|
makepkg_args=(-s --noconfirm -L --holdver)
|
||||||
repack=false
|
repack=false
|
||||||
update_first=false
|
update_first=false
|
||||||
clean_first=false
|
clean_first=false
|
||||||
@@ -46,7 +46,7 @@ usage() {
|
|||||||
echo 'command:'
|
echo 'command:'
|
||||||
echo ' mkarchroot <chrootdir>/root base-devel'
|
echo ' mkarchroot <chrootdir>/root base-devel'
|
||||||
echo ''
|
echo ''
|
||||||
echo "Default makepkg args: $makepkg_args"
|
echo "Default makepkg args: ${makepkg_args[*]}"
|
||||||
echo ''
|
echo ''
|
||||||
echo 'Flags:'
|
echo 'Flags:'
|
||||||
echo '-h This help'
|
echo '-h This help'
|
||||||
@@ -66,58 +66,6 @@ usage() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts 'hcur:I:l:nTD:d:' arg; do
|
|
||||||
case "$arg" in
|
|
||||||
h) usage ;;
|
|
||||||
c) clean_first=true ;;
|
|
||||||
D) bindmounts_ro+=(--bind-ro="$OPTARG") ;;
|
|
||||||
d) bindmounts_rw+=(--bind="$OPTARG") ;;
|
|
||||||
u) update_first=true ;;
|
|
||||||
r) passeddir="$OPTARG" ;;
|
|
||||||
I) install_pkgs+=("$OPTARG") ;;
|
|
||||||
l) copy="$OPTARG" ;;
|
|
||||||
n) run_namcap=true; makepkg_args="$makepkg_args -i" ;;
|
|
||||||
T) temp_chroot=true; copy+="-$$" ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
check_root "$0" "$@"
|
|
||||||
|
|
||||||
[[ ! -f PKGBUILD && -z "${install_pkgs[*]}" ]] && die 'This must be run in a directory containing a PKGBUILD.'
|
|
||||||
|
|
||||||
# Canonicalize chrootdir, getting rid of trailing /
|
|
||||||
chrootdir=$(readlink -e "$passeddir")
|
|
||||||
[[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '%s'" "$passeddir"
|
|
||||||
[[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkarchroot %s/root base-devel" "$chrootdir"
|
|
||||||
|
|
||||||
# Detect chrootdir filesystem type
|
|
||||||
chroottype=$(stat -f -c %T "$chrootdir")
|
|
||||||
|
|
||||||
if [[ ${copy:0:1} = / ]]; then
|
|
||||||
copydir=$copy
|
|
||||||
else
|
|
||||||
copydir="$chrootdir/$copy"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Pass all arguments after -- right to makepkg
|
|
||||||
makepkg_args="$makepkg_args ${*:$OPTIND}"
|
|
||||||
|
|
||||||
# See if -R was passed to makepkg
|
|
||||||
for arg in "${@:OPTIND}"; do
|
|
||||||
case ${arg%%=*} in
|
|
||||||
-*R*|--repackage)
|
|
||||||
repack=true
|
|
||||||
break 2
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ -n $SUDO_USER ]]; then
|
|
||||||
USER_HOME=$(eval echo ~$SUDO_USER)
|
|
||||||
else
|
|
||||||
USER_HOME=$HOME
|
|
||||||
fi
|
|
||||||
|
|
||||||
# {{{ functions
|
# {{{ functions
|
||||||
load_vars() {
|
load_vars() {
|
||||||
local makepkg_conf="$1" var
|
local makepkg_conf="$1" var
|
||||||
@@ -164,7 +112,7 @@ create_chroot() {
|
|||||||
|
|
||||||
clean_temporary() {
|
clean_temporary() {
|
||||||
stat_busy "Removing temporary copy [$copy]"
|
stat_busy "Removing temporary copy [$copy]"
|
||||||
if [[ "$chroottype" == btrfs ]]; then
|
if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then
|
||||||
btrfs subvolume delete "$copydir" >/dev/null ||
|
btrfs subvolume delete "$copydir" >/dev/null ||
|
||||||
die "Unable to delete subvolume %s" "$copydir"
|
die "Unable to delete subvolume %s" "$copydir"
|
||||||
else
|
else
|
||||||
@@ -205,10 +153,12 @@ prepare_chroot() {
|
|||||||
echo 'BUILDDIR="/build"' >> "$copydir/etc/makepkg.conf"
|
echo 'BUILDDIR="/build"' >> "$copydir/etc/makepkg.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Read .makepkg.conf and .gnupg/pubring.gpg even if called via sudo
|
# Read .makepkg.conf and gnupg pubring
|
||||||
if [[ -r "$USER_HOME/.gnupg/pubring.gpg" ]]; then
|
if [[ -r $USER_HOME/.gnupg/pubring.kbx ]]; then
|
||||||
install -D "$USER_HOME/.gnupg/pubring.gpg" \
|
install -D "$USER_HOME/.gnupg/pubring.kbx" "$copydir/build/.gnupg/pubring.kbx"
|
||||||
"$copydir/build/.gnupg/pubring.gpg"
|
fi
|
||||||
|
if [[ -r $USER_HOME/.gnupg/pubring.gpg ]]; then
|
||||||
|
install -D "$USER_HOME/.gnupg/pubring.gpg" "$copydir/build/.gnupg/pubring.gpg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "$copydir/pkgdest"
|
mkdir -p "$copydir/pkgdest"
|
||||||
@@ -234,7 +184,13 @@ prepare_chroot() {
|
|||||||
echo 'SRCDEST="/srcdest"' >> "$copydir/etc/makepkg.conf"
|
echo 'SRCDEST="/srcdest"' >> "$copydir/etc/makepkg.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chown -R nobody "$copydir"/{build,pkgdest,srcpkgdest,logdest,srcdest,startdir}
|
builduser_uid=${SUDO_UID:-$UID}
|
||||||
|
|
||||||
|
# We can't use useradd without chrooting, otherwise it invokes PAM modules
|
||||||
|
# which we might not be able to load (i.e. when building i686 packages on
|
||||||
|
# an x86_64 host).
|
||||||
|
printf 'builduser:x:%d:100:builduser:/:/usr/bin/nologin\n' "$builduser_uid" >>"$copydir/etc/passwd"
|
||||||
|
chown -R "$builduser_uid" "$copydir"/{build,pkgdest,srcpkgdest,logdest,srcdest,startdir}
|
||||||
|
|
||||||
if [[ -n $MAKEFLAGS ]]; then
|
if [[ -n $MAKEFLAGS ]]; then
|
||||||
sed -i '/^MAKEFLAGS=/d' "$copydir/etc/makepkg.conf"
|
sed -i '/^MAKEFLAGS=/d' "$copydir/etc/makepkg.conf"
|
||||||
@@ -246,18 +202,33 @@ prepare_chroot() {
|
|||||||
echo "PACKAGER='${PACKAGER}'" >> "$copydir/etc/makepkg.conf"
|
echo "PACKAGER='${PACKAGER}'" >> "$copydir/etc/makepkg.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f $copydir/etc/sudoers.d/nobody-pacman ]]; then
|
if [[ ! -f $copydir/etc/sudoers.d/builduser-pacman ]]; then
|
||||||
cat > "$copydir/etc/sudoers.d/nobody-pacman" <<EOF
|
cat > "$copydir/etc/sudoers.d/builduser-pacman" <<EOF
|
||||||
Defaults env_keep += "HOME"
|
Defaults env_keep += "HOME"
|
||||||
nobody ALL = NOPASSWD: /usr/bin/pacman
|
builduser ALL = NOPASSWD: /usr/bin/pacman
|
||||||
EOF
|
EOF
|
||||||
chmod 440 "$copydir/etc/sudoers.d/nobody-pacman"
|
chmod 440 "$copydir/etc/sudoers.d/builduser-pacman"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# This is a little gross, but this way the script is recreated every time in the
|
# This is a little gross, but this way the script is recreated every time in the
|
||||||
# working copy
|
# working copy
|
||||||
printf $'#!/bin/bash\n%s\n_chrootbuild %q %q' "$(declare -f _chrootbuild)" \
|
{
|
||||||
"$makepkg_args" "$run_namcap" >"$copydir/chrootbuild"
|
printf '#!/bin/bash\n'
|
||||||
|
declare -f _chrootbuild
|
||||||
|
printf '_chrootbuild'
|
||||||
|
printf ' %q' "${makepkg_args[@]}"
|
||||||
|
printf ' || exit\n'
|
||||||
|
|
||||||
|
if $run_namcap; then
|
||||||
|
cat <<'EOF'
|
||||||
|
pacman -S --needed --noconfirm namcap
|
||||||
|
for pkgfile in /startdir/PKGBUILD /pkgdest/*; do
|
||||||
|
echo "Checking ${pkgfile##*/}"
|
||||||
|
sudo -u builduser namcap "$pkgfile" 2>&1 | tee "/logdest/${pkgfile##*/}-namcap.log"
|
||||||
|
done
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
} >"$copydir/chrootbuild"
|
||||||
chmod +x "$copydir/chrootbuild"
|
chmod +x "$copydir/chrootbuild"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,8 +254,6 @@ download_sources() {
|
|||||||
_chrootbuild() {
|
_chrootbuild() {
|
||||||
# This function isn't run in makechrootpkg,
|
# This function isn't run in makechrootpkg,
|
||||||
# so no global variables
|
# so no global variables
|
||||||
local makepkg_args="$1"
|
|
||||||
local run_namcap="$2"
|
|
||||||
|
|
||||||
. /etc/profile
|
. /etc/profile
|
||||||
export HOME=/build
|
export HOME=/build
|
||||||
@@ -302,7 +271,7 @@ _chrootbuild() {
|
|||||||
for vcsdir in */.$vcs; do
|
for vcsdir in */.$vcs; do
|
||||||
rm "${vcsdir%/.$vcs}"
|
rm "${vcsdir%/.$vcs}"
|
||||||
cp -a "${dir}_host/${vcsdir%/.$vcs}" .
|
cp -a "${dir}_host/${vcsdir%/.$vcs}" .
|
||||||
chown -R nobody "${vcsdir%/.$vcs}"
|
chown -R builduser "${vcsdir%/.$vcs}"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
@@ -312,7 +281,7 @@ _chrootbuild() {
|
|||||||
# XXX: Keep PKGBUILD writable for pkgver()
|
# XXX: Keep PKGBUILD writable for pkgver()
|
||||||
rm PKGBUILD*
|
rm PKGBUILD*
|
||||||
cp /startdir_host/PKGBUILD* .
|
cp /startdir_host/PKGBUILD* .
|
||||||
chown nobody PKGBUILD*
|
chown builduser PKGBUILD*
|
||||||
|
|
||||||
# Safety check
|
# Safety check
|
||||||
if [[ ! -w PKGBUILD ]]; then
|
if [[ ! -w PKGBUILD ]]; then
|
||||||
@@ -320,17 +289,7 @@ _chrootbuild() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo -u nobody makepkg $makepkg_args || exit 1
|
sudo -u builduser makepkg "$@"
|
||||||
|
|
||||||
if $run_namcap; then
|
|
||||||
pacman -S --needed --noconfirm namcap
|
|
||||||
for pkgfile in /startdir/PKGBUILD /pkgdest/*; do
|
|
||||||
echo "Checking ${pkgfile##*/}"
|
|
||||||
sudo -u nobody namcap "$pkgfile" 2>&1 | tee "/logdest/${pkgfile##*/}-namcap.log"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
move_products() {
|
move_products() {
|
||||||
@@ -352,6 +311,60 @@ move_products() {
|
|||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
orig_argv=("$@")
|
||||||
|
|
||||||
|
while getopts 'hcur:I:l:nTD:d:' arg; do
|
||||||
|
case "$arg" in
|
||||||
|
c) clean_first=true ;;
|
||||||
|
D) bindmounts_ro+=(--bind-ro="$OPTARG") ;;
|
||||||
|
d) bindmounts_rw+=(--bind="$OPTARG") ;;
|
||||||
|
u) update_first=true ;;
|
||||||
|
r) passeddir="$OPTARG" ;;
|
||||||
|
I) install_pkgs+=("$OPTARG") ;;
|
||||||
|
l) copy="$OPTARG" ;;
|
||||||
|
n) run_namcap=true; makepkg_args+=(-i) ;;
|
||||||
|
T) temp_chroot=true; copy+="-$$" ;;
|
||||||
|
h|*) usage ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
[[ ! -f PKGBUILD && -z "${install_pkgs[*]}" ]] && die 'This must be run in a directory containing a PKGBUILD.'
|
||||||
|
|
||||||
|
check_root "$0" "${orig_argv[@]}"
|
||||||
|
|
||||||
|
# Canonicalize chrootdir, getting rid of trailing /
|
||||||
|
chrootdir=$(readlink -e "$passeddir")
|
||||||
|
[[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '%s'" "$passeddir"
|
||||||
|
[[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkarchroot %s/root base-devel" "$chrootdir"
|
||||||
|
|
||||||
|
# Detect chrootdir filesystem type
|
||||||
|
chroottype=$(stat -f -c %T "$chrootdir")
|
||||||
|
|
||||||
|
if [[ ${copy:0:1} = / ]]; then
|
||||||
|
copydir=$copy
|
||||||
|
else
|
||||||
|
copydir="$chrootdir/$copy"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Pass all arguments after -- right to makepkg
|
||||||
|
makepkg_args+=("${@:$OPTIND}")
|
||||||
|
|
||||||
|
# See if -R was passed to makepkg
|
||||||
|
for arg in "${@:OPTIND}"; do
|
||||||
|
case ${arg%%=*} in
|
||||||
|
-*R*|--repackage)
|
||||||
|
repack=true
|
||||||
|
break 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -n $SUDO_USER ]]; then
|
||||||
|
eval "USER_HOME=~$SUDO_USER"
|
||||||
|
else
|
||||||
|
USER_HOME=$HOME
|
||||||
|
fi
|
||||||
|
|
||||||
umask 0022
|
umask 0022
|
||||||
|
|
||||||
load_vars "$USER_HOME/.makepkg.conf"
|
load_vars "$USER_HOME/.makepkg.conf"
|
||||||
|
@@ -19,6 +19,13 @@ DLAGENTS=('ftp::/usr/bin/curl -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %
|
|||||||
# /usr/bin/lftpget -c
|
# /usr/bin/lftpget -c
|
||||||
# /usr/bin/wget
|
# /usr/bin/wget
|
||||||
|
|
||||||
|
#-- The the package required by makepkg to download VCS sources
|
||||||
|
# Format: 'protocol::package'
|
||||||
|
VCSCLIENTS=('bzr::bzr'
|
||||||
|
'git::git'
|
||||||
|
'hg::mercurial'
|
||||||
|
'svn::subversion')
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# ARCHITECTURE, COMPILE FLAGS
|
# ARCHITECTURE, COMPILE FLAGS
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
@@ -19,6 +19,13 @@ DLAGENTS=('ftp::/usr/bin/curl -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %
|
|||||||
# /usr/bin/lftpget -c
|
# /usr/bin/lftpget -c
|
||||||
# /usr/bin/wget
|
# /usr/bin/wget
|
||||||
|
|
||||||
|
#-- The the package required by makepkg to download VCS sources
|
||||||
|
# Format: 'protocol::package'
|
||||||
|
VCSCLIENTS=('bzr::bzr'
|
||||||
|
'git::git'
|
||||||
|
'hg::mercurial'
|
||||||
|
'svn::subversion')
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# ARCHITECTURE, COMPILE FLAGS
|
# ARCHITECTURE, COMPILE FLAGS
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
@@ -15,7 +15,7 @@ CHROOT_VERSION='v3'
|
|||||||
working_dir=''
|
working_dir=''
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: ${0##*/} [options] working-dir [package-list | app]"
|
echo "Usage: ${0##*/} [options] working-dir package-list..."
|
||||||
echo ' options:'
|
echo ' options:'
|
||||||
echo ' -C <file> Location of a pacman config file'
|
echo ' -C <file> Location of a pacman config file'
|
||||||
echo ' -M <file> Location of a makepkg config file'
|
echo ' -M <file> Location of a makepkg config file'
|
||||||
@@ -24,6 +24,8 @@ usage() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
orig_argv=("$@")
|
||||||
|
|
||||||
while getopts 'hC:M:c:' arg; do
|
while getopts 'hC:M:c:' arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
C) pac_conf="$OPTARG" ;;
|
C) pac_conf="$OPTARG" ;;
|
||||||
@@ -37,7 +39,7 @@ shift $(($OPTIND - 1))
|
|||||||
|
|
||||||
(( $# < 2 )) && die 'You must specify a directory and one or more packages.'
|
(( $# < 2 )) && die 'You must specify a directory and one or more packages.'
|
||||||
|
|
||||||
check_root "$0" "$@"
|
check_root "$0" "${orig_argv[@]}"
|
||||||
|
|
||||||
working_dir="$(readlink -f $1)"
|
working_dir="$(readlink -f $1)"
|
||||||
shift 1
|
shift 1
|
||||||
|
Reference in New Issue
Block a user