36 lines
1.3 KiB
Bash
Executable File
36 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# make generic for an app
|
|
function vscode_install {
|
|
BASH_SHELL_HOST=${BASH_SHELL_HOST:-$(dirname $BASH_SHELL_BASE)/$(hostname)}
|
|
mkdir -p $BASH_SHELL_HOST/apps
|
|
local src
|
|
local target
|
|
local dir="$(dirname $(realpath "${BASH_SOURCE:-$0}"))"
|
|
local script=$dir/vscode.func
|
|
# todo call distro specific install
|
|
[[ ! -f $script ]] && echo can not find script chromium function $script && return 2
|
|
src=$BASH_SHELL_HOST/apps/vscode
|
|
echo installing vscode to $src
|
|
cp $script $src
|
|
target=${1:-/opt/bin}/vscode
|
|
chmod +rx $src
|
|
ln -sf $src $target
|
|
echo link to $src created at $target
|
|
ls -la /opt/bin | grep vscode
|
|
echo with permissions
|
|
ls -la $src
|
|
}
|
|
|
|
code_install_deb() {
|
|
sudo apt-get install wget gpg
|
|
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor >packages.microsoft.gpg
|
|
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
|
|
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
|
|
rm -sudo apt update
|
|
sudo apt install code # or code-insiders
|
|
}
|
|
|
|
# if script was executed then call the function
|
|
(return 0 2>/dev/null) || vscode_install $@
|