summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2020-07-14 01:35:02 -0400
committerAndreas Grapentin <andreas@grapentin.org>2022-01-18 17:29:35 +0100
commitf61f91403fe843e6eaf934e733e9a1e13f8e7167 (patch)
treef4da5e448726cd245289ff022d22c62d3fabf583
parent6735ea6816097fb596bad2d39af4686d98115398 (diff)
whitespace
-rw-r--r--src/chroot-tools/chcleanup.in5
-rw-r--r--src/chroot-tools/chroot.conf1
-rwxr-xr-xsrc/chroot-tools/librechroot14
-rwxr-xr-xsrc/chroot-tools/libremakepkg4
-rwxr-xr-xsrc/librefetch/librefetch2
-rwxr-xr-xsrc/pkgbuild-check-nonfree4
-rwxr-xr-xsrc/pkgbuild-summarize-nonfree5
-rwxr-xr-xtest/testenv28
8 files changed, 41 insertions, 22 deletions
diff --git a/src/chroot-tools/chcleanup.in b/src/chroot-tools/chcleanup.in
index e5e7668..b60bd4c 100644
--- a/src/chroot-tools/chcleanup.in
+++ b/src/chroot-tools/chcleanup.in
@@ -26,6 +26,7 @@ set -eE
# Performs chroot cleanup smartly, it only removes the unneeded packages or
# leaves you with a clean system
+
# Library routines #############################################################
# Statically include various library routines to avoid having
@@ -39,6 +40,7 @@ else
_() { echo "$@"; }
fi
+
# Begin chcleanup.lib ##########################################################
m4_include(chcleanup.lib)
# End chcleanup.lib ############################################################
@@ -52,9 +54,11 @@ fi
# Load configuration ###########################################################
CHROOTPKG=(base-devel)
+
# Note: the in-chroot pkgconfdir is non-configurable, this is
# intentionally hard-coded.
source /etc/libretools.d/chroot.conf
+
# If we're running makepkg
if [[ -f ./PKGBUILD ]]; then
if [[ ! -f ./.SRCINFO || ./PKGBUILD -nt ./.SRCINFO ]]; then
@@ -66,6 +70,7 @@ else
DEPENDS=()
fi
+
# Main #########################################################################
msg "Cleaning chroot..."
diff --git a/src/chroot-tools/chroot.conf b/src/chroot-tools/chroot.conf
index 4e3fce5..e9218f4 100644
--- a/src/chroot-tools/chroot.conf
+++ b/src/chroot-tools/chroot.conf
@@ -1,6 +1,7 @@
#!/hint/bash
# shellcheck disable=2034
+
# The full path to the chroot is
# $CHROOTDIR/$CHROOT/$COPY
# where $COPY is set at runtime.
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
index 1c76661..bbc0ec9 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -31,6 +31,7 @@ set -euE
# - the case statement in main() that checks the number of arguments
# - the case statement in main() that runs them
+
. "$(librelib conf)"
. "$(librelib messages)"
. "$(librelib chroot/makechrootpkg)"
@@ -48,9 +49,9 @@ readonly _mkarchroot="$(librelib chroot/mkarchroot)"
arch_nspawn_flags=()
sysd_nspawn_flags=()
+
hack_arch_nspawn_flags() {
local copydir="$1"
-
local makepkg_conf="$copydir/etc/makepkg.conf"
OPTIND=1
@@ -73,7 +74,7 @@ hack_arch_nspawn_flags() {
local setarch interpreter
case $CARCH in
armv7h) setarch=armv7l; interpreter=/usr/bin/qemu-arm-static ;;
- *) setarch=$CARCH; interpreter=/usr/bin/qemu-$CARCH-static ;;
+ *) setarch=$CARCH; interpreter=/usr/bin/qemu-$CARCH-static ;;
esac
if ! setarch $setarch /bin/true 2>/dev/null; then
# We're running a cross-arch chroot
@@ -240,8 +241,8 @@ usage() {
prose 'This command will make the following configuration changes in the
chroot:'
bullet 'overwrite `/etc/libretools.d/chroot.conf`' # libretools/librechroot
- bullet 'overwrite `/etc/pacman.d/mirrorlist`' # devtools/arch-nspawn
- bullet 'set `CacheDir` in `/etc/pacman.conf`' # devtools/arch-nspawn
+ bullet 'overwrite `/etc/pacman.d/mirrorlist`' # devtools/arch-nspawn
+ bullet 'set `CacheDir` in `/etc/pacman.conf`' # devtools/arch-nspawn
prose 'If a new `pacman.conf` is inserted with the `-C` flag, the change
is made after the file is copied in; the `-C` flag doesn'"'"'t
stop the change from being effective.'
@@ -310,7 +311,8 @@ main() {
local mode=enter opt
declare -Ai used_opts
- while getopts 'n:l:NC:M:A:w:r:' opt; do
+
+ while getopts 'n:l:NC:M:A:w:r:' opt; do
case $opt in
n) CHROOT=$OPTARG;;
l) COPY=$OPTARG;;
@@ -344,6 +346,7 @@ main() {
esac
used_opts[$opt]+=1
done
+
for opt in n l C M A; do
if (( ${used_opts[$opt]:-0} > 1 )); then
error "Option -%s may only be given once" "$opt"
@@ -531,4 +534,5 @@ main() {
esac
}
+
main "$@"
diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg
index b427fd0..10292c7 100755
--- a/src/chroot-tools/libremakepkg
+++ b/src/chroot-tools/libremakepkg
@@ -72,7 +72,6 @@ exit_copy() {
run_hook() {
local hookname=$1; shift
local hookvar="hook_${hookname}[@]"
-
local fails=()
for hook in "${!hookvar}"; do
@@ -169,13 +168,11 @@ usage() {
the documentation there.'
echo
print 'Options:'
-
flag 'librechroot options:' \
"-n <$(_ CHROOT)>" 'Name of the chroot to use' \
"-l <$(_ COPY)>" 'Name of, or absolute path to, the chroot copy to use' \
"-w <$(_ 'PATH[:INSIDE_PATH[:OPTIONS]]')>" 'Bind mount a file or directory, read/write' \
"-r <$(_ 'PATH[:INSIDE_PATH[:OPTIONS]]')>" 'Bind mount a file or directory, read-only'
-
flag 'libremakepkg options:' \
'-N' "Don't disable networking during prepare(),
build(), and package(). PLEASE don't use
@@ -342,4 +339,5 @@ main() {
add_to_local_repo "$copydir" "$copydir"/pkgdest/*.pkg.tar* |& indent
}
+
main "$@"
diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch
index 93537cd..ed354c6 100755
--- a/src/librefetch/librefetch
+++ b/src/librefetch/librefetch
@@ -38,6 +38,7 @@ setup_traps
tmpfiles=()
tmpdirs=()
+
trap 'rm -f -- "${tmpfiles[@]}"; rm -rf -- "${tmpdirs[@]}"' EXIT
cmd=${0##*/}
@@ -405,4 +406,5 @@ create_signature() {
fi
}
+
main "$@"
diff --git a/src/pkgbuild-check-nonfree b/src/pkgbuild-check-nonfree
index ccc846b..8d9ee83 100755
--- a/src/pkgbuild-check-nonfree
+++ b/src/pkgbuild-check-nonfree
@@ -27,10 +27,12 @@
# I appologize that this program got *huge*.
# It's not complicated, just long.
+
. "$(librelib messages)"
. "$(librelib conf)"
. "$(librelib blacklist)"
+
usage() {
print "Usage: %s [OPTIONS] [PKGBUILD1 PKGBUILD2 ...]" "${0##*/}"
print "Analyzes a PKGBUILD for freedom issues"
@@ -132,6 +134,7 @@ pkgbuild_get_pkg_str() {
eval "$(declare -f "package_$pkg" | sed -rn "s/^\s*${var}(\+?=)/indirect\1/p")"
printf '%s' "${indirect}"
}
+
# Usage: eval $(pkgbuild_get_pkg_ary ${pkgname} ${varname} [$variable_name_to_set])
# Gets a package-level array for a split-package
pkgbuild_get_pkg_ary() {
@@ -193,6 +196,7 @@ check_dep() {
local line rep
line="$(blacklist-cat|blacklist-lookup "$pkg")"
rep="$(blacklist-get-rep <<<"$line")"
+
if [[ -z $line ]]; then
# not mentioned in blacklist; free
info '%s: not blacklisted' "$pkg"
diff --git a/src/pkgbuild-summarize-nonfree b/src/pkgbuild-summarize-nonfree
index 4bd76bb..2cf5ea6 100755
--- a/src/pkgbuild-summarize-nonfree
+++ b/src/pkgbuild-summarize-nonfree
@@ -18,6 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
+
. "$(librelib messages)"
# Make sure these match pkgbuild-check-nonfree
@@ -28,6 +29,7 @@ declare -ri _E_LIC_NONFREE=8
declare -ri _E_DEP_NONFREE=16
declare -ri _E_PKG_NONFREE=32
+
usage() {
print "Usage: %s [OPTIONS] STATUS" "${0##*/}"
print "Summarizes a status code from pkgbuild-check-nonfree"
@@ -75,6 +77,7 @@ parse() {
declare -i ret=$EXIT_SUCCESS
declare -i i
+
for i in 1 2 4 8 16 32; do
if [[ $((s & i)) -gt 0 ]]; then
case $i in
@@ -98,7 +101,9 @@ parse() {
esac
fi
done
+
return $ret
}
+
main "$@"
diff --git a/test/testenv b/test/testenv
index 11a46ee..ee89f4c 100755
--- a/test/testenv
+++ b/test/testenv
@@ -3,21 +3,21 @@
set -e
# Parse the arguments
- NETWORK=true
- SUDO=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;;
- --) shift; break;;
- *) break;;
- esac
- done
- export NETWORK SUDO
+ NETWORK=true
+ SUDO=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;;
+ --) shift; break;;
+ *) break;;
+ esac
+ done
+ export NETWORK SUDO
- if [[ $# == 0 ]]; then
+ if [[ $# == 0 ]]; then
echo 'You need to run testenv with arguments!' >&2
exit 1
fi