initial import
This commit is contained in:
129
libretools/PKGBUILD
Normal file
129
libretools/PKGBUILD
Normal file
@@ -0,0 +1,129 @@
|
||||
# Maintainer: Jesus E. <heckyel@riseup.net>
|
||||
|
||||
pkgbase=libretools
|
||||
pkgname=(libretools librelib gitget xbs)
|
||||
pkgdesc="Programs for Hyperbola development"
|
||||
url="https://git.parabola.nu/packages/libretools.git/"
|
||||
license=('GPL-3' 'GPL-2')
|
||||
|
||||
pkgver=20170505
|
||||
source=(https://repo.parabola.nu/other/$pkgname/$pkgname-$pkgver.tar.gz{,.sig}
|
||||
hyperbola.patch
|
||||
doas.patch
|
||||
gettext-tiny.patch
|
||||
remove-systemd_stdin_hack.patch)
|
||||
sha512sums=('7034e12c6a3425b5c9eb05f2250397a5bb6ed89fda7129fcbc8ab2d56d6afa63dbd11c95dc0921cd087121b4c0168890136571a568b9fa89d9b4945a62cd3509'
|
||||
'SKIP'
|
||||
'5d702bf29ab9b0a607c6f45ec5641759150f2a3eb674bc55036bbac56dbd13e8f66fc2bda2ee4a722084e56b567861da092b364512ae30345fb0fa025a26abbd'
|
||||
'399866ab03c8cf923ff31aa71ae033d1732c5652fb67ff7c8882a786913361d3f0058f338bc726fa2d547c2ed4142999841e7886357cb4b46e5120342cbce241'
|
||||
'5e3b286c067bca460eab27915af9e98dbd6e9bd16e4cb0ccf7988870617f0d6b380d406519fad3ce13c45a3098e1a7f033ee14ad111abec16d614630479d86f7'
|
||||
'3d1223a3f8c2257de17c514eb0b68d32c188a42d332106a264be686e7735a2e2ec41cb062a0ec367dfb5846614983a0dc6c860a7d74dbc40e2d9ce146c284d1c')
|
||||
validpgpkeys=('99195DD3BB6FE10A2F36ED8445698744D4FFBFC9') # Luke Shumaker
|
||||
|
||||
pkgrel=6
|
||||
arch=('any')
|
||||
makedepends=(ruby-ronn-ng gettext-tiny)
|
||||
checkdepends=(sh-roundup git expac tokyocabinet)
|
||||
|
||||
prepare() {
|
||||
cd "$srcdir/$pkgbase-$pkgver"
|
||||
patch -p1 -i ../hyperbola.patch
|
||||
patch -p1 -i ../doas.patch
|
||||
patch -p1 -i ../gettext-tiny.patch
|
||||
mv test/libredbdiff.d/statedir/pacman.arch{linux,}
|
||||
mv test/libredbdiff.d/statedir/pacman.{para,hyper}bola
|
||||
mv test/libredbdiff.d/statedir/pacman.hyperbola/sync/{libre,core}.db
|
||||
mv src/abslibre-tools/diff-{un,non}free
|
||||
sed -i '\|extra/devtools| s|devtools|libretools|' src/chroot-tools/arch-nspawn.in
|
||||
sed -i '\|CHROOT_VERSION|,+2 c echo "$CHROOT_VERSION" > "$working_dir/.arch-chroot"' src/chroot-tools/mkarchroot.in
|
||||
sed -i 's|/usr/bin/false|/bin/false|' test/librefetch-test.sh
|
||||
sed -i 's|/usr/bin/sed|/bin/sed|' src/librefetch/librefetchdir/{libmakepkg/source.sh.gen,makepkg.gen}
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "$srcdir/$pkgbase-$pkgver"
|
||||
make
|
||||
}
|
||||
|
||||
check() {
|
||||
cd "$srcdir/$pkgbase-$pkgver"
|
||||
|
||||
DOAS_USER= make check TESTENVFLAGS='--no-network --no-doas'
|
||||
}
|
||||
|
||||
package_librelib() {
|
||||
pkgdesc="The shell library portion of libretools (adapted for Hyperbola)"
|
||||
license=(GPL-2)
|
||||
optdepends=(
|
||||
'libretools: for libreblacklist/blacklist.sh'
|
||||
'wget: for libreblacklist/blacklist.sh'
|
||||
)
|
||||
|
||||
cd "$srcdir/$pkgbase-$pkgver"
|
||||
make install-librelib DESTDIR="$pkgdir"
|
||||
install -Dm644 COPYING-GPLv2 "$pkgdir/usr/share/licenses/$pkgname/COPYING-GPLv2"
|
||||
}
|
||||
|
||||
package_gitget() {
|
||||
pkgdesc="A simple to use downloader for git URLs (adapted for Hyperbola)"
|
||||
license=(GPL-2)
|
||||
depends=("librelib=$pkgver" git)
|
||||
|
||||
provides=("libregit=$pkgver")
|
||||
conflicts=("libregit")
|
||||
replaces=("libregit")
|
||||
|
||||
cd "$srcdir/$pkgbase-$pkgver"
|
||||
make install-gitget DESTDIR="$pkgdir"
|
||||
install -Dm644 COPYING-GPLv2 "$pkgdir/usr/share/licenses/$pkgname/COPYING-GPLv2"
|
||||
}
|
||||
|
||||
package_xbs() {
|
||||
pkgdesc='A tool for working with arbitrary ABS-like build systems (adapted for Hyperbola)'
|
||||
backup=(etc/xbs/xbs.conf
|
||||
etc/xbs/xbs-abs.conf)
|
||||
license=(GPL-2)
|
||||
depends=(
|
||||
"gitget=$pkgver" # `helper-abslibre`
|
||||
"librelib=$pkgver"
|
||||
subversion # `helper-abs`
|
||||
)
|
||||
|
||||
cd "$srcdir/$pkgbase-$pkgver"
|
||||
make install-xbs DESTDIR="$pkgdir"
|
||||
install -Dm644 COPYING-GPLv2 "$pkgdir/usr/share/licenses/$pkgname/COPYING-GPLv2"
|
||||
}
|
||||
|
||||
package_libretools() {
|
||||
backup=(etc/libretools.conf
|
||||
etc/libretools.d/chroot.conf
|
||||
etc/libretools.d/libredbdiff.conf
|
||||
etc/libretools.d/librefetch.conf)
|
||||
install=libretools.install
|
||||
conflicts=(devtools libretools-mips64el)
|
||||
replaces=(libretools-mips64el)
|
||||
|
||||
depends=(
|
||||
"librelib=$pkgver"
|
||||
"xbs=$pkgver" # `createworkdir`, `librestage`
|
||||
'pacman>=5.0.1' 'pacman<5.1'
|
||||
arch-install-scripts # `mkarchroot` uses `pacstrap`
|
||||
expac # `libredbdiff`
|
||||
make # `librefetch`
|
||||
openssh # `librerelease`
|
||||
rsync # `librerelease` and `makechrootpkg.sh`
|
||||
chroot-nspawn # systemd-nspawn wrapper for chroot
|
||||
tokyocabinet # `toru`
|
||||
#namcap # Namcap is currently disabled in libremakepkg :-(
|
||||
#subversion # `diff-nonfree` # ignore because of xbs
|
||||
wget # `aur`, optdepend for librelib:`blacklist`
|
||||
opendoas # portable version of doas to run some commands as root
|
||||
binutils
|
||||
)
|
||||
|
||||
cd "$srcdir/$pkgbase-$pkgver"
|
||||
make install-libretools DESTDIR="$pkgdir"
|
||||
for i in COPYING{,-GPLv2,-GPLv3}; do
|
||||
install -Dm644 $i "$pkgdir/usr/share/licenses/$pkgname/$i"
|
||||
done
|
||||
}
|
||||
853
libretools/doas.patch
Normal file
853
libretools/doas.patch
Normal file
@@ -0,0 +1,853 @@
|
||||
diff --git a/HACKING/testing.md b/HACKING/testing.md
|
||||
index 8dee4853..3946f0ef 100644
|
||||
--- a/HACKING/testing.md
|
||||
+++ b/HACKING/testing.md
|
||||
@@ -5,7 +5,7 @@ Please write unit tests for new things. Tests can be run with `make
|
||||
check`, which just runs `./testenv roundup` in the `test/` directory.
|
||||
Relatedly, you need the `roundup` (the `sh-roundup` package on
|
||||
Parabola) tool to run the tests. `./testenv` can be given
|
||||
-`--no-network` and/or `--no-sudo` to dissable tests that require those
|
||||
+`--no-network` and/or `--no-doas` to dissable tests that require those
|
||||
things. Make can be made to pass those things in by setting
|
||||
`TESTENVFLAGS`. If you don't dissable either, I *strongly* recommend
|
||||
setting TMPDIR to somewhere on a btrfs partition before running the
|
||||
diff --git a/src/abslibre-tools/libredbdiff b/src/abslibre-tools/libredbdiff
|
||||
index a01c32fb..22d27a77 100755
|
||||
--- a/src/abslibre-tools/libredbdiff
|
||||
+++ b/src/abslibre-tools/libredbdiff
|
||||
@@ -3,6 +3,8 @@
|
||||
#
|
||||
# Copyright (C) 2014 Esteban Carnevale <alfplayer@mailoo.org>
|
||||
# Copyright (C) 2014, 2017 Luke Shumaker <lukeshu@sbcglobal.net>
|
||||
+# Copyright (C) 2020 André Silva <emulatorman@hyperbola.info>
|
||||
+# Copyright (C) 2020 Márcio Silva <coadde@hyperbola.info>
|
||||
#
|
||||
# License: GNU GPLv3+
|
||||
#
|
||||
@@ -131,7 +133,7 @@ print_cmp() {
|
||||
}
|
||||
|
||||
usage() {
|
||||
- print "Usage: sudo %q" "$cmd"
|
||||
+ print "Usage: doas %q" "$cmd"
|
||||
print " or: %q -n [REPO]" "$cmd"
|
||||
print " or: %q -h" "$cmd"
|
||||
print 'Show packages that need to be updated from Arch repositories.'
|
||||
diff --git a/src/chroot-tools/hooks-check.sh b/src/chroot-tools/hooks-check.sh
|
||||
index 2bf3fff4..de18c452 100644
|
||||
--- a/src/chroot-tools/hooks-check.sh
|
||||
+++ b/src/chroot-tools/hooks-check.sh
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/hint/bash -euE -o pipefail
|
||||
# Copyright (C) 2013, 2017 Luke Shumaker <lukeshu@sbcglobal.net>
|
||||
+# Copyright (C) 2020 André Silva <emulatorman@hyperbola.info>
|
||||
+# Copyright (C) 2020 Márcio Silva <coadde@hyperbola.info>
|
||||
#
|
||||
# License: GNU GPLv2+
|
||||
#
|
||||
@@ -19,13 +21,21 @@
|
||||
hook_check_pkgbuild+=("check_pkgbuild_nonfree")
|
||||
check_pkgbuild_nonfree() {
|
||||
local s=0
|
||||
- sudo -EH -u "$LIBREUSER" pkgbuild-check-nonfree -f || s=$?
|
||||
+ if [ $(doas grep -qs 'permit nopass keepenv setenv { HOME='$LIBREHOME' } '$LIBREUSER /etc/doas.conf; echo $?) != 0 ]; then
|
||||
+ echo 'permit nopass keepenv setenv { HOME='$LIBREHOME' } '$LIBREUSER >> "$copydir/etc/doas.conf"
|
||||
+ fi
|
||||
+ doas -u "$LIBREUSER" bash -c "DOAS_USER="$DOAS_USER" pkgbuild-check-nonfree -f || s=$?"
|
||||
+ sed -i '\|permit nopass keepenv setenv { HOME='$LIBREHOME' } '$LIBREUSER'|d' "$copydir/etc/doas.conf"
|
||||
pkgbuild-summarize-nonfree $s
|
||||
}
|
||||
|
||||
#hook_check_pkgbuild+=("check_pkgbuild_namcap")
|
||||
check_pkgbuild_namcap() {
|
||||
- sudo -EH -u "$LIBREUSER" namcap PKGBUILD
|
||||
+ if [ $(doas grep -qs 'permit nopass keepenv setenv { HOME='$LIBREHOME' } '$LIBREUSER /etc/doas.conf; echo $?) != 0 ]; then
|
||||
+ echo 'permit nopass keepenv setenv { HOME='$LIBREHOME' } '$LIBREUSER >> "$copydir/etc/doas.conf"
|
||||
+ fi
|
||||
+ doas -u "$LIBREUSER" bash -c "DOAS_USER="$DOAS_USER" namcap PKGBUILD"
|
||||
+ sed -i '\|permit nopass keepenv setenv { HOME='$LIBREHOME' } '$LIBREUSER'|d' "$copydir/etc/doas.conf"
|
||||
}
|
||||
|
||||
#hook_check_pkg+=("check_pkg")
|
||||
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
|
||||
index 7b1c8c2c..f9bbc463 100755
|
||||
--- a/src/chroot-tools/librechroot
|
||||
+++ b/src/chroot-tools/librechroot
|
||||
@@ -206,7 +206,7 @@ usage() {
|
||||
echo
|
||||
prose 'Each named chroot has a master clean copy (named `root`), and any
|
||||
number of other named copies; the copy used by default is the
|
||||
- current username (or $SUDO_USER, or `copy` if root).'
|
||||
+ current username (or $DOAS_USER, or `copy` if root).'
|
||||
echo
|
||||
prose 'The full path to the chroot copy is "$CHROOTDIR/$CHROOT/$COPY",
|
||||
unless the copy name is manually specified as an absolute path,
|
||||
diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg
|
||||
index d4e5b8a0..b6e7ff92 100755
|
||||
--- a/src/chroot-tools/libremakepkg
|
||||
+++ b/src/chroot-tools/libremakepkg
|
||||
@@ -6,6 +6,8 @@ set -euE
|
||||
# Copyright (C) 2010-2012 Joshua Ismael Haase Hernández (xihh) <hahj87@gmail.com>
|
||||
# Copyright (C) 2012 Michał Masłowski <mtjm@mtjm.eu>
|
||||
# Copyright (C) 2012-2015, 2017 Luke Shumaker <lukeshu@sbcglobal.net>
|
||||
+# Copyright (C) 2020 André Silva <emulatorman@hyperbola.info>
|
||||
+# Copyright (C) 2020 Márcio Silva <coadde@hyperbola.info>
|
||||
#
|
||||
# License: GNU GPLv2+
|
||||
#
|
||||
@@ -144,8 +146,8 @@ usage() {
|
||||
bullet 'set `MAKEFLAGS` and `PACKAGER` in `/etc/makepkg.conf` to reflect
|
||||
the value outside of the chroot.'
|
||||
bullet 'create a `builduser` with the same numeric UID as the
|
||||
- invoking $SUDO_USER.'
|
||||
- bullet 'lets this `builduser` call `sudo pacman` without a password.'
|
||||
+ invoking $DOAS_USER.'
|
||||
+ bullet 'lets this `builduser` call `doas pacman` without a password.'
|
||||
bullet 'adds a pacman repositoriy of locally built packages'
|
||||
echo
|
||||
prose 'This command is configured both with `chroot.conf` (either in
|
||||
diff --git a/src/chroot-tools/makechrootpkg.in b/src/chroot-tools/makechrootpkg.in
|
||||
index f97b329b..370d672f 100644
|
||||
--- a/src/chroot-tools/makechrootpkg.in
|
||||
+++ b/src/chroot-tools/makechrootpkg.in
|
||||
@@ -33,9 +33,9 @@ init_variables() {
|
||||
bindmounts_rw=()
|
||||
|
||||
copy=$USER
|
||||
- [[ -n ${SUDO_USER:-} ]] && copy=$SUDO_USER
|
||||
+ [[ -n ${DOAS_USER:-} ]] && copy=$DOAS_USER
|
||||
[[ -z "$copy" || $copy = root ]] && copy=copy
|
||||
- src_owner=${SUDO_USER:-$USER}
|
||||
+ src_owner=${DOAS_USER:-$USER}
|
||||
}
|
||||
|
||||
usage() {
|
||||
@@ -191,7 +191,7 @@ prepare_chroot() {
|
||||
$repack || rm -rf "$copydir/build"
|
||||
|
||||
local builduser_uid builduser_gid
|
||||
- builduser_uid="${SUDO_UID:-$UID}"
|
||||
+ builduser_uid="$(id -u ${DOAS_USER:-$USER})"
|
||||
builduser_gid="$(id -g "$builduser_uid")"
|
||||
local install="install -o $builduser_uid -g $builduser_gid"
|
||||
local x
|
||||
@@ -222,10 +222,12 @@ prepare_chroot() {
|
||||
echo "$x" >>"$copydir/etc/makepkg.conf"
|
||||
done
|
||||
|
||||
- cat > "$copydir/etc/sudoers.d/builduser-pacman" <<EOF
|
||||
-builduser ALL = NOPASSWD: /usr/bin/pacman
|
||||
+ if [ $(doas grep -qs 'permit nopass builduser as root cmd /usr/bin/pacman' "$copydir/etc/doas.conf"; echo $?) != 0 ]; then
|
||||
+ cat > "$copydir/etc/doas.conf" <<EOF
|
||||
+permit nopass :wheel
|
||||
+permit nopass builduser as root cmd /usr/bin/pacman
|
||||
EOF
|
||||
- chmod 440 "$copydir/etc/sudoers.d/builduser-pacman"
|
||||
+ fi
|
||||
|
||||
if ! grep -q '^\[repo\]' "$copydir/etc/pacman.conf"; then
|
||||
local line
|
||||
@@ -266,29 +268,33 @@ Server = file:///repo
|
||||
_chrootprepare() {
|
||||
# shellcheck source=/dev/null
|
||||
. /etc/profile
|
||||
- # Beware, there are some stupid arbitrary rules on how you can
|
||||
- # use "$" in arguments to commands with "sudo -i". ${foo} or
|
||||
- # ${1} is OK, but $foo or $1 isn't.
|
||||
- # https://bugzilla.sudo.ws/show_bug.cgi?id=765
|
||||
- sudo -iu builduser bash -c 'cd /startdir; makepkg "$@" --nobuild' -bash "$@"
|
||||
+ if [ $(doas grep -qs 'permit nopass setenv { HOME="/build" PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl" _="/bin/bash" } builduser' /etc/doas.conf; echo $?) != 0 ]; then
|
||||
+ echo 'permit nopass setenv { HOME="/build" PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl" _="/bin/bash" } builduser' >> "$copydir/etc/doas.conf"
|
||||
+ fi
|
||||
+ doas -u builduser bash -c 'cd $HOME; cd /startdir; DOAS_USER='$DOAS_USER' makepkg "$@" --nobuild' -bash "$@"
|
||||
+ sed -i '\|permit nopass setenv { HOME="/build" PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl" _="/bin/bash" } builduser|d' "$copydir/etc/doas.conf"
|
||||
}
|
||||
|
||||
_chrootbuild() {
|
||||
# shellcheck source=/dev/null
|
||||
. /etc/profile
|
||||
- # Beware, there are some stupid arbitrary rules on how you can
|
||||
- # use "$" in arguments to commands with "sudo -i". ${foo} or
|
||||
- # ${1} is OK, but $foo or $1 isn't.
|
||||
- # https://bugzilla.sudo.ws/show_bug.cgi?id=765
|
||||
- sudo -iu builduser bash -c 'cd /startdir; makepkg "${@:2}" --allsource' -bash ".src.tar.gz" "$@" || return
|
||||
- sudo -iu builduser bash -c 'cd /startdir; makepkg "$@" --noextract --noprepare' -bash "$@"
|
||||
+ if [ $(doas grep -qs 'permit nopass setenv { HOME="/build" PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/sbin:/usr/sbin:/sbin" _="/bin/bash" } builduser' /etc/doas.conf; echo $?) != 0 ]; then
|
||||
+ echo 'permit nopass setenv { HOME="/build" PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/sbin:/usr/sbin:/sbin" _="/bin/bash" } builduser' >> "$copydir/etc/doas.conf"
|
||||
+ fi
|
||||
+ doas -u builduser bash -c 'cd $HOME; cd /startdir; DOAS_USER='$DOAS_USER' makepkg "${@:2}" --allsource' -bash ".src.tar.gz" "$@" || return
|
||||
+ sed -i '\|permit nopass setenv { HOME="/build" PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/sbin:/usr/sbin:/sbin:" _="/bin/bash" } builduser|d' "$copydir/etc/doas.conf"
|
||||
+ if [ $(doas grep -qs 'permit nopass setenv { HOME="/build" PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/sbin:/usr/sbin:/sbin" _="/bin/bash" } builduser' /etc/doas.conf; echo $?) != 0 ]; then
|
||||
+ echo 'permit nopass setenv { HOME="/build" PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/sbin:/usr/sbin:/sbin" _="/bin/bash" } builduser' >> "$copydir/etc/doas.conf"
|
||||
+ fi
|
||||
+ doas -u builduser bash -c 'cd $HOME; cd /startdir; DOAS_USER='$DOAS_USER' makepkg "$@" --noextract --noprepare' -bash "$@"
|
||||
+ sed -i '\|permit nopass setenv { HOME="/build" PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/sbin:/usr/sbin:/sbin" _="/bin/bash" } builduser|d' "$copydir/etc/doas.conf"
|
||||
}
|
||||
|
||||
_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"
|
||||
+ doas -u builduser namcap "$pkgfile" 2>&1 | tee "/logdest/${pkgfile##*/}-namcap.log"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -306,7 +312,7 @@ download_sources() {
|
||||
|
||||
# Ensure sources are downloaded
|
||||
if [[ "$(id -u "$makepkg_user")" != 0 ]]; then
|
||||
- sudo -u "$makepkg_user" env SRCDEST="$SRCDEST" BUILDDIR="$builddir" \
|
||||
+ doas -u "$makepkg_user" env SRCDEST="$SRCDEST" BUILDDIR="$builddir" \
|
||||
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o ||
|
||||
die "Could not download sources."
|
||||
else
|
||||
@@ -372,7 +378,7 @@ main() {
|
||||
|
||||
[[ ! -f PKGBUILD && -z "${install_pkgs[*]}" ]] && die 'This must be run in a directory containing a PKGBUILD.'
|
||||
[[ -n $makepkg_user && -z $(id -u "$makepkg_user") ]] && die 'Invalid makepkg user.'
|
||||
- makepkg_user=${makepkg_user:-${SUDO_USER:-$USER}}
|
||||
+ makepkg_user=${makepkg_user:-${DOAS_USER:-$USER}}
|
||||
|
||||
check_root
|
||||
|
||||
@@ -400,8 +406,8 @@ main() {
|
||||
esac
|
||||
done
|
||||
|
||||
- if [[ -n $SUDO_USER ]]; then
|
||||
- eval "USER_HOME=~$SUDO_USER"
|
||||
+ if [[ -n $DOAS_USER ]]; then
|
||||
+ eval "USER_HOME=~$DOAS_USER"
|
||||
else
|
||||
USER_HOME=$HOME
|
||||
fi
|
||||
diff --git a/src/dagpkg b/src/dagpkg
|
||||
index d6f7ccaa..38c6844d 100755
|
||||
--- a/src/dagpkg
|
||||
+++ b/src/dagpkg
|
||||
@@ -1,11 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
-#
|
||||
+#
|
||||
# dagpkg - create a directed graph of package dependencies and build
|
||||
# them in topological order
|
||||
|
||||
# Copyright (C) 2014 Nicolás Reynolds <fauno@parabola.nu>
|
||||
# Copyright (C) 2014 Michał Masłowski <mtjm@mtjm.eu>
|
||||
# Copyright (C) 2017 Luke Shumaker <lukeshu@sbcglobal.net>
|
||||
+# Copyright (C) 2020 André Silva <emulatorman@hyperbola.info>
|
||||
+# Copyright (C) 2020 Márcio Silva <coadde@hyperbola.info>
|
||||
#
|
||||
# License: GNU GPLv3+
|
||||
#
|
||||
@@ -196,7 +198,11 @@ main() {
|
||||
# upgrade the system
|
||||
# this would probably have to go on HOOKPREBUILD if you're working
|
||||
# outside chroots
|
||||
- sudo -E pacman -Syu --noconfirm
|
||||
+ if [ $(doas grep -qs 'permit nopass keepenv '$LIBREUSER /etc/doas.conf; echo $?) != 0 ]; then
|
||||
+ echo 'permit nopass keepenv '$LIBREUSER >> "$copydir/etc/doas.conf"
|
||||
+ fi
|
||||
+ doas pacman -Syu --noconfirm
|
||||
+ sed -i '\|permit nopass keepenv '$LIBREUSER'|d' "$copydir/etc/doas.conf"
|
||||
|
||||
# run the pre build command from libretools.conf
|
||||
if [[ -n "$HOOKPREBUILD" ]]; then
|
||||
diff --git a/src/lib/archroot.sh.in b/src/lib/archroot.sh.in
|
||||
index 98fd2cfb..e449499d 100644
|
||||
--- a/src/lib/archroot.sh.in
|
||||
+++ b/src/lib/archroot.sh.in
|
||||
@@ -11,8 +11,8 @@ CHROOT_VERSION='v4'
|
||||
orig_argv=("$0" "$@")
|
||||
check_root() {
|
||||
(( EUID == 0 )) && return
|
||||
- if type -P sudo >/dev/null; then
|
||||
- exec sudo -- "${orig_argv[@]}"
|
||||
+ if type -P doas >/dev/null; then
|
||||
+ exec doas -- "${orig_argv[@]}"
|
||||
else
|
||||
exec su root -c "$(printf ' %q' "${orig_argv[@]}")"
|
||||
fi
|
||||
diff --git a/src/lib/conf.sh.3.ronn b/src/lib/conf.sh.3.ronn
|
||||
index 949ce3e9..93bf3d08 100644
|
||||
--- a/src/lib/conf.sh.3.ronn
|
||||
+++ b/src/lib/conf.sh.3.ronn
|
||||
@@ -12,15 +12,15 @@ files related to Arch/Hyperbola(7) and libretools(7).
|
||||
|
||||
### VARIABLES
|
||||
|
||||
-When loading configuration files in a program run with `sudo`(8), it
|
||||
+When loading configuration files in a program run with `doas`(1), it
|
||||
is often desirable to load the configuration files from the home
|
||||
-directory of the user who called `sudo`, instead of from /root.
|
||||
+directory of the user who called `doas`, instead of from /root.
|
||||
|
||||
To accommodate this, instead of using the usual $<USER> and $<HOME>,
|
||||
`conf.sh` sets $<LIBREUSER> and $<LIBREHOME>, which it then uses.
|
||||
|
||||
* <LIBREUSER>:
|
||||
- If $<SUDO_USER> is set, then $<LIBREUSER> is set to
|
||||
+ If $<DOAS_USER> is set, then $<LIBREUSER> is set to
|
||||
that. Otherwise, $<LIBREUSER> is set to the value of $<USER>.
|
||||
* <LIBREHOME>:
|
||||
If $<LIBREUSER> == $<USER>, then $<LIBREHOME> is set to the value
|
||||
diff --git a/src/lib/conf.sh.in b/src/lib/conf.sh.in
|
||||
index 942484ef..e28febf6 100644
|
||||
--- a/src/lib/conf.sh.in
|
||||
+++ b/src/lib/conf.sh.in
|
||||
@@ -19,8 +19,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
SNAPSHOT=2020-05-08
|
||||
-
|
||||
-LIBREUSER="${SUDO_USER:-$USER}"
|
||||
+LIBREUSER="${DOAS_USER:-$USER}"
|
||||
if [[ $LIBREUSER == "$USER" ]]; then
|
||||
LIBREHOME=$HOME
|
||||
else
|
||||
diff --git a/src/librefetch/librefetch.conf.5.ronn b/src/librefetch/librefetch.conf.5.ronn
|
||||
index 29df4d2d..9325b0bc 100644
|
||||
--- a/src/librefetch/librefetch.conf.5.ronn
|
||||
+++ b/src/librefetch/librefetch.conf.5.ronn
|
||||
@@ -19,7 +19,7 @@ to override.
|
||||
|
||||
If `$XDG_CONFIG_HOME` is not set, a default value is set:
|
||||
|
||||
- * if `$SUDO_USER` is set: `$(eval echo ~$SUDO_USER)/.config`
|
||||
+ * if `$DOAS_USER` is set: `$(eval echo ~$DOAS_USER)/.config`
|
||||
* else: `$HOME/.config`
|
||||
|
||||
## OPTIONS
|
||||
diff --git a/src/libretools.conf b/src/libretools.conf
|
||||
index 7ecad428..ab7e3c95 100644
|
||||
--- a/src/libretools.conf
|
||||
+++ b/src/libretools.conf
|
||||
@@ -35,7 +35,7 @@ REPODEST=staging@dusseldorf.hyperbola.info:$LIBREUSER
|
||||
|
||||
## These are run before and after uploading packages
|
||||
HOOKPRERELEASE="ssh -p 51011 -fN ${REPODEST%%:*}"
|
||||
-HOOKPOSTRELEASE="sudo librechroot clean-repo" # && sudo librechroot -n i686 clean-repo"
|
||||
+HOOKPOSTRELEASE="doas librechroot clean-repo" # && doas librechroot -n i686 clean-repo"
|
||||
|
||||
################################################################################
|
||||
# dagpkg #
|
||||
@@ -48,9 +48,9 @@ HOOKPREBUILD=""
|
||||
|
||||
## Uncomment one of those or make one of your choice
|
||||
# Normal
|
||||
-FULLBUILDCMD="sudo libremakepkg"
|
||||
+FULLBUILDCMD="doas libremakepkg"
|
||||
# Cross compiling
|
||||
-#FULLBUILDCMD="sudo libremakepkg -n cross-compile-chroot"
|
||||
+#FULLBUILDCMD="doas libremakepkg -n cross-compile-chroot"
|
||||
# Don't use a chroot
|
||||
#FULLBUILDCMD="makepkg -sL --noconfirm"
|
||||
|
||||
diff --git a/src/workflows.md b/src/workflows.md
|
||||
index 03dca4f6..c7c85052 100644
|
||||
--- a/src/workflows.md
|
||||
+++ b/src/workflows.md
|
||||
@@ -22,7 +22,7 @@ This is how the chroot is configured:
|
||||
* Create the same user (with same uid) on the chroot that the one I use
|
||||
regularly.
|
||||
|
||||
-* Give it password-less sudo on the chroot.
|
||||
+* Give it password-less doas on the chroot.
|
||||
|
||||
* Bind mount `/home` to `/chroot/home`, where I have the abslibre-mips64el
|
||||
clone.
|
||||
diff --git a/src/xbs-abs/helper-abs b/src/xbs-abs/helper-abs
|
||||
index e8f41de9..0d2e6cdc 100755
|
||||
--- a/src/xbs-abs/helper-abs
|
||||
+++ b/src/xbs-abs/helper-abs
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (C) 2013-2014, 2017 Luke Shumaker <lukeshu@sbcglobal.net>
|
||||
+# Copyright (C) 2020 André Silva <emulatorman@hyperbola.info>
|
||||
+# Copyright (C) 2020 Márcio Silva <coadde@hyperbola.info>
|
||||
#
|
||||
# For code from db-functions (arch_svn):
|
||||
# Copyright (C) 2012 Pierre Schmitz <pierre@archlinux.de>
|
||||
@@ -43,7 +45,7 @@ arch_svn() {
|
||||
if [[ -z "${SVNUSER}" ]]; then
|
||||
/usr/bin/svn "${@}"
|
||||
else
|
||||
- sudo -u "${SVNUSER}" -- /usr/bin/svn --username "${USER}" "${@}"
|
||||
+ doas -u "${SVNUSER}" -- /usr/bin/svn --username "${USER}" "${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
diff --git a/test/lib-conf-test.sh b/test/lib-conf-test.sh
|
||||
index d79c5f2a..1cf5d6f1 100644
|
||||
--- a/test/lib-conf-test.sh
|
||||
+++ b/test/lib-conf-test.sh
|
||||
@@ -13,13 +13,13 @@ it_sets_makepkg_vars_in_custom_file() {
|
||||
}
|
||||
|
||||
it_figures_out_HOME_when_root() {
|
||||
- require sudo || return 0
|
||||
+ require doas || return 0
|
||||
# This one is tricky, because it does the job too well, it will find
|
||||
# the actual HOME, instead of the test environment HOME. Therefore, we
|
||||
# will just check that [[ $HOME != /root ]]
|
||||
cd "$tmpdir"
|
||||
echo '. $(librelib conf.sh); echo "$LIBREHOME"' > test.sh
|
||||
- LIBREHOME=$(testsudo bash ./test.sh)
|
||||
+ LIBREHOME=$(testdoas bash ./test.sh)
|
||||
[[ $LIBREHOME != /root ]]
|
||||
}
|
||||
|
||||
diff --git a/test/librechroot-test.sh b/test/librechroot-test.sh
|
||||
index 2aad0c60..172b9462 100644
|
||||
--- a/test/librechroot-test.sh
|
||||
+++ b/test/librechroot-test.sh
|
||||
@@ -6,56 +6,56 @@ describe librechroot
|
||||
setup_chrootdir
|
||||
|
||||
it_creates_repo_for_new_chroots() {
|
||||
- require network sudo || return 0
|
||||
+ require network doas || return 0
|
||||
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
|
||||
- testsudo librechroot -l "$roundup_test_name" run test -r /repo/repo.db
|
||||
+ testdoas librechroot -l "$roundup_test_name" run test -r /repo/repo.db
|
||||
}
|
||||
|
||||
it_cleans_the_local_repo_correctly() {
|
||||
- require network sudo || return 0
|
||||
+ require network doas || return 0
|
||||
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
|
||||
- testsudo librechroot -l "$roundup_test_name" make
|
||||
- testsudo librechroot -l "$roundup_test_name" clean-repo
|
||||
- testsudo librechroot -l "$roundup_test_name" run test -r /repo/repo.db
|
||||
+ testdoas librechroot -l "$roundup_test_name" make
|
||||
+ testdoas librechroot -l "$roundup_test_name" clean-repo
|
||||
+ testdoas librechroot -l "$roundup_test_name" run test -r /repo/repo.db
|
||||
# TODO: inspect /repo/* more
|
||||
}
|
||||
|
||||
it_respects_exit_status_if_out_isnt_a_tty() (
|
||||
- require network sudo || return 0
|
||||
+ require network doas || return 0
|
||||
set -o pipefail
|
||||
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
|
||||
r=0
|
||||
- { testsudo librechroot -l "$roundup_test_name" run bash -c 'exit 3' | cat; } || r=$?
|
||||
+ { testdoas librechroot -l "$roundup_test_name" run bash -c 'exit 3' | cat; } || r=$?
|
||||
|
||||
[[ $r == 3 ]]
|
||||
)
|
||||
|
||||
it_creates_ca_certificates() {
|
||||
- require network sudo || return 0
|
||||
+ require network doas || return 0
|
||||
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
|
||||
- testsudo librechroot -l "$roundup_test_name" run test -r /etc/ssl/certs/ca-certificates.crt
|
||||
+ testdoas librechroot -l "$roundup_test_name" run test -r /etc/ssl/certs/ca-certificates.crt
|
||||
}
|
||||
|
||||
it_disables_networking_when_requested() {
|
||||
- require network sudo || return 0
|
||||
+ require network doas || return 0
|
||||
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
|
||||
|
||||
- testsudo librechroot -l "$roundup_test_name" run curl https://repo.hyperbola.info:50011/ >/dev/null
|
||||
- not testsudo librechroot -l "$roundup_test_name" -N run curl https://repo.hyperbola.info:50011/ >/dev/null
|
||||
+ testdoas librechroot -l "$roundup_test_name" run curl https://repo.hyperbola.info:50011/ >/dev/null
|
||||
+ not testdoas librechroot -l "$roundup_test_name" -N run curl https://repo.hyperbola.info:50011/ >/dev/null
|
||||
}
|
||||
|
||||
it_handles_CHROOTEXTRAPKG_correctly() {
|
||||
- requuire network sudo || return 0
|
||||
+ requuire network doas || return 0
|
||||
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
|
||||
|
||||
- not testsudo librechroot -l "$roundup_test_name" run lsof
|
||||
+ not testdoas librechroot -l "$roundup_test_name" run lsof
|
||||
echo "CHROOTEXTRAPKG=(lsof)" >> "$XDG_CONFIG_HOME"/libretools/chroot.conf
|
||||
- testsudo librechroot -l "$roundup_test_name" install-name lsof
|
||||
- testsudo librechroot -l "$roundup_test_name" clean-pkgs
|
||||
- testsudo librechroot -l "$roundup_test_name" run lsof
|
||||
+ testdoas librechroot -l "$roundup_test_name" install-name lsof
|
||||
+ testdoas librechroot -l "$roundup_test_name" clean-pkgs
|
||||
+ testdoas librechroot -l "$roundup_test_name" run lsof
|
||||
echo "CHROOTEXTRAPKG=()" >> "$XDG_CONFIG_HOME"/libretools/chroot.conf
|
||||
- testsudo librechroot -l "$roundup_test_name" clean-pkgs
|
||||
- not testsudo librechroot -l "$roundup_test_name" run lsof
|
||||
+ testdoas librechroot -l "$roundup_test_name" clean-pkgs
|
||||
+ not testdoas librechroot -l "$roundup_test_name" run lsof
|
||||
}
|
||||
|
||||
it_displays_help_as_normal_user() {
|
||||
@@ -82,20 +82,20 @@ it_displays_help_and_fails_with_0_args() {
|
||||
[[ "$(sed -n 2p $tmpdir/stderr)" =~ Usage:.* ]]
|
||||
}
|
||||
|
||||
-# requires sudo so we know it's not failing because it needs root
|
||||
+# requires doas so we know it's not failing because it needs root
|
||||
it_fails_for_unknown_commands() {
|
||||
- require sudo || return 0
|
||||
- testsudo librechroot phony >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
|
||||
+ require doas || return 0
|
||||
+ testdoas librechroot phony >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
|
||||
|
||||
[[ $stat != 0 ]]
|
||||
empty $tmpdir/stdout
|
||||
not empty $tmpdir/stderr
|
||||
}
|
||||
|
||||
-# requires sudo so we know it's not failing because it needs root
|
||||
+# requires doas so we know it's not failing because it needs root
|
||||
it_fails_for_unknown_flags() {
|
||||
- require sudo || return 0
|
||||
- testsudo librechroot -q >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
|
||||
+ require doas || return 0
|
||||
+ testdoas librechroot -q >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
|
||||
|
||||
[[ $stat != 0 ]]
|
||||
empty $tmpdir/stdout
|
||||
@@ -103,8 +103,8 @@ it_fails_for_unknown_flags() {
|
||||
}
|
||||
|
||||
it_fails_when_syncing_a_copy_with_itself() {
|
||||
- require sudo || return 0
|
||||
- testsudo timeout 5 librechroot -l root sync || stat=$?
|
||||
+ require doas || return 0
|
||||
+ testdoas timeout 5 librechroot -l root sync || stat=$?
|
||||
case $stat in
|
||||
0|124|137) # success|timeout+TERM|timeout+KILL
|
||||
false;;
|
||||
@@ -114,23 +114,23 @@ it_fails_when_syncing_a_copy_with_itself() {
|
||||
}
|
||||
|
||||
it_deletes_copies() {
|
||||
- require network sudo || return 0
|
||||
+ require network doas || return 0
|
||||
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
|
||||
- testsudo librechroot -l "$roundup_test_name" make
|
||||
+ testdoas librechroot -l "$roundup_test_name" make
|
||||
test -d "$chrootdir/default/$roundup_test_name"
|
||||
- testsudo librechroot -l "$roundup_test_name" delete
|
||||
+ testdoas librechroot -l "$roundup_test_name" delete
|
||||
not test -e "$chrootdir/default/$roundup_test_name"
|
||||
}
|
||||
|
||||
it_deletes_subvolumes_recursively() {
|
||||
- require network sudo btrfs || return 0
|
||||
+ require network doas btrfs || return 0
|
||||
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
|
||||
- testsudo librechroot -l "$roundup_test_name" make
|
||||
- testsudo librechroot -l "$roundup_test_name" run pacman -S --noconfirm btrfs-progs
|
||||
+ testdoas librechroot -l "$roundup_test_name" make
|
||||
+ testdoas librechroot -l "$roundup_test_name" run pacman -S --noconfirm btrfs-progs
|
||||
test -d "$chrootdir/default/$roundup_test_name"
|
||||
not test -e "$chrootdir/default/$roundup_test_name/var/subvolume"
|
||||
- testsudo librechroot -l "$roundup_test_name" run btrfs subvolume create /var/subvolume
|
||||
+ testdoas librechroot -l "$roundup_test_name" run btrfs subvolume create /var/subvolume
|
||||
test -d "$chrootdir/default/$roundup_test_name/var/subvolume"
|
||||
- testsudo librechroot -l "$roundup_test_name" delete
|
||||
+ testdoas librechroot -l "$roundup_test_name" delete
|
||||
not test -e "$chrootdir/default/$roundup_test_name"
|
||||
}
|
||||
diff --git a/test/libremakepkg-test.sh b/test/libremakepkg-test.sh
|
||||
index 3609cb63..b0f0d977 100644
|
||||
--- a/test/libremakepkg-test.sh
|
||||
+++ b/test/libremakepkg-test.sh
|
||||
@@ -6,52 +6,52 @@ describe libremakepkg
|
||||
setup_chrootdir
|
||||
|
||||
it_builds_a_trivial_package() {
|
||||
- require network sudo || return 0
|
||||
+ require network doas || return 0
|
||||
cp libremakepkg.d/PKGBUILD-hello "$tmpdir/PKGBUILD"
|
||||
cd "$tmpdir"
|
||||
|
||||
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
|
||||
- testsudo libremakepkg -l "$roundup_test_name"
|
||||
+ testdoas libremakepkg -l "$roundup_test_name"
|
||||
|
||||
[[ -f $(echo libretools-hello-1.0-1-any.pkg.tar.?z) ]]
|
||||
}
|
||||
|
||||
it_enables_networking_during_prepare() {
|
||||
- require network sudo || return 0
|
||||
+ require network doas || return 0
|
||||
cp libremakepkg.d/PKGBUILD-netprepare "$tmpdir/PKGBUILD"
|
||||
cd "$tmpdir"
|
||||
|
||||
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
|
||||
- testsudo libremakepkg -l "$roundup_test_name"
|
||||
+ testdoas libremakepkg -l "$roundup_test_name"
|
||||
[[ -f $(echo libretools-netprepare-1.0-1-any.pkg.tar.?z) ]]
|
||||
}
|
||||
|
||||
it_disables_networking_during_build() {
|
||||
- require network sudo || return 0
|
||||
+ require network doas || return 0
|
||||
cp libremakepkg.d/PKGBUILD-netbuild "$tmpdir/PKGBUILD"
|
||||
cd "$tmpdir"
|
||||
|
||||
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
|
||||
- not testsudo libremakepkg -l "$roundup_test_name"
|
||||
+ not testdoas libremakepkg -l "$roundup_test_name"
|
||||
not [[ -f $(echo libretools-netbuild-1.0-1-any.pkg.tar.?z) ]]
|
||||
- testsudo libremakepkg -l "$roundup_test_name" -N
|
||||
+ testdoas libremakepkg -l "$roundup_test_name" -N
|
||||
[[ -f $(echo libretools-netbuild-1.0-1-any.pkg.tar.?z) ]]
|
||||
}
|
||||
|
||||
it_disables_networking_during_package() {
|
||||
- require network sudo || return 0
|
||||
+ require network doas || return 0
|
||||
cp libremakepkg.d/PKGBUILD-netpackage "$tmpdir/PKGBUILD"
|
||||
cd "$tmpdir"
|
||||
|
||||
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
|
||||
- not testsudo libremakepkg -l "$roundup_test_name"
|
||||
+ not testdoas libremakepkg -l "$roundup_test_name"
|
||||
not [[ -f $(echo libretools-netpackage-1.0-1-any.pkg.tar.?z) ]]
|
||||
- testsudo libremakepkg -l "$roundup_test_name" -N
|
||||
+ testdoas libremakepkg -l "$roundup_test_name" -N
|
||||
[[ -f $(echo libretools-netpackage-1.0-1-any.pkg.tar.?z) ]]
|
||||
}
|
||||
|
||||
it_cleans_the_chroot_before_building() {
|
||||
- require network sudo || return 0
|
||||
+ require network doas || return 0
|
||||
# 1. First, we build testpkg1
|
||||
# 2. Then, we build testpkg2, which depends on testpkg1
|
||||
# Therefore, testpkg1 will be installed after testpkg2 is built, we
|
||||
@@ -70,28 +70,28 @@ it_cleans_the_chroot_before_building() {
|
||||
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
|
||||
|
||||
cd "$tmpdir/1"
|
||||
- testsudo libremakepkg -l "$roundup_test_name" &> "$tmpdir/out" || { r=$?; tail "$tmpdir/out"|cat -v; return $r; }
|
||||
+ testdoas libremakepkg -l "$roundup_test_name" &> "$tmpdir/out" || { r=$?; tail "$tmpdir/out"|cat -v; return $r; }
|
||||
|
||||
cd "$tmpdir/2"
|
||||
- testsudo libremakepkg -l "$roundup_test_name" &> "$tmpdir/out" || { r=$?; tail "$tmpdir/out"|cat -v; return $r; }
|
||||
- testsudo librechroot -l "$roundup_test_name" run libretools-testpkg1 'first time, pass'
|
||||
+ testdoas libremakepkg -l "$roundup_test_name" &> "$tmpdir/out" || { r=$?; tail "$tmpdir/out"|cat -v; return $r; }
|
||||
+ testdoas librechroot -l "$roundup_test_name" run libretools-testpkg1 'first time, pass'
|
||||
|
||||
# This next line is actually a separate test, but it fits in well with this test, and chroot tests are slow..
|
||||
# it_doesnt_cache_local_packages() {
|
||||
- not testsudo librechroot -l "$roundup_test_name" run test -e /var/cache/pacman/pkg/libretools-testpkg1-1.0-1-any.pkg.tar.?z
|
||||
+ not testdoas librechroot -l "$roundup_test_name" run test -e /var/cache/pacman/pkg/libretools-testpkg1-1.0-1-any.pkg.tar.?z
|
||||
|
||||
cd "$tmpdir/3"
|
||||
- testsudo libremakepkg -l "$roundup_test_name" &> "$tmpdir/out" || { r=$?; tail "$tmpdir/out"|cat -v; return $r; }
|
||||
- not testsudo librechroot -l "$roundup_test_name" run libretools-testpkg1 'second time, fail'
|
||||
+ testdoas libremakepkg -l "$roundup_test_name" &> "$tmpdir/out" || { r=$?; tail "$tmpdir/out"|cat -v; return $r; }
|
||||
+ not testdoas librechroot -l "$roundup_test_name" run libretools-testpkg1 'second time, fail'
|
||||
}
|
||||
|
||||
it_handles_PKGDEST_not_existing() {
|
||||
- require network sudo || return 0
|
||||
+ require network doas || return 0
|
||||
cp libremakepkg.d/PKGBUILD-hello "$tmpdir/PKGBUILD"
|
||||
cd "$tmpdir"
|
||||
|
||||
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
|
||||
- testsudo env PKGDEST="$tmpdir/dest/pkgdest" libremakepkg -l "$roundup_test_name"
|
||||
+ testdoas env PKGDEST="$tmpdir/dest/pkgdest" libremakepkg -l "$roundup_test_name"
|
||||
|
||||
[[ -f $(echo dest/pkgdest/libretools-hello-1.0-1-any.pkg.tar.?z) ]]
|
||||
}
|
||||
@@ -118,7 +118,7 @@ it_otherwise_fails_as_normal_user() {
|
||||
}
|
||||
|
||||
it_fails_if_a_hook_fails() {
|
||||
- require network sudo || return 0
|
||||
+ require network doas || return 0
|
||||
cp libremakepkg.d/PKGBUILD-hello "$tmpdir/PKGBUILD"
|
||||
cd "$tmpdir"
|
||||
local stat=0
|
||||
@@ -127,30 +127,30 @@ it_fails_if_a_hook_fails() {
|
||||
trap 'sed -i s/-bogus// "$XDG_CONFIG_HOME"/libretools/libretools.conf' RETURN
|
||||
|
||||
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
|
||||
- testsudo libremakepkg -l "$roundup_test_name" >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
|
||||
+ testdoas libremakepkg -l "$roundup_test_name" >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
|
||||
|
||||
[[ $stat != 0 ]]
|
||||
tail -n1 $tmpdir/stderr | grep -qF '==> ERROR: Failure(s) in check_pkgbuild: check_pkgbuild_nonfree'
|
||||
}
|
||||
|
||||
it_detects_distcc_files() {
|
||||
- require network sudo || return 0
|
||||
+ require network doas || return 0
|
||||
cp libremakepkg.d/PKGBUILD-hello "$tmpdir/PKGBUILD"
|
||||
cd "$tmpdir"
|
||||
|
||||
echo "CHROOTEXTRAPKG+=(distcc-nozeroconf socat)" >> "$XDG_CONFIG_HOME"/libretools/chroot.conf
|
||||
trap 'sed -i /CHROOTEXTRAPKGs+=/d "$XDG_CONFIG_HOME"/libretools/chroot.conf' RETURN
|
||||
libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty
|
||||
- testsudo librechroot -l "$roundup_test_name" run pacman -S --noconfirm distcc-nozeroconf socat
|
||||
+ testdoas librechroot -l "$roundup_test_name" run pacman -S --noconfirm distcc-nozeroconf socat
|
||||
|
||||
# first make sure that the engine works
|
||||
- testsudo libremakepkg -l "$roundup_test_name"
|
||||
+ testdoas libremakepkg -l "$roundup_test_name"
|
||||
[[ -f $(echo libretools-hello-1.0-1-any.pkg.tar.?z) ]]
|
||||
rm -f -- libretools-hello-1.0-1-any.pkg.tar.?z
|
||||
# now throw a wrench in it
|
||||
- testsudo librechroot -l "$roundup_test_name" run touch /bin/distcc-tool
|
||||
+ testdoas librechroot -l "$roundup_test_name" run touch /bin/distcc-tool
|
||||
# and make sure that the engine broke
|
||||
- testsudo libremakepkg -l "$roundup_test_name" || stat=$?
|
||||
+ testdoas libremakepkg -l "$roundup_test_name" || stat=$?
|
||||
[[ $stat != 0 ]]
|
||||
not [[ -f $(echo libretools-hello-1.0-1-any.pkg.tar.?z) ]]
|
||||
}
|
||||
diff --git a/test/librestage-test.sh b/test/librestage-test.sh
|
||||
index 75450aec..7169df0d 100644
|
||||
--- a/test/librestage-test.sh
|
||||
+++ b/test/librestage-test.sh
|
||||
@@ -45,7 +45,7 @@ it_fails_with_invalid_args() {
|
||||
}
|
||||
|
||||
it_guesses_the_repo() {
|
||||
- nochroot=false; require network sudo || nochroot=true
|
||||
+ nochroot=false; require network doas || nochroot=true
|
||||
mkdir -p -- "$tmpdir/reponame/libretools-hello"
|
||||
cp librestage.d/PKGBUILD-hello "$tmpdir/reponame/libretools-hello/PKGBUILD"
|
||||
cd "$tmpdir/reponame/libretools-hello"
|
||||
@@ -53,7 +53,7 @@ it_guesses_the_repo() {
|
||||
if $nochroot; then
|
||||
makepkg
|
||||
else
|
||||
- testsudo libremakepkg -l "$roundup_test_name"
|
||||
+ testdoas libremakepkg -l "$roundup_test_name"
|
||||
fi
|
||||
librestage
|
||||
|
||||
@@ -63,7 +63,7 @@ it_guesses_the_repo() {
|
||||
}
|
||||
|
||||
it_stages_packages_without_PKGDEST() {
|
||||
- nochroot=false; require network sudo || nochroot=true
|
||||
+ nochroot=false; require network doas || nochroot=true
|
||||
|
||||
echo "PKGDEST=''" >> $XDG_CONFIG_HOME/pacman/makepkg.conf
|
||||
echo "SRCPKGDEST=''" >> $XDG_CONFIG_HOME/pacman/makepkg.conf
|
||||
@@ -74,7 +74,7 @@ it_stages_packages_without_PKGDEST() {
|
||||
if $nochroot; then
|
||||
makepkg
|
||||
else
|
||||
- testsudo libremakepkg -l "$roundup_test_name"
|
||||
+ testdoas libremakepkg -l "$roundup_test_name"
|
||||
fi
|
||||
librestage repo1
|
||||
|
||||
diff --git a/test/test-common.sh b/test/test-common.sh
|
||||
index 3f3763cb..e46872fd 100644
|
||||
--- a/test/test-common.sh
|
||||
+++ b/test/test-common.sh
|
||||
@@ -36,8 +36,8 @@ before() {
|
||||
after() {
|
||||
common_after
|
||||
killall gpg-agent &>/dev/null || true
|
||||
- if [[ -f "$tmpdir/.used-sudo" ]]; then
|
||||
- sudo rm -rf -- "$tmpdir" "$XDG_CONFIG_HOME" "$XDG_CACHE_HOME"
|
||||
+ if [[ -f "$tmpdir/.used-doas" ]]; then
|
||||
+ doas rm -rf -- "$tmpdir" "$XDG_CONFIG_HOME" "$XDG_CACHE_HOME"
|
||||
else
|
||||
rm -rf -- "$tmpdir" "$XDG_CONFIG_HOME" "$XDG_CACHE_HOME"
|
||||
fi
|
||||
@@ -62,12 +62,12 @@ setup_chrootdir() {
|
||||
_cleanup_chrootdir() (
|
||||
chrootdir=$1
|
||||
shopt -s nullglob
|
||||
- if [[ $SUDO ]]; then
|
||||
+ if [[ $DOAS ]]; then
|
||||
if [[ "$(stat -f -c %T "$chrootdir")" == btrfs ]]; then
|
||||
- sudo find "$chrootdir" -depth -inum 256 -exec \
|
||||
+ doas find "$chrootdir" -depth -inum 256 -exec \
|
||||
btrfs subvolume delete {} \; &>/dev/null
|
||||
fi
|
||||
- sudo rm -rf -- "$chrootdir"
|
||||
+ doas rm -rf -- "$chrootdir"
|
||||
else
|
||||
rm -rf -- "$chrootdir"
|
||||
fi
|
||||
@@ -79,8 +79,8 @@ require() (
|
||||
if libremessages in_array "network" "$@" && ! [[ $NETWORK ]]; then
|
||||
missing+=('networking')
|
||||
fi
|
||||
- if libremessages in_array "sudo" "$@" && ! [[ $SUDO ]]; then
|
||||
- missing+=('sudo')
|
||||
+ if libremessages in_array "doas" "$@" && ! [[ $DOAS ]]; then
|
||||
+ missing+=('doas')
|
||||
fi
|
||||
if libremessages in_array "btrfs" "$@" && ! [[ "$(stat -f -c %T "$chrootdir" 2>/dev/null || true)" == 'btrfs' ]]; then
|
||||
missing+=('btrfs')
|
||||
@@ -89,8 +89,8 @@ require() (
|
||||
libremessages warning "Next test requires %s; Skipping (passing)..." "$(echo "${missing[*]}"|sed 's/ /, /g')" &>/dev/tty
|
||||
return 1
|
||||
fi
|
||||
- if libremessages in_array "sudo" "$@"; then
|
||||
- touch "$tmpdir/.used-sudo"
|
||||
+ if libremessages in_array "doas" "$@"; then
|
||||
+ touch "$tmpdir/.used-doas"
|
||||
fi
|
||||
return 0
|
||||
)
|
||||
diff --git a/test/testenv b/test/testenv
|
||||
index 7072326b..6c8860a2 100755
|
||||
--- a/test/testenv
|
||||
+++ b/test/testenv
|
||||
@@ -2,18 +2,18 @@
|
||||
|
||||
# Parse the arguments
|
||||
NETWORK=true
|
||||
-SUDO=true
|
||||
+DOAS=true
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--no-network) shift; unset NETWORK;;
|
||||
--network) shift; NETWORK=true;;
|
||||
- --no-sudo) shift; unset SUDO;;
|
||||
- --sudo) shift; SUDO=true;;
|
||||
+ --no-doas) shift; unset DOAS;;
|
||||
+ --doas) shift; DOAS=true;;
|
||||
--) shift; break;;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
-export NETWORK SUDO
|
||||
+export NETWORK DOAS
|
||||
|
||||
if [[ $# == 0 ]]; then
|
||||
echo 'You need to run testenv with arguments!' >&2
|
||||
@@ -48,22 +48,22 @@ export XDG_CONFIG_HOME="$HOME/.config"
|
||||
export _librelib_conf_sh_sysconfdir="$destdir/etc"
|
||||
export _librelib_conf_sh_pkgconfdir="$destdir/etc/libretools.d"
|
||||
|
||||
-# Hack to respect our variables in sudo
|
||||
-_sudo() {
|
||||
+# Hack to respect our variables in doas
|
||||
+_doas() {
|
||||
local vars=(TMPDIR PATH LIBRETOOLS_LIBDIR XDG_CACHE_HOME XDG_CONFIG_HOME _librelib_conf_sh_sysconfdir)
|
||||
local args=()
|
||||
local var
|
||||
for var in "${vars[@]}"; do
|
||||
args+=("$var=${!var}")
|
||||
done
|
||||
- sudo env "${args[@]}" "$@"
|
||||
+ doas env "${args[@]}" "$@"
|
||||
}
|
||||
printf '%s\n' \
|
||||
'#!/bin/bash' \
|
||||
- "$(declare -f _sudo)" \
|
||||
- '_sudo "$@"' \
|
||||
- > "$destdir/usr/bin/testsudo"
|
||||
-chmod 755 "$destdir/usr/bin/testsudo"
|
||||
+ "$(declare -f _doas)" \
|
||||
+ '_doas "$@"' \
|
||||
+ > "$destdir/usr/bin/testdoas"
|
||||
+chmod 755 "$destdir/usr/bin/testdoas"
|
||||
|
||||
# Run the tests
|
||||
eval "$@"
|
||||
54
libretools/gettext-tiny.patch
Normal file
54
libretools/gettext-tiny.patch
Normal file
@@ -0,0 +1,54 @@
|
||||
diff --git a/INSTALL b/INSTALL
|
||||
index e91f1ea2..f81f5772 100644
|
||||
--- a/INSTALL
|
||||
+++ b/INSTALL
|
||||
@@ -33,7 +33,7 @@ documentation; ronn is required.
|
||||
|
||||
Additionally, other usual "core utilities" are required:
|
||||
|
||||
- cat, chmod, cp, echo, false, find, install, ln, msguniq, rm, tr,
|
||||
+ cat, chmod, cp, echo, false, find, install, ln, rm, tr,
|
||||
xgettext
|
||||
|
||||
Also, `/bin/sh` must support `{brace,expansion}`. If it doesn't, find
|
||||
diff --git a/Makefile b/Makefile
|
||||
index e7b35e41..c656a88d 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -41,7 +41,7 @@ $(outdir)/shellcheck:
|
||||
|
||||
_po_rule = \
|
||||
po/%(pkg).pot: $(addsuffix /everything.pot,$(pkg.%(pkg))); \
|
||||
- cat $^ | msguniq -Fi --to-code=UTF-8 > '$@'
|
||||
+ cat $^
|
||||
$(eval $(foreach pkg,$(pkgs),\
|
||||
$(subst %(pkg),$(pkg),$(value _po_rule))$(at.nl)))
|
||||
|
||||
diff --git a/build-aux/Makefile.once.head/00-libretools.mk b/build-aux/Makefile.once.head/00-libretools.mk
|
||||
index 1f2957d2..38813112 100644
|
||||
--- a/build-aux/Makefile.once.head/00-libretools.mk
|
||||
+++ b/build-aux/Makefile.once.head/00-libretools.mk
|
||||
@@ -92,10 +92,6 @@ libretools.edit = sed \
|
||||
-e 's|m4_include(lib/\(.*\))|. "$$(librelib \1)"|' \
|
||||
$(foreach v,$(patsubst $(var.)%,%,$(filter $(var.)%,$^)), -e 's|@$(v)@|$($(v))|g' )
|
||||
|
||||
-# Usage <INPUT $(libretools.pofmt) >OUTPUT
|
||||
-# Normalize a .po(t) file
|
||||
-libretools.pofmt = msguniq -Fi --to-code=UTF-8
|
||||
-
|
||||
# Auto-detect ########################################################
|
||||
|
||||
# It's easy to think of these as "each" variables, but because they
|
||||
diff --git a/src/lib/librexgettext b/src/lib/librexgettext
|
||||
index a4f2eb99..8b008764 100755
|
||||
--- a/src/lib/librexgettext
|
||||
+++ b/src/lib/librexgettext
|
||||
@@ -220,7 +220,7 @@ main() {
|
||||
xgettext-sh "${simple[@]}" -- "${files[@]}"
|
||||
xgettext-sh "${prose[@]}" -- "${files[@]}" | whitespace-collapse
|
||||
xgettext-flag -- "${files[@]}"
|
||||
- } | sed '/^\#, sh-format/d' | msguniq -Fi --to-code=UTF-8
|
||||
+ } | sed '/^\#, sh-format/d'
|
||||
}
|
||||
|
||||
main "$@"
|
||||
1118
libretools/hyperbola.patch
Normal file
1118
libretools/hyperbola.patch
Normal file
File diff suppressed because it is too large
Load Diff
20
libretools/libretools.install
Normal file
20
libretools/libretools.install
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
# arg 1: the new package version
|
||||
post_install() {
|
||||
librefetch-install install etc/makepkg.conf
|
||||
}
|
||||
|
||||
## arg 1: the new package version
|
||||
## arg 2: the old package version
|
||||
post_upgrade() {
|
||||
if [[ "$(vercmp 20170505 "$2")" -eq 1 ]]; then
|
||||
echo ":: The archroot format has changed from v3 to v4;"
|
||||
echo " you will need delete and re-create your chroots."
|
||||
fi
|
||||
librefetch-install install etc/makepkg.conf
|
||||
}
|
||||
|
||||
pre_remove() {
|
||||
librefetch-install remove etc/makepkg.conf
|
||||
}
|
||||
30
libretools/remove-systemd_stdin_hack.patch
Normal file
30
libretools/remove-systemd_stdin_hack.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
diff --git b/remove-systemd_stdin_hack.patch b/remove-systemd_stdin_hack.patch
|
||||
new file mode 100644
|
||||
index 00000000..e69de29b
|
||||
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
|
||||
index 7b1c8c2c..783d3e57 100755
|
||||
--- a/src/chroot-tools/librechroot
|
||||
+++ b/src/chroot-tools/librechroot
|
||||
@@ -398,14 +398,14 @@ main() {
|
||||
umask 0022
|
||||
|
||||
# XXX: SYSTEMD-STDIN HACK
|
||||
- if ! [[ -t 0 ]]; then
|
||||
- error "Input is not a TTY"
|
||||
- plain "https://labs.parabola.nu/issues/431"
|
||||
- plain "https://bugs.freedesktop.org/show_bug.cgi?id=70290"
|
||||
- prose "Due to a bug in systemd-nspawn, redirecting stdin is not
|
||||
- supported." >&2
|
||||
- return 1
|
||||
- fi
|
||||
+ #if ! [[ -t 0 ]]; then
|
||||
+ # error "Input is not a TTY"
|
||||
+ # plain "https://labs.parabola.nu/issues/431"
|
||||
+ # plain "https://bugs.freedesktop.org/show_bug.cgi?id=70290"
|
||||
+ # prose "Due to a bug in systemd-nspawn, redirecting stdin is not
|
||||
+ # supported." >&2
|
||||
+ # return 1
|
||||
+ #fi
|
||||
|
||||
# Keep this lock for as long as we are running
|
||||
# Note that '9' is the same FD number as in mkarchroot et al.
|
||||
Reference in New Issue
Block a user