Move installation scripts to install/ dir

This commit is contained in:
lachtan
2024-09-01 16:24:15 +02:00
parent 36b28ae72e
commit 420f85e31e
25 changed files with 14 additions and 30 deletions

27
install/awscli.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
set -E -o errexit -o nounset -o pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
AWS_CLI_URL="https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"
AWS_CLI_ZIP="/tmp/awscliv2.zip"
AWS_CLI_HOME="$LWS/opt/aws"
function cleanup() {
trap - SIGINT SIGTERM ERR EXIT
rm -f "$AWS_CLI_ZIP"
unset AWS_CLI_URL AWS_CLI_ZIP AWS_CLI_HOME
}
function awscli_install() {
if [[ -d "$AWS_CLI_HOME" ]]; then
echo "awscli already installed"
echo "For reinstall delete $AWS_CLI_HOME directory"
else
wget -O "$AWS_CLI_ZIP" "$AWS_CLI_URL"
atool -X "$LWS/opt/" "$AWS_CLI_ZIP"
ln -s -f "$AWS_CLI_HOME/dist/aws" "$LWS/opt/bin/aws"
fi
}
awscli_install

4
install/docker-ce.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
set -x -e
curl -fsSL https://get.docker.com -o get-docker.sh | sudo bash

6
install/docker-compose-2.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose

8
install/enhancd.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
# https://github.com/b4b4r07/enhancd
brew tap jhawthorn/fzy
brew install fzy ccat percol peco fzf
git clone https://github.com/b4b4r07/enhancd $WORKSPACE/opt/enhancd

13
install/git-prompt.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
set -E -o errexit -o nounset -o pipefail
set -x
GIT_PROMPT_PATH=${GIT_PROMPT_PATH:-$LWS/opt/bash-git-prompt}
readonly REPO="https://github.com/magicmonty/bash-git-prompt.git"
if [[ ! -d "$GIT_PROMPT_PATH" ]]; then
git clone "$REPO" "$GIT_PROMPT_PATH" --depth=1
fi

13
install/go-tools.sh Executable file
View File

@@ -0,0 +1,13 @@
function go_install() {
local module="$1"
echo "Installing $module"
go install ${module}@latest
}
go_install golang.org/x/tools/cmd/goimports
go_install github.com/nsf/gocode
go_install golang.org/x/lint/golint
go_install github.com/godoctor/godoctor
go_install github.com/haya14busa/goplay/cmd/goplay
go_install github.com/rogpeppe/godef
go_install golang.org/x/tools/cmd/gorename

24
install/gw.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
# https://github.com/To-da/gdub
set -e
set -u
readonly REPO="https://github.com/To-da/gdub.git"
readonly GW_PATH="$LWS/opt/gdub"
readonly GW_BIN="$GW_PATH/bin/gw"
readonly OPT_BIN_PATH="$LWS/opt/bin"
if [[ -f "$OPT_BIN_PATH/gw" ]]; then
echo "gw already installed"
exit 0
fi
if [[ ! -d "$GW_PATH" ]]; then
git clone "$REPO" "$GW_PATH"
fi
if [[ ! -d "$OPT_BIN_PATH" ]]; then
mkdir "$OPT_BIN_PATH"
fi
cp "$GW_BIN" "$OPT_BIN_PATH/"

6
install/homebrew.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
# https://docs.brew.sh/Homebrew-on-Linux
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

96
install/k3s.sh Executable file
View File

@@ -0,0 +1,96 @@
#!/usr/bin/env bash
set -E -o errexit -o nounset -o pipefail
readonly SOURCE=${BASH_SOURCE:-k3s-install}
readonly SCRIPT_NAME=$(basename "$SOURCE")
readonly ERROR_CODE=90
function print_help() {
cat <<-EOT
use: $SCRIPT_NAME <action> [args]
actions:
token
server
agent <server-url> <node-token>
status server|agent
config
help
EOT
exit $ERROR_CODE
}
function read_token() {
cat /var/lib/rancher/k3s/server/node-token
}
function install_server() {
curl -sfL https://get.k3s.io | sh -
}
function install_agent() {
curl -sfL https://get.k3s.io | K3S_URL="$1" K3S_TOKEN="$2" sh -
}
function status_server() {
systemctl status k3s
}
function status() {
case $1 in
server)
systemctl status k3s
;;
agent)
systemctl status k3s-agent
;;
*)
echo "Unknown k3s type: $1"
exit $ERROR_CODE
;;
esac
}
function show_config_path() {
echo "/etc/rancher/k3s/k3s.yaml"
}
if [ "$#" == "0" ]; then
print_help
fi
action=$1
shift
case "$action" in
-h|--help|help)
print_help
;;
token)
read_token
;;
server)
install_server
;;
agent)
k3s_url="$1"
k3s_token="$2"
install_agent "$k3s_url" "$k3s_token"
;;
status)
status $1
;;
config)
show_config_path
;;
*)
echo "Unknown action: $action"
exit $ERROR_CODE
;;
esac

