Skip to content

Commit fe66109

Browse files
author
Andreas Poulsen
committed
Merge branch 'feature/52552_apt_get_config_dpkg_lock_timeout' into 'master'
Add script to set dpkg lock timeout See merge request os2borgerpc/os2borgerpc-scripts!182
2 parents aa222f8 + 20b667c commit fe66109

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#! /usr/bin/env bash
2+
3+
# This script is used to add or remove the setting dpkg lock timeout "300" from the apt-get configuration
4+
# It takes a single boolean parameter: whether to add the setting or remove it
5+
6+
ACTIVATE=$1
7+
8+
APT_CONFIG_FILE=/etc/apt/apt.conf.d/local
9+
10+
# Always start by trying to remove the line to prevent duplicate entries
11+
sed --in-place '/Dpkg::Lock/d' $APT_CONFIG_FILE
12+
13+
if [ "$ACTIVATE" = "True" ]; then
14+
cat << EOF >> $APT_CONFIG_FILE
15+
Dpkg::Lock {Timeout "300";};
16+
EOF
17+
fi

0 commit comments

Comments
 (0)