From 4e6553081c2ed126ebf2db0b53e5d7ae43487fc9 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 4 Sep 2024 16:12:23 +0200 Subject: [PATCH] apt-get: set global options before command The `-y` and `-q` options are global options, and can be set before the command that's run; apt-get --help ... Usage: apt-get [options] command apt-get [options] install|remove pkg1 [pkg2 ...] apt-get [options] source pkg1 [pkg2 ...] Signed-off-by: Sebastiaan van Stijn --- install.sh | 8 ++++---- rootless-install.sh | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 2fd98f7..1f9f506 100755 --- a/install.sh +++ b/install.sh @@ -498,13 +498,13 @@ do_install() { if ! is_dry_run; then set -x fi - $sh_c 'apt-get update -qq >/dev/null' - $sh_c "DEBIAN_FRONTEND=noninteractive apt-get install -y -qq $pre_reqs >/dev/null" + $sh_c 'apt-get -qq update >/dev/null' + $sh_c "DEBIAN_FRONTEND=noninteractive apt-get -y -qq install $pre_reqs >/dev/null" $sh_c 'install -m 0755 -d /etc/apt/keyrings' $sh_c "curl -fsSL \"$DOWNLOAD_URL/linux/$lsb_dist/gpg\" -o /etc/apt/keyrings/docker.asc" $sh_c "chmod a+r /etc/apt/keyrings/docker.asc" $sh_c "echo \"$apt_repo\" > /etc/apt/sources.list.d/docker.list" - $sh_c 'apt-get update -qq >/dev/null' + $sh_c 'apt-get -qq update >/dev/null' ) pkg_version="" if [ -n "$VERSION" ]; then @@ -546,7 +546,7 @@ do_install() { if ! is_dry_run; then set -x fi - $sh_c "DEBIAN_FRONTEND=noninteractive apt-get install -y -qq $pkgs >/dev/null" + $sh_c "DEBIAN_FRONTEND=noninteractive apt-get -y -qq install $pkgs >/dev/null" ) echo_docker_as_nonroot exit 0 diff --git a/rootless-install.sh b/rootless-install.sh index 797df61..08dae10 100755 --- a/rootless-install.sh +++ b/rootless-install.sh @@ -128,7 +128,7 @@ checks() { # uidmap dependency check if ! command -v newuidmap >/dev/null 2>&1; then if command -v apt-get >/dev/null 2>&1; then - INSTRUCTIONS="apt-get install -y uidmap" + INSTRUCTIONS="apt-get -y install uidmap" elif command -v dnf >/dev/null 2>&1; then INSTRUCTIONS="dnf -y install shadow-utils" elif command -v yum >/dev/null 2>&1; then @@ -144,7 +144,7 @@ yum -y install shadow-utils46-newxidmap" if [ -z "$SKIP_IPTABLES" ] && ! command -v iptables >/dev/null 2>&1 && [ ! -f /sbin/iptables ] && [ ! -f /usr/sbin/iptables ]; then if command -v apt-get >/dev/null 2>&1; then INSTRUCTIONS="${INSTRUCTIONS} -apt-get install -y iptables" +apt-get -y install iptables" elif command -v dnf >/dev/null 2>&1; then INSTRUCTIONS="${INSTRUCTIONS} dnf -y install iptables"