Update vscode.inst, link directoy to /opt/bin instead of copy to host

master
David Kebler 2023-03-07 11:07:19 -08:00
parent 4e015546ea
commit 95beb818d0
1 changed files with 7 additions and 19 deletions

View File

@ -2,34 +2,22 @@
# 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
[[ ! $(command -v code) ]] && echo "vscode binary (code) at must be installed first" && return 1
[[ ! -f $script ]] && echo can not find vscode function script at $script && return 2
target=${1:-/opt/bin}/vscode
chmod +rx $src
ln -sf $src $target
echo link to $src created at $target
chmod +rx $script
ln -sf $script $target
echo link to $script created at $target
ls -la /opt/bin | grep vscode
echo with permissions
ls -la $src
ls -la $script
}
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 $@