forked from artix/artools
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
8cc8b66e7f | |||
0ae8c16801 | |||
bb674109ed |
@@ -21,6 +21,8 @@ load_config "${USERCONFDIR}/artools/artools.conf" || load_config "${SYSCONFDIR}/
|
|||||||
|
|
||||||
create_first=false
|
create_first=false
|
||||||
rebuild=false
|
rebuild=false
|
||||||
|
no_check=false
|
||||||
|
is_checkpkg=false
|
||||||
|
|
||||||
mkchrootpkg_args=(-c -n)
|
mkchrootpkg_args=(-c -n)
|
||||||
|
|
||||||
@@ -33,6 +35,8 @@ usage() {
|
|||||||
echo " -r <dir> Create chroots in this directory"
|
echo " -r <dir> Create chroots in this directory"
|
||||||
echo ' -c Recreate the chroot before building'
|
echo ' -c Recreate the chroot before building'
|
||||||
echo ' -m Major rebuild'
|
echo ' -m Major rebuild'
|
||||||
|
echo ' -N Disable check() function'
|
||||||
|
echo ' -C Run checkpkg after built'
|
||||||
echo ' -h This help'
|
echo ' -h This help'
|
||||||
echo ''
|
echo ''
|
||||||
echo "Default mkchrootpkg_args args: ${mkchrootpkg_args[*]}"
|
echo "Default mkchrootpkg_args args: ${mkchrootpkg_args[*]}"
|
||||||
@@ -42,13 +46,15 @@ usage() {
|
|||||||
|
|
||||||
orig_argv=("$0" "$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='hcmr:'
|
opts='hcCNmr:'
|
||||||
|
|
||||||
while getopts "${opts}" arg; do
|
while getopts "${opts}" arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
r) CHROOTS_PKG="$OPTARG" ;;
|
r) CHROOTS_PKG="$OPTARG" ;;
|
||||||
c) create_first=true ;;
|
c) create_first=true ;;
|
||||||
m) rebuild=true ;;
|
m) rebuild=true ;;
|
||||||
|
C) is_checkpkg=true; mkchrootpkg_args+=(-C) ;;
|
||||||
|
N) no_check=true; mkchrootpkg_args+=(-N) ;;
|
||||||
h|?) usage 0 ;;
|
h|?) usage 0 ;;
|
||||||
*) echo "invalid argument '%s'" "${arg}"; usage 1 ;;
|
*) echo "invalid argument '%s'" "${arg}"; usage 1 ;;
|
||||||
esac
|
esac
|
||||||
|
@@ -17,16 +17,22 @@
|
|||||||
|
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
|
# Source makepkg.conf; fail if it is not found
|
||||||
if [[ -r '/etc/makepkg.conf' ]]; then
|
if [[ -r '/etc/makepkg.conf' ]]; then
|
||||||
|
# shellcheck source=makepkg-x86_64.conf
|
||||||
source '/etc/makepkg.conf'
|
source '/etc/makepkg.conf'
|
||||||
else
|
else
|
||||||
die '/etc/makepkg.conf not found!'
|
die '/etc/makepkg.conf not found!'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
load_user_info
|
# Source user-specific makepkg.conf overrides
|
||||||
|
if [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" ]]; then
|
||||||
load_vars "${USERCONFDIR}/pacman/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
|
# shellcheck source=/dev/null
|
||||||
load_vars /etc/makepkg.conf
|
source "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf"
|
||||||
|
elif [[ -r "$HOME/.makepkg.conf" ]]; then
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
source "$HOME/.makepkg.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<- _EOF_
|
cat <<- _EOF_
|
||||||
@@ -79,8 +85,9 @@ if [[ ! -f PKGBUILD ]]; then
|
|||||||
die 'This must be run in the directory of a built package.'
|
die 'This must be run in the directory of a built package.'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck source=PKGBUILD.proto
|
||||||
. ./PKGBUILD
|
. ./PKGBUILD
|
||||||
if [[ $arch == 'any' ]]; then
|
if [[ ${arch[0]} == 'any' ]]; then
|
||||||
CARCH='any'
|
CARCH='any'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -91,7 +98,7 @@ TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
|||||||
for _pkgname in "${pkgname[@]}"; do
|
for _pkgname in "${pkgname[@]}"; do
|
||||||
comparepkg=$_pkgname
|
comparepkg=$_pkgname
|
||||||
pkgurl=
|
pkgurl=
|
||||||
target_pkgver=$(get_full_version)
|
target_pkgver=$(get_full_version "$_pkgname")
|
||||||
if ! pkgfile=$(find_cached_package "$_pkgname" "$target_pkgver" "$CARCH"); then
|
if ! pkgfile=$(find_cached_package "$_pkgname" "$target_pkgver" "$CARCH"); then
|
||||||
die 'tarball not found for package: %s' "${_pkgname}-$target_pkgver"
|
die 'tarball not found for package: %s' "${_pkgname}-$target_pkgver"
|
||||||
fi
|
fi
|
||||||
@@ -142,7 +149,7 @@ for _pkgname in "${pkgname[@]}"; do
|
|||||||
(( WARN )) && warning "$message" || msg "$message"
|
(( WARN )) && warning "$message" || msg "$message"
|
||||||
echo "$diff_output"
|
echo "$diff_output"
|
||||||
else
|
else
|
||||||
msg "No soname differences for %s" "$_pkgname."
|
msg "No soname differences for %s." "$_pkgname"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@@ -65,7 +65,6 @@ update_repo2(){
|
|||||||
if ${add_pkg};then
|
if ${add_pkg};then
|
||||||
local action='add'
|
local action='add'
|
||||||
packages+=("$name")
|
packages+=("$name")
|
||||||
# checkpkg "${pkgfile}" || return 2
|
|
||||||
if ${sign_pkg};then
|
if ${sign_pkg};then
|
||||||
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
||||||
signfile ${pkgfile}
|
signfile ${pkgfile}
|
||||||
@@ -109,7 +108,6 @@ update_repo(){
|
|||||||
if ${add_pkg};then
|
if ${add_pkg};then
|
||||||
local action='add'
|
local action='add'
|
||||||
packages+=("$pkg")
|
packages+=("$pkg")
|
||||||
# checkpkg "${pkgfile}" || return 2
|
|
||||||
if ${sign_pkg};then
|
if ${sign_pkg};then
|
||||||
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
||||||
signfile ${pkgfile}
|
signfile ${pkgfile}
|
||||||
|
@@ -33,6 +33,7 @@ REPO_DB_PREFIX=
|
|||||||
REPO_DB_SUFFIX=
|
REPO_DB_SUFFIX=
|
||||||
LOCKFILE=
|
LOCKFILE=
|
||||||
CLEAN_LOCK=0
|
CLEAN_LOCK=0
|
||||||
|
PREVENT_DOWNGRADE=0
|
||||||
|
|
||||||
. @libdir@/artools/util-base.sh
|
. @libdir@/artools/util-base.sh
|
||||||
|
|
||||||
@@ -52,6 +53,7 @@ Multiple packages to add can be specified on the command line.\n"
|
|||||||
printf -- "\n"
|
printf -- "\n"
|
||||||
printf -- "Options:\n"
|
printf -- "Options:\n"
|
||||||
printf -- " -n, --new only add packages that are not already in the database\n"
|
printf -- " -n, --new only add packages that are not already in the database\n"
|
||||||
|
printf -- "$(gettext " -p, --prevent-downgrade do not add package to database if a newer version is already present\n")"
|
||||||
elif [[ $cmd == "links-remove" ]] ; then
|
elif [[ $cmd == "links-remove" ]] ; then
|
||||||
printf -- "Usage: links-remove [options] <path-to-db> <packagename> ...\n"
|
printf -- "Usage: links-remove [options] <path-to-db> <packagename> ...\n"
|
||||||
printf -- "\n"
|
printf -- "\n"
|
||||||
@@ -199,6 +201,18 @@ db_write_entry() {
|
|||||||
if (( ONLYADDNEW )); then
|
if (( ONLYADDNEW )); then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
pkgentry=$(find_pkgentry "$pkgname")
|
||||||
|
if [[ -n $pkgentry ]]; then
|
||||||
|
|
||||||
|
local version=$(sed -n '/^%VERSION%$/ {n;p;q}' "$pkgentry/desc")
|
||||||
|
if (( $(vercmp "$version" "$pkgver") > 0 )); then
|
||||||
|
warning "$(gettext "A newer version for '%s' is already present in database")" "$pkgname"
|
||||||
|
if (( PREVENT_DOWNGRADE )); then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# remove an existing entry if it exists, ignore failures
|
# remove an existing entry if it exists, ignore failures
|
||||||
@@ -459,6 +473,7 @@ while (( $# )); do
|
|||||||
-s|--sign) SIGN=1 ;;
|
-s|--sign) SIGN=1 ;;
|
||||||
-k|--key) KEY=1 ; shift; GPGKEY=$1 ;;
|
-k|--key) KEY=1 ; shift; GPGKEY=$1 ;;
|
||||||
-v|--verify) VERIFY=1 ;;
|
-v|--verify) VERIFY=1 ;;
|
||||||
|
-p|--prevent-downgrade) PREVENT_DOWNGRADE=1 ;;
|
||||||
*) args+=("$1") ;;
|
*) args+=("$1") ;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
|
@@ -29,7 +29,9 @@ keepbuilddir=0
|
|||||||
update_first=0
|
update_first=0
|
||||||
clean_first=0
|
clean_first=0
|
||||||
run_namcap=0
|
run_namcap=0
|
||||||
|
run_checkpkg=0
|
||||||
temp_chroot=0
|
temp_chroot=0
|
||||||
|
run_nocheck=0
|
||||||
|
|
||||||
bindmounts_ro=()
|
bindmounts_ro=()
|
||||||
bindmounts_rw=()
|
bindmounts_rw=()
|
||||||
@@ -73,6 +75,8 @@ usage() {
|
|||||||
echo ' Useful for maintaining multiple copies'
|
echo ' Useful for maintaining multiple copies'
|
||||||
echo " Default: $copy"
|
echo " Default: $copy"
|
||||||
echo '-n Run namcap on the package'
|
echo '-n Run namcap on the package'
|
||||||
|
echo '-C Run checkpkg on the package'
|
||||||
|
echo '-N Disable check() function'
|
||||||
echo '-T Build in a temporary directory'
|
echo '-T Build in a temporary directory'
|
||||||
echo '-U Run makepkg as a specified user'
|
echo '-U Run makepkg as a specified user'
|
||||||
exit 1
|
exit 1
|
||||||
@@ -80,37 +84,31 @@ usage() {
|
|||||||
|
|
||||||
# {{{ functions
|
# {{{ functions
|
||||||
|
|
||||||
# Usage: sync_chroot $rootdir $copydir [$copy]
|
# Usage: sync_chroot $chrootdir $copydir [$copy]
|
||||||
sync_chroot() {
|
sync_chroot() {
|
||||||
local rootdir=$1
|
local chrootdir=$1
|
||||||
local copydir=$2
|
local copydir=$2
|
||||||
local copy=${3:-$2}
|
local copy=${3:-$2}
|
||||||
|
|
||||||
if [[ "$rootdir" -ef "$copydir" ]]; then
|
if [[ "$chrootdir/root" -ef "$copydir" ]]; then
|
||||||
error 'Cannot sync copy with itself: %s' "$copydir"
|
error 'Cannot sync copy with itself: %s' "$copydir"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get a read lock on the root chroot to make
|
# Get a read lock on the root chroot to make
|
||||||
# sure we don't clone a half-updated chroot
|
# sure we don't clone a half-updated chroot
|
||||||
slock 8 "$rootdir.lock" \
|
slock 8 "$chrootdir/root.lock" \
|
||||||
"Locking clean chroot [%s]" "$rootdir"
|
"Locking clean chroot [%s]" "$chrootdir/root"
|
||||||
|
|
||||||
stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$rootdir" "$copy"
|
stat_busy "Synchronizing chroot copy [%s] -> [%s]" "$chrootdir/root" "$copy"
|
||||||
if is_subvolume "$rootdir" && is_same_fs "$rootdir" "$(dirname -- "$copydir")" && ! mountpoint -q "$copydir"; then
|
if is_btrfs "$chrootdir" && ! mountpoint -q "$copydir"; then
|
||||||
if is_subvolume "$copydir"; then
|
|
||||||
subvolume_delete_recursive "$copydir" ||
|
subvolume_delete_recursive "$copydir" ||
|
||||||
die "Unable to delete subvolume %s" "$copydir"
|
die "Unable to delete subvolume %s" "$copydir"
|
||||||
else
|
btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
|
||||||
# avoid change of filesystem in case of an umount failure
|
|
||||||
rm --recursive --force --one-file-system "$copydir" ||
|
|
||||||
die "Unable to delete %s" "$copydir"
|
|
||||||
fi
|
|
||||||
btrfs subvolume snapshot "$rootdir" "$copydir" >/dev/null ||
|
|
||||||
die "Unable to create subvolume %s" "$copydir"
|
die "Unable to create subvolume %s" "$copydir"
|
||||||
else
|
else
|
||||||
mkdir -p "$copydir"
|
mkdir -p "$copydir"
|
||||||
rsync -a --delete -q -W -x "$rootdir/" "$copydir"
|
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir"
|
||||||
fi
|
fi
|
||||||
stat_done
|
stat_done
|
||||||
|
|
||||||
@@ -249,9 +247,6 @@ download_sources() {
|
|||||||
env SRCDEST="$SRCDEST" BUILDDIR="$WORKDIR" \
|
env SRCDEST="$SRCDEST" BUILDDIR="$WORKDIR" \
|
||||||
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o "${verifysource_args[@]}" ||
|
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o "${verifysource_args[@]}" ||
|
||||||
die "Could not download sources."
|
die "Could not download sources."
|
||||||
|
|
||||||
# Clean up garbage from verifysource
|
|
||||||
# rm -rf "$builddir"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
move_products() {
|
move_products() {
|
||||||
@@ -287,7 +282,7 @@ move_products() {
|
|||||||
|
|
||||||
orig_argv=("$0" "$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='hcur:I:l:nTD:d:U:'
|
opts='hcur:I:l:nNCTD:d:U:'
|
||||||
|
|
||||||
while getopts "${opts}" arg; do
|
while getopts "${opts}" arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
@@ -299,6 +294,8 @@ while getopts "${opts}" arg; do
|
|||||||
I) install_pkgs+=("$OPTARG") ;;
|
I) install_pkgs+=("$OPTARG") ;;
|
||||||
l) copy="$OPTARG" ;;
|
l) copy="$OPTARG" ;;
|
||||||
n) run_namcap=1; makepkg_args+=(--install) ;;
|
n) run_namcap=1; makepkg_args+=(--install) ;;
|
||||||
|
N) run_nocheck=1; makepkg_args+=(--nocheck) ;;
|
||||||
|
C) run_checkpkg=1 ;;
|
||||||
T) temp_chroot=1; copy+="-$$" ;;
|
T) temp_chroot=1; copy+="-$$" ;;
|
||||||
U) makepkg_user="$OPTARG" ;;
|
U) makepkg_user="$OPTARG" ;;
|
||||||
h|*) usage ;;
|
h|*) usage ;;
|
||||||
@@ -352,7 +349,7 @@ load_vars /etc/makepkg.conf
|
|||||||
lock 9 "$copydir.lock" "Locking chroot copy [%s]" "$copy"
|
lock 9 "$copydir.lock" "Locking chroot copy [%s]" "$copy"
|
||||||
|
|
||||||
if [[ ! -d $copydir ]] || (( clean_first )); then
|
if [[ ! -d $copydir ]] || (( clean_first )); then
|
||||||
sync_chroot "$chrootdir/root" "$copydir" "$copy"
|
sync_chroot "$chrootdir" "$copydir" "$copy"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bindmounts_rw+=("${PWD}:/startdir" "${SRCDEST}:/srcdest")
|
bindmounts_rw+=("${PWD}:/startdir" "${SRCDEST}:/srcdest")
|
||||||
@@ -385,6 +382,11 @@ if chroot-run \
|
|||||||
"$copydir" \
|
"$copydir" \
|
||||||
/chrootbuild "${makepkg_args[@]}"
|
/chrootbuild "${makepkg_args[@]}"
|
||||||
then
|
then
|
||||||
|
pkgnames=()
|
||||||
|
for pkgfile in "$copydir"/pkgdest/*; do
|
||||||
|
pkgfile=${pkgfile##*/};
|
||||||
|
pkgnames+=("${pkgfile%-*-*-*}");
|
||||||
|
done
|
||||||
move_products
|
move_products
|
||||||
else
|
else
|
||||||
(( ret += 1 ))
|
(( ret += 1 ))
|
||||||
@@ -399,6 +401,15 @@ if (( ret != 0 )); then
|
|||||||
die "Build failed, check %s/build" "$copydir"
|
die "Build failed, check %s/build" "$copydir"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
if (( run_checkpkg )); then
|
||||||
|
msg "Running checkpkg"
|
||||||
|
msg2 "Downloading current versions"
|
||||||
|
if pacman --noconfirm -Swdd --logfile /dev/null "${pkgnames[@]}"; then
|
||||||
|
msg2 "Checking packages"
|
||||||
|
sudo -u "$makepkg_user" checkpkg --rmdir --warn
|
||||||
|
else
|
||||||
|
warning "Skipped checkpkg due to missing packages"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
true
|
true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@@ -193,6 +193,7 @@ configure_image(){
|
|||||||
configure_services "$fs"
|
configure_services "$fs"
|
||||||
configure_calamares "$fs"
|
configure_calamares "$fs"
|
||||||
[[ ! -d "$fs/etc/artools" ]] && mkdir -p "$fs/etc/artools"
|
[[ ! -d "$fs/etc/artools" ]] && mkdir -p "$fs/etc/artools"
|
||||||
|
msg2 "Writing live.conf"
|
||||||
write_live_session_conf > "$fs/etc/artools/live.conf"
|
write_live_session_conf > "$fs/etc/artools/live.conf"
|
||||||
msg "Done configuring [%s]" "${fs##*/}"
|
msg "Done configuring [%s]" "${fs##*/}"
|
||||||
}
|
}
|
||||||
|
@@ -69,7 +69,6 @@ load_profile(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
write_live_session_conf(){
|
write_live_session_conf(){
|
||||||
msg2 "Writing live.conf"
|
|
||||||
local conf=''
|
local conf=''
|
||||||
conf+=$(printf '%s\n' '# live session configuration')
|
conf+=$(printf '%s\n' '# live session configuration')
|
||||||
conf+=$(printf "\nAUTOLOGIN=%s\n" "${AUTOLOGIN}")
|
conf+=$(printf "\nAUTOLOGIN=%s\n" "${AUTOLOGIN}")
|
||||||
|
Reference in New Issue
Block a user