mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-13 18:06:19 +02:00
Compare commits
78 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e10ce7fc70 | ||
![]() |
ff48401963 | ||
![]() |
15f16162fb | ||
![]() |
fea14fa286 | ||
![]() |
4bafd641ab | ||
![]() |
58968cfaa2 | ||
![]() |
c8147a3512 | ||
![]() |
76dec8507e | ||
![]() |
9727b684e6 | ||
![]() |
e3fe7134e2 | ||
![]() |
70d3c63b5c | ||
![]() |
eb6b0e3f11 | ||
![]() |
69a3a0e7c0 | ||
![]() |
ca819a2357 | ||
![]() |
eb88a303b7 | ||
![]() |
8f94d8118f | ||
![]() |
882f5d0451 | ||
![]() |
f36c45e0c6 | ||
![]() |
7fc22b9aba | ||
![]() |
7fe0f68856 | ||
![]() |
f85fc32d78 | ||
![]() |
c5128dc45c | ||
![]() |
f1effdf989 | ||
![]() |
38957783a2 | ||
![]() |
5a7890f076 | ||
![]() |
ba45e06d3e | ||
![]() |
393b9757cf | ||
![]() |
3231cf8c36 | ||
![]() |
f5ef88ec59 | ||
![]() |
80ba87881a | ||
![]() |
763d8ffb53 | ||
![]() |
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 | ||
![]() |
905198295d | ||
![]() |
03611dc63e | ||
![]() |
7aac293d76 | ||
![]() |
6db31cc16a | ||
![]() |
4ee45fe6d4 | ||
![]() |
0b2ae245f1 | ||
![]() |
fdd079f3d5 | ||
![]() |
9f7ba3d407 | ||
![]() |
40ea1b3ca5 | ||
![]() |
fd1be1b27a | ||
![]() |
8ce6e29add | ||
![]() |
1e043445d2 | ||
![]() |
3029c8e4bc | ||
![]() |
b8dd44083a | ||
![]() |
4b3a6c7803 | ||
![]() |
59e348fc3c | ||
![]() |
27441f201c | ||
![]() |
c4f72f781b | ||
![]() |
9974309cee | ||
![]() |
e3cf64ad2f | ||
![]() |
7524bec6d9 | ||
![]() |
70309118ab |
5
Makefile
5
Makefile
@@ -1,4 +1,4 @@
|
|||||||
V=20131020
|
V=20170304
|
||||||
|
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
|
|
||||||
@@ -112,6 +112,7 @@ dist:
|
|||||||
gpg --detach-sign --use-agent devtools-$(V).tar.gz
|
gpg --detach-sign --use-agent devtools-$(V).tar.gz
|
||||||
|
|
||||||
upload:
|
upload:
|
||||||
scp devtools-$(V).tar.gz devtools-$(V).tar.gz.sig nymeria.archlinux.org:/srv/ftp/other/devtools/
|
scp devtools-$(V).tar.gz devtools-$(V).tar.gz.sig repos.archlinux.org:/srv/ftp/other/devtools/
|
||||||
|
|
||||||
.PHONY: all clean install uninstall dist upload
|
.PHONY: all clean install uninstall dist upload
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
m4_include(lib/common.sh)
|
m4_include(lib/common.sh)
|
||||||
|
|
||||||
CHROOT_VERSION='v3'
|
CHROOT_VERSION='v4'
|
||||||
|
|
||||||
working_dir=''
|
working_dir=''
|
||||||
|
|
||||||
@@ -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" ;;
|
||||||
@@ -37,8 +39,8 @@ while getopts 'hC:M:c:' arg; do
|
|||||||
done
|
done
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
(( $EUID != 0 )) && die 'This script must be run as root.'
|
|
||||||
(( $# < 1 )) && die 'You must specify a directory.'
|
(( $# < 1 )) && die 'You must specify a directory.'
|
||||||
|
check_root "$0" "${orig_argv[@]}"
|
||||||
|
|
||||||
working_dir=$(readlink -f "$1")
|
working_dir=$(readlink -f "$1")
|
||||||
shift 1
|
shift 1
|
||||||
@@ -51,7 +53,7 @@ else
|
|||||||
cache_dirs=("$cache_dir")
|
cache_dirs=("$cache_dir")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
host_mirror=$(pacman -Sddp extra/devtools 2>/dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')
|
host_mirror=$(pacman --cachedir /doesnt/exist -Sddp extra/devtools 2>/dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')
|
||||||
[[ $host_mirror == *file://* ]] && host_mirror_path=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g')
|
[[ $host_mirror == *file://* ]] && host_mirror_path=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g')
|
||||||
|
|
||||||
# {{{ functions
|
# {{{ functions
|
||||||
@@ -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:]_-]/-}"
|
exec ${CARCH:+setarch "$CARCH"} systemd-nspawn -q \
|
||||||
machine_name="${machine_name#-}"
|
|
||||||
|
|
||||||
exec ${CARCH:+setarch "$CARCH"} systemd-nspawn 2>/dev/null \
|
|
||||||
-D "$working_dir" \
|
-D "$working_dir" \
|
||||||
--machine "$machine_name" \
|
--register=no \
|
||||||
"${mount_args[@]}" \
|
"${mount_args[@]}" \
|
||||||
"$@"
|
"$@"
|
||||||
|
10
archbuild.in
10
archbuild.in
@@ -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,13 +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}")
|
||||||
|
|
||||||
if (( EUID )); then
|
|
||||||
die 'This script must be run as root.'
|
|
||||||
fi
|
|
||||||
|
|
||||||
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})..."
|
||||||
|
|
||||||
@@ -51,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,9 +11,9 @@ fi
|
|||||||
|
|
||||||
case $scriptname in
|
case $scriptname in
|
||||||
archco)
|
archco)
|
||||||
SVNURL="svn+ssh://svn-packages@nymeria.archlinux.org/srv/repos/svn-packages/svn";;
|
SVNURL="svn+ssh://svn-packages@repos.archlinux.org/srv/repos/svn-packages/svn";;
|
||||||
communityco)
|
communityco)
|
||||||
SVNURL="svn+ssh://svn-community@nymeria.archlinux.org/srv/repos/svn-community/svn";;
|
SVNURL="svn+ssh://svn-community@repos.archlinux.org/srv/repos/svn-community/svn";;
|
||||||
*)
|
*)
|
||||||
die "Couldn't find svn url for %s" "$scriptname"
|
die "Couldn't find svn url for %s" "$scriptname"
|
||||||
;;
|
;;
|
||||||
|
37
checkpkg.in
37
checkpkg.in
@@ -29,18 +29,12 @@ STARTDIR=$(pwd)
|
|||||||
TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
||||||
|
|
||||||
for _pkgname in "${pkgname[@]}"; do
|
for _pkgname in "${pkgname[@]}"; do
|
||||||
pkgfile=(${_pkgname}-$(get_full_version $_pkgname)-${CARCH}.pkg.tar?(.?z))
|
target_pkgver=$(get_full_version "$_pkgname")
|
||||||
if (( ${#pkgfile[*]} != 1 )); then
|
if ! pkgfile=$(find_cached_package "$_pkgname" "$target_pkgver" "$CARCH"); then
|
||||||
die 'Ambiguous package name: %s\n' "${pkgfile[*]}"
|
die 'tarball not found for package: %s' "${_pkgname}-$target_pkgver"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "$STARTDIR/$pkgfile" ]]; then
|
ln -s "$pkgfile" "$TEMPDIR"
|
||||||
ln -s "$STARTDIR/$pkgfile" "$TEMPDIR/$pkgfile"
|
|
||||||
elif [[ -f "$PKGDEST/$pkgfile" ]]; then
|
|
||||||
ln -s "$PKGDEST/$pkgfile" "$TEMPDIR/$pkgfile"
|
|
||||||
else
|
|
||||||
die "File \"$pkgfile\" doesn't exist"
|
|
||||||
fi
|
|
||||||
|
|
||||||
pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$_pkgname")
|
pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$_pkgname")
|
||||||
|
|
||||||
@@ -54,29 +48,26 @@ for _pkgname in "${pkgname[@]}"; do
|
|||||||
die "The built package (%s) is the one in the repo right now!" "$_pkgname"
|
die "The built package (%s) is the one in the repo right now!" "$_pkgname"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f $oldpkg ]]; then
|
|
||||||
if [[ $pkgurl = file://* ]]; then
|
if [[ $pkgurl = file://* ]]; then
|
||||||
ln -s "${pkgurl#file://}" "${pkgurl##file://*/}"
|
ln -s "${pkgurl#file://}" "$TEMPDIR/$oldpkg"
|
||||||
elif [[ -f "$PKGDEST/$oldpkg" ]]; then
|
elif [[ -f "$PKGDEST/$oldpkg" ]]; then
|
||||||
ln -s "$PKGDEST/$oldpkg" "$oldpkg"
|
ln -s "$PKGDEST/$oldpkg" "$TEMPDIR/$oldpkg"
|
||||||
elif [[ -f "$STARTDIR/$oldpkg" ]]; then
|
elif [[ -f "$STARTDIR/$oldpkg" ]]; then
|
||||||
ln -s "$STARTDIR/$oldpkg" "$oldpkg"
|
ln -s "$STARTDIR/$oldpkg" "$TEMPDIR/$oldpkg"
|
||||||
else
|
else
|
||||||
curl -fsLC - --retry 3 --retry-delay 3 -o "$oldpkg" "$pkgurl"
|
curl -fsLC - --retry 3 --retry-delay 3 -o "$TEMPDIR/$oldpkg" "$pkgurl"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bsdtar tf "$oldpkg" | sort > "$TEMPDIR/filelist-$_pkgname-old"
|
bsdtar tf "$TEMPDIR/$oldpkg" | sort > "$TEMPDIR/filelist-$_pkgname-old"
|
||||||
bsdtar tf "$pkgfile" | sort > "$TEMPDIR/filelist-$_pkgname"
|
bsdtar tf "$pkgfile" | sort > "$TEMPDIR/filelist-$_pkgname"
|
||||||
|
|
||||||
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 -C "$TEMPDIR" xf ../"$pkgfile" #> /dev/null
|
if ! diff_output="$(sdiff -s "$TEMPDIR/libraries-$_pkgname-old" "$TEMPDIR/libraries-$_pkgname")"; then
|
||||||
diff "$TEMPDIR/filelist-$_pkgname-old" "$TEMPDIR/filelist-$_pkgname" | awk '/>.*\.so/{$1 = ""; print $0}' | while read i; do
|
msg "Sonames differ in $_pkgname!"
|
||||||
echo "${i}: " "$(objdump -p "$i" | grep SONAME)"
|
echo "$diff_output"
|
||||||
done
|
|
||||||
else
|
else
|
||||||
msg "No soname differences for $_pkgname."
|
msg "No soname differences for $_pkgname."
|
||||||
fi
|
fi
|
||||||
|
50
commitpkg.in
50
commitpkg.in
@@ -2,22 +2,6 @@
|
|||||||
|
|
||||||
m4_include(lib/common.sh)
|
m4_include(lib/common.sh)
|
||||||
|
|
||||||
getpkgfile() {
|
|
||||||
case $# in
|
|
||||||
0)
|
|
||||||
error 'No canonical package found!'
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
[!1])
|
|
||||||
error 'Failed to canonicalize package name -- multiple packages found:'
|
|
||||||
msg2 '%s' "$@"
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Source makepkg.conf; fail if it is not found
|
# Source makepkg.conf; fail if it is not found
|
||||||
if [[ -r '/etc/makepkg.conf' ]]; then
|
if [[ -r '/etc/makepkg.conf' ]]; then
|
||||||
source '/etc/makepkg.conf'
|
source '/etc/makepkg.conf'
|
||||||
@@ -55,24 +39,28 @@ case "$cmd" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# check if all local source files are under version control
|
# find files which should be under source control
|
||||||
|
needsversioning=()
|
||||||
for s in "${source[@]}"; do
|
for s in "${source[@]}"; do
|
||||||
if [[ $s != *://* ]] && ! svn status -v "$s@" | grep -q '^[ AMRX~]'; then
|
[[ $s != *://* ]] && needsversioning+=("$s")
|
||||||
die "%s is not under version control" "$s"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# check if changelog and install files are under version control
|
|
||||||
for i in 'changelog' 'install'; do
|
for i in 'changelog' 'install'; do
|
||||||
while read -r file; do
|
while read -r file; do
|
||||||
# evaluate any bash variables used
|
# evaluate any bash variables used
|
||||||
eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\"
|
eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\"
|
||||||
if ! svn status -v "${file}" | grep -q '^[ AMRX~]'; then
|
needsversioning+=("$file")
|
||||||
die "%s is not under version control" "$file"
|
|
||||||
fi
|
|
||||||
done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
|
done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# assert that they really are controlled by SVN
|
||||||
|
if (( ${#needsversioning[*]} )); then
|
||||||
|
# svn status's output is only two columns when the status is unknown
|
||||||
|
while read -r status filename; do
|
||||||
|
[[ $status = '?' ]] && unversioned+=("$filename")
|
||||||
|
done < <(svn status -v "${needsversioning[@]}")
|
||||||
|
(( ${#unversioned[*]} )) && die "%s is not under version control" "${unversioned[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y)
|
rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y)
|
||||||
archreleaseopts=()
|
archreleaseopts=()
|
||||||
while getopts ':l:a:s:f' flag; do
|
while getopts ':l:a:s:f' flag; do
|
||||||
@@ -95,9 +83,8 @@ for _arch in ${arch[@]}; do
|
|||||||
for _pkgname in ${pkgname[@]}; do
|
for _pkgname in ${pkgname[@]}; do
|
||||||
fullver=$(get_full_version $_pkgname)
|
fullver=$(get_full_version $_pkgname)
|
||||||
|
|
||||||
if pkgfile=$(shopt -s nullglob;
|
if pkgfile=$(find_cached_package "$_pkgname" "$_arch" "$fullver"); then
|
||||||
getpkgfile "${PKGDEST+$PKGDEST/}$_pkgname-$fullver-${_arch}".pkg.tar.?z); then
|
if grep -q "packager = Unknown Packager" <(bsdtar -xOqf "$pkgfile" .PKGINFO); then
|
||||||
if grep -q "packager = Unknown Packager" <(bsdtar -xOqf $pkgfile .PKGINFO); then
|
|
||||||
die "PACKAGER was not set when building package"
|
die "PACKAGER was not set when building package"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -105,7 +92,7 @@ for _arch in ${arch[@]}; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [[ -z $server ]]; then
|
if [[ -z $server ]]; then
|
||||||
server='nymeria.archlinux.org'
|
server='repos.archlinux.org'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n $(svn status -q) ]]; then
|
if [[ -n $(svn status -q) ]]; then
|
||||||
@@ -147,8 +134,7 @@ for _arch in ${arch[@]}; do
|
|||||||
for _pkgname in ${pkgname[@]}; do
|
for _pkgname in ${pkgname[@]}; do
|
||||||
fullver=$(get_full_version $_pkgname)
|
fullver=$(get_full_version $_pkgname)
|
||||||
|
|
||||||
if ! pkgfile=$(shopt -s nullglob;
|
if ! pkgfile=$(find_cached_package "$_pkgname" "$fullver" "${_arch}"); then
|
||||||
getpkgfile "${PKGDEST+$PKGDEST/}$_pkgname-$fullver-${_arch}".pkg.tar.?z); then
|
|
||||||
warning "Skipping $_pkgname-$fullver-$_arch: failed to locate package file"
|
warning "Skipping $_pkgname-$fullver-$_arch: failed to locate package file"
|
||||||
skip_arches+=($_arch)
|
skip_arches+=($_arch)
|
||||||
continue 2
|
continue 2
|
||||||
@@ -161,7 +147,7 @@ for _arch in ${arch[@]}; do
|
|||||||
if [[ -n $GPGKEY ]]; then
|
if [[ -n $GPGKEY ]]; then
|
||||||
SIGNWITHKEY="-u ${GPGKEY}"
|
SIGNWITHKEY="-u ${GPGKEY}"
|
||||||
fi
|
fi
|
||||||
gpg --detach-sign --use-agent ${SIGNWITHKEY} "${pkgfile}" || die
|
gpg --detach-sign --use-agent --no-armor ${SIGNWITHKEY} "${pkgfile}" || die
|
||||||
fi
|
fi
|
||||||
if ! gpg --verify "$sigfile" >/dev/null 2>&1; then
|
if ! gpg --verify "$sigfile" >/dev/null 2>&1; then
|
||||||
die "Signature %s.sig is incorrect!" "$pkgfile"
|
die "Signature %s.sig is incorrect!" "$pkgfile"
|
||||||
|
@@ -29,7 +29,7 @@ case $scriptname in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
server='nymeria.archlinux.org'
|
server='repos.archlinux.org'
|
||||||
source_svn="svn+ssh://svn-${source_name}@${server}/srv/repos/svn-${source_name}/svn"
|
source_svn="svn+ssh://svn-${source_name}@${server}/srv/repos/svn-${source_name}/svn"
|
||||||
target_svn="svn+ssh://svn-${target_name}@${server}/srv/repos/svn-${target_name}/svn"
|
target_svn="svn+ssh://svn-${target_name}@${server}/srv/repos/svn-${target_name}/svn"
|
||||||
source_dbscripts="/srv/repos/svn-${source_name}/dbscripts"
|
source_dbscripts="/srv/repos/svn-${source_name}/dbscripts"
|
||||||
|
@@ -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
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
# Avoid any encoding problems
|
# Avoid any encoding problems
|
||||||
export LANG=C
|
export LANG=C
|
||||||
|
|
||||||
|
shopt -s extglob
|
||||||
|
|
||||||
# check if messages are to be printed using color
|
# check if messages are to be printed using color
|
||||||
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
||||||
if [[ -t 2 ]]; then
|
if [[ -t 2 ]]; then
|
||||||
@@ -63,12 +65,12 @@ setup_workdir() {
|
|||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
[[ -n $WORKDIR ]] && rm -rf "$WORKDIR"
|
[[ -n $WORKDIR ]] && rm -rf "$WORKDIR"
|
||||||
[[ $1 ]] && exit $1
|
exit ${1:-0}
|
||||||
}
|
}
|
||||||
|
|
||||||
abort() {
|
abort() {
|
||||||
msg 'Aborting...'
|
error 'Aborting...'
|
||||||
cleanup 0
|
cleanup 255
|
||||||
}
|
}
|
||||||
|
|
||||||
trap_abort() {
|
trap_abort() {
|
||||||
@@ -77,13 +79,14 @@ 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() {
|
||||||
(( $# )) && error "$@"
|
(( $# )) && error "$@"
|
||||||
cleanup 1
|
cleanup 255
|
||||||
}
|
}
|
||||||
|
|
||||||
trap 'trap_abort' INT QUIT TERM HUP
|
trap 'trap_abort' INT QUIT TERM HUP
|
||||||
@@ -112,7 +115,7 @@ get_full_version() {
|
|||||||
pkgbase=${pkgbase:-${pkgname[0]}}
|
pkgbase=${pkgbase:-${pkgname[0]}}
|
||||||
epoch=${epoch:-0}
|
epoch=${epoch:-0}
|
||||||
if [[ -z $1 ]]; then
|
if [[ -z $1 ]]; then
|
||||||
if [[ $epoch ]] && (( ! $epoch )); then
|
if (( ! epoch )); then
|
||||||
echo $pkgver-$pkgrel
|
echo $pkgver-$pkgrel
|
||||||
else
|
else
|
||||||
echo $epoch:$pkgver-$pkgrel
|
echo $epoch:$pkgver-$pkgrel
|
||||||
@@ -154,3 +157,85 @@ slock() {
|
|||||||
stat_done
|
stat_done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# usage: pkgver_equal( $pkgver1, $pkgver2 )
|
||||||
|
##
|
||||||
|
pkgver_equal() {
|
||||||
|
if [[ $1 = *-* && $2 = *-* ]]; then
|
||||||
|
# if both versions have a pkgrel, then they must be an exact match
|
||||||
|
[[ $1 = "$2" ]]
|
||||||
|
else
|
||||||
|
# otherwise, trim any pkgrel and compare the bare version.
|
||||||
|
[[ ${1%%-*} = "${2%%-*}" ]]
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# usage: find_cached_package( $pkgname, $pkgver, $arch )
|
||||||
|
#
|
||||||
|
# $pkgver can be supplied with or without a pkgrel appended.
|
||||||
|
# If not supplied, any pkgrel will be matched.
|
||||||
|
##
|
||||||
|
find_cached_package() {
|
||||||
|
local searchdirs=("$PWD" "$PKGDEST") results=()
|
||||||
|
local targetname=$1 targetver=$2 targetarch=$3
|
||||||
|
local dir pkg pkgbasename name ver rel arch r results
|
||||||
|
|
||||||
|
for dir in "${searchdirs[@]}"; do
|
||||||
|
[[ -d $dir ]] || continue
|
||||||
|
|
||||||
|
for pkg in "$dir"/*.pkg.tar?(.?z); do
|
||||||
|
[[ -f $pkg ]] || continue
|
||||||
|
|
||||||
|
# avoid adding duplicates of the same inode
|
||||||
|
for r in "${results[@]}"; do
|
||||||
|
[[ $r -ef $pkg ]] && continue 2
|
||||||
|
done
|
||||||
|
|
||||||
|
# split apart package filename into parts
|
||||||
|
pkgbasename=${pkg##*/}
|
||||||
|
pkgbasename=${pkgbasename%.pkg.tar?(.?z)}
|
||||||
|
|
||||||
|
arch=${pkgbasename##*-}
|
||||||
|
pkgbasename=${pkgbasename%-"$arch"}
|
||||||
|
|
||||||
|
rel=${pkgbasename##*-}
|
||||||
|
pkgbasename=${pkgbasename%-"$rel"}
|
||||||
|
|
||||||
|
ver=${pkgbasename##*-}
|
||||||
|
name=${pkgbasename%-"$ver"}
|
||||||
|
|
||||||
|
if [[ $targetname = "$name" && $targetarch = "$arch" ]] &&
|
||||||
|
pkgver_equal "$targetver" "$ver-$rel"; then
|
||||||
|
results+=("$pkg")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
case ${#results[*]} in
|
||||||
|
0)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
1)
|
||||||
|
printf '%s\n' "$results"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error 'Multiple packages found:'
|
||||||
|
printf '\t%s\n' "${results[@]}" >&2
|
||||||
|
return 1
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# usage : check_root ("$0" "$@")
|
||||||
|
##
|
||||||
|
check_root() {
|
||||||
|
(( EUID == 0 )) && return
|
||||||
|
if type -P sudo >/dev/null; then
|
||||||
|
exec sudo -- "$@"
|
||||||
|
else
|
||||||
|
exec su root -c "$(printf ' %q' "$@")"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
310
makechrootpkg.in
310
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
|
||||||
@@ -35,8 +35,8 @@ src_owner=${SUDO_USER:-$USER}
|
|||||||
usage() {
|
usage() {
|
||||||
echo "Usage: ${0##*/} [options] -r <chrootdir> [--] [makepkg args]"
|
echo "Usage: ${0##*/} [options] -r <chrootdir> [--] [makepkg args]"
|
||||||
echo ' Run this script in a PKGBUILD dir to build a package inside a'
|
echo ' Run this script in a PKGBUILD dir to build a package inside a'
|
||||||
echo ' clean chroot. All unrecognized arguments passed to this script'
|
echo ' clean chroot. Arguments passed to this script after the'
|
||||||
echo ' will be passed to makepkg.'
|
echo ' end-of-options marker (--) will be passed to makepkg.'
|
||||||
echo ''
|
echo ''
|
||||||
echo ' The chroot dir consists of the following directories:'
|
echo ' The chroot dir consists of the following directories:'
|
||||||
echo ' <chrootdir>/{root, copy} but only "root" is required'
|
echo ' <chrootdir>/{root, copy} but only "root" is required'
|
||||||
@@ -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,64 +66,13 @@ 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+="-$$" ;;
|
|
||||||
*) makepkg_args="$makepkg_args -$arg $OPTARG" ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
(( EUID != 0 )) && die 'This script must be run as root.'
|
|
||||||
|
|
||||||
[[ ! -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
|
|
||||||
if [[ $arg = -R ]]; then
|
|
||||||
repack=true
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
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
|
||||||
|
|
||||||
[[ -f $makepkg_conf ]] || return 1
|
[[ -f $makepkg_conf ]] || return 1
|
||||||
|
|
||||||
for var in {SRC,PKG,LOG}DEST MAKEFLAGS PACKAGER; do
|
for var in {SRC,SRCPKG,PKG,LOG}DEST MAKEFLAGS PACKAGER; do
|
||||||
[[ -z ${!var} ]] && eval $(grep "^${var}=" "$makepkg_conf")
|
[[ -z ${!var} ]] && eval $(grep "^${var}=" "$makepkg_conf")
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -140,7 +89,7 @@ create_chroot() {
|
|||||||
slock 8 "$chrootdir/root.lock" "Locking clean chroot"
|
slock 8 "$chrootdir/root.lock" "Locking clean chroot"
|
||||||
|
|
||||||
stat_busy "Creating clean working copy [$copy]"
|
stat_busy "Creating clean working copy [$copy]"
|
||||||
if [[ "$chroottype" == btrfs ]]; then
|
if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then
|
||||||
if [[ -d $copydir ]]; then
|
if [[ -d $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"
|
||||||
@@ -156,11 +105,14 @@ create_chroot() {
|
|||||||
# Drop the read lock again
|
# Drop the read lock again
|
||||||
exec 8>&-
|
exec 8>&-
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Update mtime
|
||||||
|
touch "$copydir"
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
@@ -175,19 +127,16 @@ clean_temporary() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_packages() {
|
install_packages() {
|
||||||
local pkgname
|
local -a pkgnames
|
||||||
|
local ret
|
||||||
|
|
||||||
for install_pkg in "${install_pkgs[@]}"; do
|
pkgnames=("${install_pkgs[@]##*/}")
|
||||||
pkgname="${install_pkg##*/}"
|
|
||||||
cp "$install_pkg" "$copydir/$pkgname"
|
|
||||||
|
|
||||||
arch-nspawn "$copydir" \
|
cp -- "${install_pkgs[@]}" "$copydir/root/"
|
||||||
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
arch-nspawn "$copydir" "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
||||||
pacman -U /$pkgname --noconfirm
|
pacman -U --noconfirm -- "${pkgnames[@]/#//root/}"
|
||||||
(( ret += !! $? ))
|
ret=$?
|
||||||
|
rm -- "${pkgnames[@]/#/$copydir/root/}"
|
||||||
rm "$copydir/$pkgname"
|
|
||||||
done
|
|
||||||
|
|
||||||
# If there is no PKGBUILD we are done
|
# If there is no PKGBUILD we are done
|
||||||
[[ -f PKGBUILD ]] || exit $ret
|
[[ -f PKGBUILD ]] || exit $ret
|
||||||
@@ -196,62 +145,70 @@ install_packages() {
|
|||||||
prepare_chroot() {
|
prepare_chroot() {
|
||||||
$repack || rm -rf "$copydir/build"
|
$repack || rm -rf "$copydir/build"
|
||||||
|
|
||||||
mkdir -p "$copydir/build"
|
local builduser_uid="${SUDO_UID:-$UID}"
|
||||||
if ! grep -q 'BUILDDIR="/build"' "$copydir/etc/makepkg.conf"; then
|
local builduser_gid="$(id -g "$builduser_uid")"
|
||||||
echo 'BUILDDIR="/build"' >> "$copydir/etc/makepkg.conf"
|
local install="install -o $builduser_uid -g $builduser_gid"
|
||||||
fi
|
local x
|
||||||
|
|
||||||
# Read .makepkg.conf and .gnupg/pubring.gpg even if called via sudo
|
# We can't use useradd without chrooting, otherwise it invokes PAM modules
|
||||||
if [[ -r "$USER_HOME/.gnupg/pubring.gpg" ]]; then
|
# which we might not be able to load (i.e. when building i686 packages on
|
||||||
install -D "$USER_HOME/.gnupg/pubring.gpg" \
|
# an x86_64 host).
|
||||||
"$copydir/build/.gnupg/pubring.gpg"
|
sed -e '/^builduser:/d' -i "$copydir"/etc/{passwd,group}
|
||||||
fi
|
printf >>"$copydir/etc/group" 'builduser:x:%d:\n' $builduser_gid
|
||||||
|
printf >>"$copydir/etc/passwd" 'builduser:x:%d:%d:builduser:/build:/bin/bash\n' $builduser_uid $builduser_gid
|
||||||
|
|
||||||
mkdir -p "$copydir/pkgdest"
|
$install -d "$copydir"/{build,build/.gnupg,startdir,{pkg,srcpkg,src,log}dest}
|
||||||
if ! grep -q 'PKGDEST="/pkgdest"' "$copydir/etc/makepkg.conf"; then
|
|
||||||
echo 'PKGDEST="/pkgdest"' >> "$copydir/etc/makepkg.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p "$copydir/logdest"
|
for x in .gnupg/pubring.{kbx,gpg}; do
|
||||||
if ! grep -q 'LOGDEST="/logdest"' "$copydir/etc/makepkg.conf"; then
|
[[ -r $USER_HOME/$x ]] || continue
|
||||||
echo 'LOGDEST="/logdest"' >> "$copydir/etc/makepkg.conf"
|
$install -m 644 "$USER_HOME/$x" "$copydir/build/$x"
|
||||||
fi
|
done
|
||||||
|
|
||||||
# These two get bind-mounted read-only
|
sed -e '/^MAKEFLAGS=/d' -e '/^PACKAGER=/d' -i "$copydir/etc/makepkg.conf"
|
||||||
# XXX: makepkg dislikes having these dirs read-only, so separate them
|
for x in BUILDDIR=/build PKGDEST=/pkgdest SRCPKGDEST=/srcpkgdest SRCDEST=/srcdest LOGDEST=/logdest \
|
||||||
mkdir -p "$copydir/startdir" "$copydir/startdir_host"
|
"MAKEFLAGS='$MAKEFLAGS'" "PACKAGER='$PACKAGER'"
|
||||||
mkdir -p "$copydir/srcdest" "$copydir/srcdest_host"
|
do
|
||||||
if ! grep -q 'SRCDEST="/srcdest"' "$copydir/etc/makepkg.conf"; then
|
grep -q "^$x" "$copydir/etc/makepkg.conf" && continue
|
||||||
echo 'SRCDEST="/srcdest"' >> "$copydir/etc/makepkg.conf"
|
echo "$x" >>"$copydir/etc/makepkg.conf"
|
||||||
fi
|
done
|
||||||
|
|
||||||
chown -R nobody "$copydir"/{build,pkgdest,logdest,srcdest,startdir}
|
cat > "$copydir/etc/sudoers.d/builduser-pacman" <<EOF
|
||||||
|
builduser ALL = NOPASSWD: /usr/bin/pacman
|
||||||
if [[ -n $MAKEFLAGS ]]; then
|
|
||||||
sed -i '/^MAKEFLAGS=/d' "$copydir/etc/makepkg.conf"
|
|
||||||
echo "MAKEFLAGS='${MAKEFLAGS}'" >> "$copydir/etc/makepkg.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n $PACKAGER ]]; then
|
|
||||||
sed -i '/^PACKAGER=/d' "$copydir/etc/makepkg.conf"
|
|
||||||
echo "PACKAGER='${PACKAGER}'" >> "$copydir/etc/makepkg.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -f $copydir/etc/sudoers.d/nobody-pacman ]]; then
|
|
||||||
cat > "$copydir/etc/sudoers.d/nobody-pacman" <<EOF
|
|
||||||
Defaults env_keep += "HOME"
|
|
||||||
nobody ALL = NOPASSWD: /usr/bin/pacman
|
|
||||||
EOF
|
EOF
|
||||||
chmod 440 "$copydir/etc/sudoers.d/nobody-pacman"
|
chmod 440 "$copydir/etc/sudoers.d/builduser-pacman"
|
||||||
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
|
||||||
|
declare -f _chrootnamcap
|
||||||
|
printf '_chrootnamcap || exit\n'
|
||||||
|
fi
|
||||||
|
} >"$copydir/chrootbuild"
|
||||||
chmod +x "$copydir/chrootbuild"
|
chmod +x "$copydir/chrootbuild"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# These functions aren't run in makechrootpkg,
|
||||||
|
# so no global variables
|
||||||
|
_chrootbuild() {
|
||||||
|
. /etc/profile
|
||||||
|
sudo -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
_chrootnamcap() {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
download_sources() {
|
download_sources() {
|
||||||
local builddir="$(mktemp -d)"
|
local builddir="$(mktemp -d)"
|
||||||
chmod 1777 "$builddir"
|
chmod 1777 "$builddir"
|
||||||
@@ -271,78 +228,93 @@ download_sources() {
|
|||||||
rm -rf $builddir
|
rm -rf $builddir
|
||||||
}
|
}
|
||||||
|
|
||||||
_chrootbuild() {
|
|
||||||
# This function isn't run in makechrootpkg,
|
|
||||||
# so no global variables
|
|
||||||
local makepkg_args="$1"
|
|
||||||
local run_namcap="$2"
|
|
||||||
|
|
||||||
. /etc/profile
|
|
||||||
export HOME=/build
|
|
||||||
shopt -s nullglob
|
|
||||||
|
|
||||||
# XXX: Workaround makepkg disliking read-only dirs
|
|
||||||
ln -sft /srcdest /srcdest_host/*
|
|
||||||
ln -sft /startdir /startdir_host/*
|
|
||||||
|
|
||||||
# XXX: Keep svn sources writable
|
|
||||||
# Since makepkg 4.1.1 they get checked out via cp -a, copying the symlink
|
|
||||||
for dir in /srcdest /startdir; do
|
|
||||||
cd $dir
|
|
||||||
for svndir in */.svn; do
|
|
||||||
rm ${svndir%/.svn}
|
|
||||||
cp -a ${dir}_host/${svndir%/.svn} .
|
|
||||||
chown -R nobody ${svndir%/.svn}
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
cd /startdir
|
|
||||||
|
|
||||||
# XXX: Keep PKGBUILD writable for pkgver()
|
|
||||||
rm PKGBUILD*
|
|
||||||
cp /startdir_host/PKGBUILD* .
|
|
||||||
chown nobody PKGBUILD*
|
|
||||||
|
|
||||||
# Safety check
|
|
||||||
if [[ ! -w PKGBUILD ]]; then
|
|
||||||
echo "Can't write to PKGBUILD!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo -u nobody makepkg $makepkg_args || exit 1
|
|
||||||
|
|
||||||
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() {
|
||||||
for pkgfile in "$copydir"/pkgdest/*; do
|
for pkgfile in "$copydir"/pkgdest/*; do
|
||||||
chown "$src_owner" "$pkgfile"
|
chown "$src_owner" "$pkgfile"
|
||||||
mv "$pkgfile" "$PKGDEST"
|
mv "$pkgfile" "$PKGDEST"
|
||||||
|
|
||||||
|
# Fix broken symlink because of temporary chroot PKGDEST /pkgdest
|
||||||
|
if [[ "$PWD" != "$PKGDEST" && -L "$PWD/${pkgfile##*/}" ]]; then
|
||||||
|
ln -sf "$PKGDEST/${pkgfile##*/}"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for l in "$copydir"/logdest/*; do
|
for l in "$copydir"/logdest/*; do
|
||||||
|
[[ $l == */logpipe.* ]] && continue
|
||||||
chown "$src_owner" "$l"
|
chown "$src_owner" "$l"
|
||||||
mv "$l" "$LOGDEST"
|
mv "$l" "$LOGDEST"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
for s in "$copydir"/srcpkgdest/*; do
|
||||||
|
chown "$src_owner" "$s"
|
||||||
|
mv "$s" "$SRCPKGDEST"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
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 "${XDG_CONFIG_HOME:-$USER_HOME/.config}/pacman/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
|
||||||
load_vars /etc/makepkg.conf
|
load_vars /etc/makepkg.conf
|
||||||
|
|
||||||
# Use PKGBUILD directory if these don't exist
|
# Use PKGBUILD directory if these don't exist
|
||||||
[[ -d $PKGDEST ]] || PKGDEST=$PWD
|
[[ -d $PKGDEST ]] || PKGDEST=$PWD
|
||||||
[[ -d $SRCDEST ]] || SRCDEST=$PWD
|
[[ -d $SRCDEST ]] || SRCDEST=$PWD
|
||||||
|
[[ -d $SRCPKGDEST ]] || SRCPKGDEST=$PWD
|
||||||
[[ -d $LOGDEST ]] || LOGDEST=$PWD
|
[[ -d $LOGDEST ]] || LOGDEST=$PWD
|
||||||
|
|
||||||
create_chroot
|
create_chroot
|
||||||
@@ -353,13 +325,13 @@ $update_first && arch-nspawn "$copydir" \
|
|||||||
|
|
||||||
[[ -n ${install_pkgs[*]} ]] && install_packages
|
[[ -n ${install_pkgs[*]} ]] && install_packages
|
||||||
|
|
||||||
prepare_chroot
|
|
||||||
|
|
||||||
download_sources
|
download_sources
|
||||||
|
|
||||||
|
prepare_chroot
|
||||||
|
|
||||||
if arch-nspawn "$copydir" \
|
if arch-nspawn "$copydir" \
|
||||||
--bind-ro="$PWD:/startdir_host" \
|
--bind="$PWD:/startdir" \
|
||||||
--bind-ro="$SRCDEST:/srcdest_host" \
|
--bind="$SRCDEST:/srcdest" \
|
||||||
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
||||||
/chrootbuild
|
/chrootbuild
|
||||||
then
|
then
|
||||||
|
@@ -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 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
|
||||||
#########################################################################
|
#########################################################################
|
||||||
@@ -30,8 +37,8 @@ CHOST="i686-pc-linux-gnu"
|
|||||||
# -march (or -mcpu) builds exclusively for an architecture
|
# -march (or -mcpu) builds exclusively for an architecture
|
||||||
# -mtune optimizes for an architecture, but builds for whole processor family
|
# -mtune optimizes for an architecture, but builds for whole processor family
|
||||||
CPPFLAGS="-D_FORTIFY_SOURCE=2"
|
CPPFLAGS="-D_FORTIFY_SOURCE=2"
|
||||||
CFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
|
CFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong"
|
||||||
CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
|
CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector-strong"
|
||||||
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
|
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
|
||||||
#-- Make Flags: change this for DistCC/SMP systems
|
#-- Make Flags: change this for DistCC/SMP systems
|
||||||
#MAKEFLAGS="-j2"
|
#MAKEFLAGS="-j2"
|
||||||
@@ -43,17 +50,16 @@ DEBUG_CXXFLAGS="-g -fvar-tracking-assignments"
|
|||||||
# BUILD ENVIRONMENT
|
# BUILD ENVIRONMENT
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Defaults: BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
# Defaults: BUILDENV=(!distcc color !ccache check !sign)
|
||||||
# A negated environment option will do the opposite of the comments below.
|
# A negated environment option will do the opposite of the comments below.
|
||||||
#
|
#
|
||||||
#-- fakeroot: Allow building packages as a non-root user
|
|
||||||
#-- distcc: Use the Distributed C/C++/ObjC compiler
|
#-- distcc: Use the Distributed C/C++/ObjC compiler
|
||||||
#-- color: Colorize output messages
|
#-- color: Colorize output messages
|
||||||
#-- ccache: Use ccache to cache compilation
|
#-- ccache: Use ccache to cache compilation
|
||||||
#-- check: Run the check() function if present in the PKGBUILD
|
#-- check: Run the check() function if present in the PKGBUILD
|
||||||
#-- sign: Generate PGP signature file
|
#-- sign: Generate PGP signature file
|
||||||
#
|
#
|
||||||
BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
BUILDENV=(!distcc color !ccache check !sign)
|
||||||
#
|
#
|
||||||
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
|
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
|
||||||
#-- specify a space-delimited list of hosts running in the DistCC cluster.
|
#-- specify a space-delimited list of hosts running in the DistCC cluster.
|
||||||
@@ -67,7 +73,7 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
|||||||
# These are default values for the options=() settings
|
# These are default values for the options=() settings
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Default: OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug)
|
# Default: OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !optipng !upx !debug)
|
||||||
# A negated option will do the opposite of the comments below.
|
# A negated option will do the opposite of the comments below.
|
||||||
#
|
#
|
||||||
#-- strip: Strip symbols from binaries/libraries
|
#-- strip: Strip symbols from binaries/libraries
|
||||||
@@ -78,9 +84,10 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
|||||||
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
|
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
|
||||||
#-- purge: Remove files specified by PURGE_TARGETS
|
#-- purge: Remove files specified by PURGE_TARGETS
|
||||||
#-- upx: Compress binary executable files using UPX
|
#-- upx: Compress binary executable files using UPX
|
||||||
|
#-- optipng: Optimize PNG images with optipng
|
||||||
#-- debug: Add debugging flags as specified in DEBUG_* variables
|
#-- debug: Add debugging flags as specified in DEBUG_* variables
|
||||||
#
|
#
|
||||||
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug)
|
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !optipng !upx !debug)
|
||||||
|
|
||||||
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
||||||
INTEGRITY_CHECK=(md5)
|
INTEGRITY_CHECK=(md5)
|
||||||
|
@@ -19,19 +19,26 @@ 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 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
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
CARCH="x86_64"
|
CARCH="x86_64"
|
||||||
CHOST="x86_64-unknown-linux-gnu"
|
CHOST="x86_64-pc-linux-gnu"
|
||||||
|
|
||||||
#-- Compiler and Linker Flags
|
#-- Compiler and Linker Flags
|
||||||
# -march (or -mcpu) builds exclusively for an architecture
|
# -march (or -mcpu) builds exclusively for an architecture
|
||||||
# -mtune optimizes for an architecture, but builds for whole processor family
|
# -mtune optimizes for an architecture, but builds for whole processor family
|
||||||
CPPFLAGS="-D_FORTIFY_SOURCE=2"
|
CPPFLAGS="-D_FORTIFY_SOURCE=2"
|
||||||
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
|
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong"
|
||||||
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
|
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong"
|
||||||
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
|
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
|
||||||
#-- Make Flags: change this for DistCC/SMP systems
|
#-- Make Flags: change this for DistCC/SMP systems
|
||||||
#MAKEFLAGS="-j2"
|
#MAKEFLAGS="-j2"
|
||||||
@@ -43,17 +50,16 @@ DEBUG_CXXFLAGS="-g -fvar-tracking-assignments"
|
|||||||
# BUILD ENVIRONMENT
|
# BUILD ENVIRONMENT
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Defaults: BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
# Defaults: BUILDENV=(!distcc color !ccache check !sign)
|
||||||
# A negated environment option will do the opposite of the comments below.
|
# A negated environment option will do the opposite of the comments below.
|
||||||
#
|
#
|
||||||
#-- fakeroot: Allow building packages as a non-root user
|
|
||||||
#-- distcc: Use the Distributed C/C++/ObjC compiler
|
#-- distcc: Use the Distributed C/C++/ObjC compiler
|
||||||
#-- color: Colorize output messages
|
#-- color: Colorize output messages
|
||||||
#-- ccache: Use ccache to cache compilation
|
#-- ccache: Use ccache to cache compilation
|
||||||
#-- check: Run the check() function if present in the PKGBUILD
|
#-- check: Run the check() function if present in the PKGBUILD
|
||||||
#-- sign: Generate PGP signature file
|
#-- sign: Generate PGP signature file
|
||||||
#
|
#
|
||||||
BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
BUILDENV=(!distcc color !ccache check !sign)
|
||||||
#
|
#
|
||||||
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
|
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
|
||||||
#-- specify a space-delimited list of hosts running in the DistCC cluster.
|
#-- specify a space-delimited list of hosts running in the DistCC cluster.
|
||||||
@@ -67,7 +73,7 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
|||||||
# These are default values for the options=() settings
|
# These are default values for the options=() settings
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Default: OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug)
|
# Default: OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !optipng !upx !debug)
|
||||||
# A negated option will do the opposite of the comments below.
|
# A negated option will do the opposite of the comments below.
|
||||||
#
|
#
|
||||||
#-- strip: Strip symbols from binaries/libraries
|
#-- strip: Strip symbols from binaries/libraries
|
||||||
@@ -78,9 +84,10 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
|||||||
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
|
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
|
||||||
#-- purge: Remove files specified by PURGE_TARGETS
|
#-- purge: Remove files specified by PURGE_TARGETS
|
||||||
#-- upx: Compress binary executable files using UPX
|
#-- upx: Compress binary executable files using UPX
|
||||||
|
#-- optipng: Optimize PNG images with optipng
|
||||||
#-- debug: Add debugging flags as specified in DEBUG_* variables
|
#-- debug: Add debugging flags as specified in DEBUG_* variables
|
||||||
#
|
#
|
||||||
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug)
|
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !optipng !upx !debug)
|
||||||
|
|
||||||
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
||||||
INTEGRITY_CHECK=(md5)
|
INTEGRITY_CHECK=(md5)
|
||||||
|
@@ -10,12 +10,12 @@
|
|||||||
|
|
||||||
m4_include(lib/common.sh)
|
m4_include(lib/common.sh)
|
||||||
|
|
||||||
CHROOT_VERSION='v3'
|
CHROOT_VERSION='v4'
|
||||||
|
|
||||||
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" ;;
|
||||||
@@ -35,9 +37,10 @@ while getopts 'hC:M:c:' arg; do
|
|||||||
done
|
done
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
(( $EUID != 0 )) && die 'This script must be run as root.'
|
|
||||||
(( $# < 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" "${orig_argv[@]}"
|
||||||
|
|
||||||
working_dir="$(readlink -f $1)"
|
working_dir="$(readlink -f $1)"
|
||||||
shift 1
|
shift 1
|
||||||
|
|
||||||
@@ -69,9 +72,11 @@ pacstrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \
|
|||||||
"${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages'
|
"${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages'
|
||||||
|
|
||||||
printf '%s.UTF-8 UTF-8\n' en_US de_DE > "$working_dir/etc/locale.gen"
|
printf '%s.UTF-8 UTF-8\n' en_US de_DE > "$working_dir/etc/locale.gen"
|
||||||
echo 'LANG=C' > "$working_dir/etc/locale.conf"
|
echo 'LANG=en_US.UTF-8' > "$working_dir/etc/locale.conf"
|
||||||
echo "$CHROOT_VERSION" > "$working_dir/.arch-chroot"
|
echo "$CHROOT_VERSION" > "$working_dir/.arch-chroot"
|
||||||
|
|
||||||
|
systemd-machine-id-setup --root="$working_dir"
|
||||||
|
|
||||||
exec arch-nspawn \
|
exec arch-nspawn \
|
||||||
${pac_conf:+-C "$pac_conf"} \
|
${pac_conf:+-C "$pac_conf"} \
|
||||||
${makepkg_conf:+-M "$makepkg_conf"} \
|
${makepkg_conf:+-M "$makepkg_conf"} \
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#CacheDir = /var/cache/pacman/pkg/
|
#CacheDir = /var/cache/pacman/pkg/
|
||||||
#LogFile = /var/log/pacman.log
|
#LogFile = /var/log/pacman.log
|
||||||
#GPGDir = /etc/pacman.d/gnupg/
|
#GPGDir = /etc/pacman.d/gnupg/
|
||||||
|
#HookDir = /etc/pacman.d/hooks/
|
||||||
HoldPkg = pacman glibc
|
HoldPkg = pacman glibc
|
||||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#CacheDir = /var/cache/pacman/pkg/
|
#CacheDir = /var/cache/pacman/pkg/
|
||||||
#LogFile = /var/log/pacman.log
|
#LogFile = /var/log/pacman.log
|
||||||
#GPGDir = /etc/pacman.d/gnupg/
|
#GPGDir = /etc/pacman.d/gnupg/
|
||||||
|
#HookDir = /etc/pacman.d/hooks/
|
||||||
HoldPkg = pacman glibc
|
HoldPkg = pacman glibc
|
||||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||||
@@ -72,6 +73,9 @@ LocalFileSigLevel = Optional
|
|||||||
[gnome-unstable]
|
[gnome-unstable]
|
||||||
Include = /etc/pacman.d/mirrorlist
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
[staging]
|
||||||
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
[testing]
|
[testing]
|
||||||
Include = /etc/pacman.d/mirrorlist
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
@@ -81,6 +85,9 @@ Include = /etc/pacman.d/mirrorlist
|
|||||||
[extra]
|
[extra]
|
||||||
Include = /etc/pacman.d/mirrorlist
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
[community-staging]
|
||||||
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
[community-testing]
|
[community-testing]
|
||||||
Include = /etc/pacman.d/mirrorlist
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#CacheDir = /var/cache/pacman/pkg/
|
#CacheDir = /var/cache/pacman/pkg/
|
||||||
#LogFile = /var/log/pacman.log
|
#LogFile = /var/log/pacman.log
|
||||||
#GPGDir = /etc/pacman.d/gnupg/
|
#GPGDir = /etc/pacman.d/gnupg/
|
||||||
|
#HookDir = /etc/pacman.d/hooks/
|
||||||
HoldPkg = pacman glibc
|
HoldPkg = pacman glibc
|
||||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#CacheDir = /var/cache/pacman/pkg/
|
#CacheDir = /var/cache/pacman/pkg/
|
||||||
#LogFile = /var/log/pacman.log
|
#LogFile = /var/log/pacman.log
|
||||||
#GPGDir = /etc/pacman.d/gnupg/
|
#GPGDir = /etc/pacman.d/gnupg/
|
||||||
|
#HookDir = /etc/pacman.d/hooks/
|
||||||
HoldPkg = pacman glibc
|
HoldPkg = pacman glibc
|
||||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#CacheDir = /var/cache/pacman/pkg/
|
#CacheDir = /var/cache/pacman/pkg/
|
||||||
#LogFile = /var/log/pacman.log
|
#LogFile = /var/log/pacman.log
|
||||||
#GPGDir = /etc/pacman.d/gnupg/
|
#GPGDir = /etc/pacman.d/gnupg/
|
||||||
|
#HookDir = /etc/pacman.d/hooks/
|
||||||
HoldPkg = pacman glibc
|
HoldPkg = pacman glibc
|
||||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#CacheDir = /var/cache/pacman/pkg/
|
#CacheDir = /var/cache/pacman/pkg/
|
||||||
#LogFile = /var/log/pacman.log
|
#LogFile = /var/log/pacman.log
|
||||||
#GPGDir = /etc/pacman.d/gnupg/
|
#GPGDir = /etc/pacman.d/gnupg/
|
||||||
|
#HookDir = /etc/pacman.d/hooks/
|
||||||
HoldPkg = pacman glibc
|
HoldPkg = pacman glibc
|
||||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#CacheDir = /var/cache/pacman/pkg/
|
#CacheDir = /var/cache/pacman/pkg/
|
||||||
#LogFile = /var/log/pacman.log
|
#LogFile = /var/log/pacman.log
|
||||||
#GPGDir = /etc/pacman.d/gnupg/
|
#GPGDir = /etc/pacman.d/gnupg/
|
||||||
|
#HookDir = /etc/pacman.d/hooks/
|
||||||
HoldPkg = pacman glibc
|
HoldPkg = pacman glibc
|
||||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#CacheDir = /var/cache/pacman/pkg/
|
#CacheDir = /var/cache/pacman/pkg/
|
||||||
#LogFile = /var/log/pacman.log
|
#LogFile = /var/log/pacman.log
|
||||||
#GPGDir = /etc/pacman.d/gnupg/
|
#GPGDir = /etc/pacman.d/gnupg/
|
||||||
|
#HookDir = /etc/pacman.d/hooks/
|
||||||
HoldPkg = pacman glibc
|
HoldPkg = pacman glibc
|
||||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||||
|
@@ -47,7 +47,7 @@ pkg_from_pkgbuild() {
|
|||||||
chrootdir="$1"; shift
|
chrootdir="$1"; shift
|
||||||
pkgs="$@"
|
pkgs="$@"
|
||||||
|
|
||||||
SVNPATH='svn+ssh://nymeria.archlinux.org/srv/repos/svn-packages/svn'
|
SVNPATH='svn+ssh://repos.archlinux.org/srv/repos/svn-packages/svn'
|
||||||
|
|
||||||
msg "Work will be done in $(pwd)/rebuilds"
|
msg "Work will be done in $(pwd)/rebuilds"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user