From a29727acbffb26bc4149bf63ab35f10d9adb5a71 Mon Sep 17 00:00:00 2001 From: Joseph Semrai Date: Wed, 1 Jan 2020 01:50:41 -0500 Subject: [PATCH 1/3] Add vscode installer --- installers/visual-studio-code/installer.sh | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 installers/visual-studio-code/installer.sh diff --git a/installers/visual-studio-code/installer.sh b/installers/visual-studio-code/installer.sh new file mode 100644 index 0000000..e7e435d --- /dev/null +++ b/installers/visual-studio-code/installer.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +YUM_CMD=$(which yum) # yum package manager for RHEL & CentOS +DNF_CMD=$(which dnf) # dnf package manager for new RHEL & CentOS +APT_GET_CMD=$(which apt-get) # apt package manager for Ubuntu & other Debian based distributions +PACMAN_CMD=$(which pacman) # pacman package manager for ArchLinux +APK_CMD=$(which apk) # apk package manager for Alpine + + if [ ! -z $APT_GET_CMD ]; then + sudo apt update + sudo apt install software-properties-common apt-transport-https wget + wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add - + sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" + sudo apt update + sudo apt install code + elif [ ! -z $DNF_CMD ]; then + sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc + sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo' + sudo dnf check-update + sudo dnf install code + elif [ ! -z $YUM_CMD ]; then + sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc + sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo' + sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc + sudo yum check-update + sudo yum install code + elif [ ! -z $PACMAN_CMD ]; then + sudo pacman -Sy + sudo pacman -S git + cd ~/Downloads + git clone https://AUR.archlinux.org/visual-studio-code-bin.git + cd visual-studio-code-bin/ + makepkg -s + sudo pacman -U visual-studio-code-bin-*.pkg.tar.xz + cd ../ && sudo rm -rfv visual-studio-code-bin/ + elif [ ! -z $APK_CMD ]; then + echo "Visual Studio Code does not officially support Alpine Linux. In order to install, you must patch Alpine with glibc and install all apk pre-requisites." + else + echo "Couldn't install package" + exit 1; + fi + +code \ No newline at end of file From aa19c5a9d151d63210868beedd7fc6c86d6cf3b7 Mon Sep 17 00:00:00 2001 From: Joseph Semrai Date: Wed, 1 Jan 2020 13:37:50 -0500 Subject: [PATCH 2/3] Fix reliance on Downloads directory --- installers/visual-studio-code/installer.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/installers/visual-studio-code/installer.sh b/installers/visual-studio-code/installer.sh index e7e435d..961b998 100644 --- a/installers/visual-studio-code/installer.sh +++ b/installers/visual-studio-code/installer.sh @@ -27,14 +27,13 @@ APK_CMD=$(which apk) # apk package manager for Alpine elif [ ! -z $PACMAN_CMD ]; then sudo pacman -Sy sudo pacman -S git - cd ~/Downloads - git clone https://AUR.archlinux.org/visual-studio-code-bin.git + git clone https://AUR.archlinux.org/visual-studio-code-bin.git . cd visual-studio-code-bin/ makepkg -s sudo pacman -U visual-studio-code-bin-*.pkg.tar.xz cd ../ && sudo rm -rfv visual-studio-code-bin/ elif [ ! -z $APK_CMD ]; then - echo "Visual Studio Code does not officially support Alpine Linux. In order to install, you must patch Alpine with glibc and install all apk pre-requisites." + echo "Visual Studio Code does not officially support Alpine Linux. In order to install, you must patch Alpine with glibc and install all APK pre-requisites." else echo "Couldn't install package" exit 1; From f411a6890ecfd79ad7922690ccc9c8539d7afe08 Mon Sep 17 00:00:00 2001 From: Joseph Semrai Date: Fri, 3 Jan 2020 09:53:48 -0500 Subject: [PATCH 3/3] Execute Code with Version Flag --- installers/visual-studio-code/installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installers/visual-studio-code/installer.sh b/installers/visual-studio-code/installer.sh index 961b998..dd84e81 100644 --- a/installers/visual-studio-code/installer.sh +++ b/installers/visual-studio-code/installer.sh @@ -39,4 +39,4 @@ APK_CMD=$(which apk) # apk package manager for Alpine exit 1; fi -code \ No newline at end of file +code -v