Skip to content

Commit

Permalink
fix: add fixed time lock timeout on apt-get install/update
Browse files Browse the repository at this point in the history
  • Loading branch information
oreze committed Jul 8, 2024
1 parent dd4d114 commit 211a890
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 -o DPkg::Lock::Timeout=60 update -qq >/dev/null'
$sh_c "DEBIAN_FRONTEND=noninteractive apt-get -o DPkg::Lock::Timeout=60 install -y -qq $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 -o DPkg::Lock::Timeout=60 update -qq >/dev/null'
)
pkg_version=""
if [ -n "$VERSION" ]; then
Expand Down Expand Up @@ -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 -o DPkg::Lock::Timeout=60 install -y -qq $pkgs >/dev/null"
)
echo_docker_as_nonroot
exit 0
Expand Down
8 changes: 4 additions & 4 deletions rootless-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ 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"
if command -v apt-get -o DPkg::Lock::Timeout=60 >/dev/null 2>&1; then
INSTRUCTIONS="apt-get -o DPkg::Lock::Timeout=60 install -y uidmap"
elif command -v dnf >/dev/null 2>&1; then
INSTRUCTIONS="dnf install -y shadow-utils"
elif command -v yum >/dev/null 2>&1; then
Expand All @@ -142,9 +142,9 @@ yum install -y shadow-utils46-newxidmap"

# iptables dependency check
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
if command -v apt-get -o DPkg::Lock::Timeout=60 >/dev/null 2>&1; then
INSTRUCTIONS="${INSTRUCTIONS}
apt-get install -y iptables"
apt-get -o DPkg::Lock::Timeout=60 install -y iptables"
elif command -v dnf >/dev/null 2>&1; then
INSTRUCTIONS="${INSTRUCTIONS}
dnf install -y iptables"
Expand Down

0 comments on commit 211a890

Please sign in to comment.