From 013e82d56d35b9cdbfaed114a140b2f257637dfe Mon Sep 17 00:00:00 2001 From: askiiart Date: Sun, 10 Sep 2023 12:35:10 -0500 Subject: [PATCH] Move installs, add vs code install --- .gitmodules | 2 +- daily-use-pcs/setup-git.bash | 15 +++++-- do-everything.bash | 6 +++ install-stuff/install-vs-code.bash | 40 +++++++++++++++++++ .../virt-install.bash | 1 - .../zsh}/zsh-files/.oh-my-zsh | 0 .../zsh-files/.zkbd/linux-redhat-linux-gnu | 0 .../zsh}/zsh-files/.zkbd/xterm-256color-:0 | 0 .../zsh}/zsh-files/.zkbd/xterm-256color-_0 | 0 .../.zkbd/xterm-256color-redhat-linux-gnu | 0 .../zsh}/zsh-files/.zkbd/xterm-kitty-:0 | 0 .../zsh}/zsh-files/.zkbd/xterm-kitty-_0 | 0 .../zsh-files/.zkbd/xterm-redhat-linux-gnu | 0 {zsh => install-stuff/zsh}/zsh-files/.zshrc | 0 {zsh => install-stuff/zsh}/zsh-setup.bash | 0 15 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 do-everything.bash create mode 100644 install-stuff/install-vs-code.bash rename qemu-install.bash => install-stuff/virt-install.bash (99%) rename {zsh => install-stuff/zsh}/zsh-files/.oh-my-zsh (100%) rename {zsh => install-stuff/zsh}/zsh-files/.zkbd/linux-redhat-linux-gnu (100%) rename {zsh => install-stuff/zsh}/zsh-files/.zkbd/xterm-256color-:0 (100%) rename {zsh => install-stuff/zsh}/zsh-files/.zkbd/xterm-256color-_0 (100%) rename {zsh => install-stuff/zsh}/zsh-files/.zkbd/xterm-256color-redhat-linux-gnu (100%) rename {zsh => install-stuff/zsh}/zsh-files/.zkbd/xterm-kitty-:0 (100%) rename {zsh => install-stuff/zsh}/zsh-files/.zkbd/xterm-kitty-_0 (100%) rename {zsh => install-stuff/zsh}/zsh-files/.zkbd/xterm-redhat-linux-gnu (100%) rename {zsh => install-stuff/zsh}/zsh-files/.zshrc (100%) rename {zsh => install-stuff/zsh}/zsh-setup.bash (100%) diff --git a/.gitmodules b/.gitmodules index 1f68277..730dfb6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "zsh/zsh-files/.oh-my-zsh"] - path = zsh/zsh-files/.oh-my-zsh + path = install-stuff/zsh/zsh-files/.oh-my-zsh url = https://github.com/askiiart/.oh-my-zsh diff --git a/daily-use-pcs/setup-git.bash b/daily-use-pcs/setup-git.bash index b8aa29b..75e4bab 100755 --- a/daily-use-pcs/setup-git.bash +++ b/daily-use-pcs/setup-git.bash @@ -38,10 +38,17 @@ fi if [ -d "${HOME}/git-credential-manager" ]; then echo "Git Credential Manager already installed, skipping..." else - # Install git credential manager - curl -L https://aka.ms/gcm/linux-install-source.sh | sh - git-credential-manager configure - rm dotnet-install.sh + if command_exists "apt-get"; then + curl $(curl -s https://api.github.com/repos/git-ecosystem/git-credential-manager/releases/latest | grep "browser_download_url.*gcm-linux_amd64.*.deb" | cut -d : -f 2,3 | tr -d \") -LO + chmod 777 ./gcm-linux_amd64.*.deb + sudo apt-get install ./gcm-linux_amd64.*.deb -y + rm -f ./gcm-linux_amd64.*.deb + else + # Install git credential manager + curl -L https://aka.ms/gcm/linux-install-source.sh | sh + git-credential-manager configure + rm dotnet-install.sh + fi fi ############################################ diff --git a/do-everything.bash b/do-everything.bash new file mode 100644 index 0000000..7024e52 --- /dev/null +++ b/do-everything.bash @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +chmod 700 ./daily-use-pcs/setup-git.bash +./daily-use-pcs/setup-git.bash + +chmod 700 ./install-stuff/*.bash +./install-stuff/*.bash \ No newline at end of file diff --git a/install-stuff/install-vs-code.bash b/install-stuff/install-vs-code.bash new file mode 100644 index 0000000..c587573 --- /dev/null +++ b/install-stuff/install-vs-code.bash @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +set -e +if [ $(whoami) == "root" ]; then + echo "Run as a normal user, not root" + exit 1 +fi + +command_exists() { type "$1" &>/dev/null; } + +if command_exists "apt-get"; then + 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 -f packages.microsoft.gpg + sudo apt install apt-transport-https + sudo apt update + sudo apt install code +elif command_exists "yum"; 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' + yum check-update + sudo yum install code -y +elif command_exists "pacman"; then + yay -S visual-studio-code-bin --noconfirm --needed +elif command_exists "zypp"; then + # Untested + 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\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/zypp/repos.d/vscode.repo' + sudo zypper refresh + sudo zypper install code +elif command_exists "emerge"; then + echo Not yet supported, exiting... + exit +elif command_exists "apk"; then + echo Not yet supported, exiting... + exit +else + echo "Unsupported: unknown package manager and distro" +fi diff --git a/qemu-install.bash b/install-stuff/virt-install.bash similarity index 99% rename from qemu-install.bash rename to install-stuff/virt-install.bash index 3dadd1e..41492ed 100644 --- a/qemu-install.bash +++ b/install-stuff/virt-install.bash @@ -27,4 +27,3 @@ elif command_exists "apk"; then else echo "Unsupported: unknown package manager and distro" fi - diff --git a/zsh/zsh-files/.oh-my-zsh b/install-stuff/zsh/zsh-files/.oh-my-zsh similarity index 100% rename from zsh/zsh-files/.oh-my-zsh rename to install-stuff/zsh/zsh-files/.oh-my-zsh diff --git a/zsh/zsh-files/.zkbd/linux-redhat-linux-gnu b/install-stuff/zsh/zsh-files/.zkbd/linux-redhat-linux-gnu similarity index 100% rename from zsh/zsh-files/.zkbd/linux-redhat-linux-gnu rename to install-stuff/zsh/zsh-files/.zkbd/linux-redhat-linux-gnu diff --git a/zsh/zsh-files/.zkbd/xterm-256color-:0 b/install-stuff/zsh/zsh-files/.zkbd/xterm-256color-:0 similarity index 100% rename from zsh/zsh-files/.zkbd/xterm-256color-:0 rename to install-stuff/zsh/zsh-files/.zkbd/xterm-256color-:0 diff --git a/zsh/zsh-files/.zkbd/xterm-256color-_0 b/install-stuff/zsh/zsh-files/.zkbd/xterm-256color-_0 similarity index 100% rename from zsh/zsh-files/.zkbd/xterm-256color-_0 rename to install-stuff/zsh/zsh-files/.zkbd/xterm-256color-_0 diff --git a/zsh/zsh-files/.zkbd/xterm-256color-redhat-linux-gnu b/install-stuff/zsh/zsh-files/.zkbd/xterm-256color-redhat-linux-gnu similarity index 100% rename from zsh/zsh-files/.zkbd/xterm-256color-redhat-linux-gnu rename to install-stuff/zsh/zsh-files/.zkbd/xterm-256color-redhat-linux-gnu diff --git a/zsh/zsh-files/.zkbd/xterm-kitty-:0 b/install-stuff/zsh/zsh-files/.zkbd/xterm-kitty-:0 similarity index 100% rename from zsh/zsh-files/.zkbd/xterm-kitty-:0 rename to install-stuff/zsh/zsh-files/.zkbd/xterm-kitty-:0 diff --git a/zsh/zsh-files/.zkbd/xterm-kitty-_0 b/install-stuff/zsh/zsh-files/.zkbd/xterm-kitty-_0 similarity index 100% rename from zsh/zsh-files/.zkbd/xterm-kitty-_0 rename to install-stuff/zsh/zsh-files/.zkbd/xterm-kitty-_0 diff --git a/zsh/zsh-files/.zkbd/xterm-redhat-linux-gnu b/install-stuff/zsh/zsh-files/.zkbd/xterm-redhat-linux-gnu similarity index 100% rename from zsh/zsh-files/.zkbd/xterm-redhat-linux-gnu rename to install-stuff/zsh/zsh-files/.zkbd/xterm-redhat-linux-gnu diff --git a/zsh/zsh-files/.zshrc b/install-stuff/zsh/zsh-files/.zshrc similarity index 100% rename from zsh/zsh-files/.zshrc rename to install-stuff/zsh/zsh-files/.zshrc diff --git a/zsh/zsh-setup.bash b/install-stuff/zsh/zsh-setup.bash similarity index 100% rename from zsh/zsh-setup.bash rename to install-stuff/zsh/zsh-setup.bash