PortValhalla/scripts/Debian/Software/Visual Studio Code/install.sh

23 lines
609 B
Bash
Raw Normal View History

2022-11-12 03:15:44 +00:00
#!/bin/bash
# Elevate script
if [ ! "$UID" -eq 0 ]
then
sudo bash "$BASH_SOURCE";
2022-11-13 00:11:32 +00:00
else
apt install -y wget gpg;
2023-01-23 15:11:51 +00:00
keyFile="$(mktemp)";
2022-11-12 03:15:44 +00:00
2022-11-13 00:11:32 +00:00
wget -qO- https://packages.microsoft.com/keys/microsoft.asc \
2023-01-23 15:11:51 +00:00
| gpg --dearmor > "$keyFile";
2022-11-12 03:15:44 +00:00
2023-01-23 15:11:51 +00:00
install -D -o root -g root -m 644 "$keyFile" /etc/apt/keyrings/packages.microsoft.gpg;
2022-11-12 03:15:44 +00:00
2022-11-13 00:11:32 +00:00
echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" \
| tee /etc/apt/sources.list.d/vscode.list;
2022-11-12 03:15:44 +00:00
2023-01-23 15:11:51 +00:00
rm -f "$keyFile";
2022-11-13 00:12:31 +00:00
apt update;
apt install -y code;
2022-11-13 00:11:32 +00:00
fi