Skip to content

Commit bb22bd4

Browse files
committed
Added the possibility of intercepting the interrupt signal process.
1 parent 19794fe commit bb22bd4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

aut-apps.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@ if [[ $EUID -ne 0 ]]; then
33
echo "This script must be run as root" 1>&2
44
exit 1
55
fi
6+
function t-d-uninstaller {
7+
rm -rf $tmp_dir
8+
echo "Temporary directory uninstalled"
9+
exit 1
10+
}
611
tmp_dir=$(mktemp -d -t pub_key-XXXXXX)
12+
trap t-d-uninstaller SIGINT SIGTERM
713
echo $tmp_dir
814
echo 'deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main'>/etc/apt/sources.list.d/google-chrome.list
915
echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list
1016
curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add linux_signing_key.pub
1117
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > $tmp_dir/microsoft.gpg
12-
install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
18+
install -o root -g root -m 644 $tmp_dir/microsoft.gpg /etc/apt/trusted.gpg.d/
1319
apt update
1420
echo 'Start install'
1521
apt-get -y install google-chrome-stable git apt-transport-https code
16-
rm -rf $tmp_dir
17-
echo 'Complete'
22+
t-d-uninstaller

0 commit comments

Comments
 (0)