Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fixed time lock timeout for apt-get command #431

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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