12
install/markdown-render.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
cat <<EOT
# STEPS
sudo snap install go
cd ~/src/others/
git clone https://github.com/MichaelMure/mdr
cd mdr
make
cp mdr ~/bin/
EOT

12
install/mdr.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
# git clone https://github.com/MichaelMure/mdr.git ~/src/others/
set -o nounset
set -x
set -e
mdr=$WORKSPACE/opt/bin/mdr
wget https://github.com/MichaelMure/mdr/releases/download/v0.2.5/mdr_linux_amd64 -O $mdr
chmod +x $mdr

10
install/mouse-wheel.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
# https://linuxhint.com/change-mouse-scroll-speed-ubuntu/
MOUSEWHEEL="$LWS/opt/bin/mousewheel.sh"
sudo apt install imwheel
wget -O "$MOUSEWHEEL" http://www.nicknorton.net/mousewheel.sh
chmod +x "$MOUSEWHEEL"
unset MOUSEWHEEL

12
install/new-desktop.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
set -x
sudo snap install gradle --classic
sudo apt install openjdk-11-jdk
$LWS/scripts/git-prompt-install.sh
$LWS/scripts/gw-install.sh
$LWS/scripts/docker-ce-install.sh
$LWS/scripts/docker-compose-2-install.sh
$LWS/scripts/docker-noroot.sh
$LWS/scripts/sublime-install.sh

5
install/packages.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
set -E -o errexit -o nounset -o pipefail
cat $LWS/conf/packages.txt | grep -v '^\s*#' | sudo xargs apt-get install -y

24
install/pwsh.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
set -o errexit -o nounset -o pipefail
set -x
function pwsh_install_dotnet() {
# https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux#install-as-a-net-global-tool
dotnet tool install --global PowerShell
dotnet tool update --global PowerShell
}
function pwsh_install_apt() {
# https://learn.microsoft.com/en-us/powershell/scripting/install/install-ubuntu
sudo apt-get update
sudo apt-get install -y wget apt-transport-https software-properties-common
wget -O /tmp/packages-microsoft-prod.deb "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb"
sudo dpkg -i /tmp/packages-microsoft-prod.deb
rm /tmp/packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y powershell
}
pwsh_install_apt

10
install/rust.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
# https://www.rust-lang.org/tools/install
set -E -o errexit -o nounset -o pipefail
sudo apt install curl -y
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
rustup update

8
install/sdkman.io.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
# https://sdkman.io/install
curl -s "https://get.sdkman.io" | bash
# todo pridat do .bashrc
source "/home/lachtan/.sdkman/bin/sdkman-init.sh"

10
install/spotify.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
# https://www.spotify.com/cz/download/linux/
set -x
curl -sS https://download.spotify.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list
sudo apt-get update && sudo apt-get install spotify-client

12
install/sublime.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
# https://www.sublimetext.com/docs/3/linux_repositories.html#apt
set -x
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt-get update
sudo apt-get install sublime-text

14
install/syncthing.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
# Debian/Ubuntu packages
# https://apt.syncthing.net/
# Configuration
# https://docs.syncthing.net/users/config.html
# Autostart
# https://docs.syncthing.net/users/autostart.html
sudo systemctl enable syncthing@lachtan
sudo systemctl start syncthing@lachtan

9
install/vivaldi.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
set -E -o errexit -o nounset -o pipefail
set -x
wget -qO- https://repo.vivaldi.com/archive/linux_signing_key.pub | gpg --dearmor | sudo dd of=/usr/share/keyrings/vivaldi-browser.gpg
echo "deb [signed-by=/usr/share/keyrings/vivaldi-browser.gpg arch=$(dpkg --print-architecture)] https://repo.vivaldi.com/archive/deb/ stable main" | sudo dd of=/etc/apt/sources.list.d/vivaldi-archive.list
sudo apt update
sudo apt install vivaldi-stable