Last active
March 8, 2024 13:27
-
-
Save kxait/82eed64a88b1f6a7703f140228dce5b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# this script sets up my entire pop os workspace just how i like it | |
# it requires downloading citrix workspace and google chrome debs, and an id_rsa with | |
# access to my github account to download dots (may change in the future) | |
# env required: | |
# ICA_DEB = path to icaclient ( citrix workspace ) deb | |
# CHROME_DEB = path to google chrome deb | |
# ID_RSA = path to id_rsa key to be imported | |
# it installs: | |
# - node | |
# - go | |
# - tmux and neovim (compiled from source) | |
# - citrix workspace | |
# - google chrome | |
# - my dots | |
# - my ssh key | |
# - kitty | |
# - jetbrains mono | |
# - docker | |
# - mssql for docker | |
# - fprintd | |
if [ ! -f /tmp/postinst1 ]; then | |
sudo add-apt-repository universe | |
sudo apt install -y libc++-dev cmake autoconf automake pkg-config ncurses-dev fzf ripgrep libevent-dev yacc gettext stow libu2f-udev libspeexdsp1 gnome-terminal ca-certificates curl gnupg lsb-release fprintd libpam-fprintd snapd | |
sudo pam-auth-update | |
touch /tmp/postinst1 | |
else | |
echo 'libraries installed already...' | |
fi | |
if [ -z $(sudo cat /etc/sudoers | grep NOPASSWD) ]; then | |
sudo sed -i 's/%sudo\tALL=(ALL:ALL) ALL/sudo\tALL=(ALL:ALL) NOPASSWD:ALL/' /etc/sudoers | |
else | |
echo 'sudoers have NOPASSWD already...' | |
fi | |
if [ -z $(which npm) ]; then | |
echo 'installing node v20.11.1...' | |
wget --inet4-only https://nodejs.org/dist/v20.11.1/node-v20.11.1-linux-x64.tar.xz -O /tmp/nodejs.tar.xz | |
sudo mkdir -p /usr/local/lib/nodejs | |
sudo tar -xJvf /tmp/nodejs.tar.xz -C /usr/local/lib/nodejs | |
echo 'the specific version of NODE was added to PATH, consider this when changing versions' | |
else | |
echo 'node v20.11.1 already installed...' | |
fi | |
if [ ! -d /usr/local/go/bin ]; then | |
echo 'installing go v1.22.1...' | |
wget --inet4-only https://go.dev/dl/go1.22.1.linux-amd64.tar.gz -O /tmp/go.tar.gz | |
sudo rm -rf /usr/local/go | |
sudo tar -C /usr/local -xzf /tmp/go.tar.gz | |
else | |
echo 'go 1.22.1 already installed...' | |
fi | |
if [ -z $(which nvim) ] && [ -z $(which tmux) ]; then | |
if [ ! -d ~/src ]; then | |
mkdir ~/src | |
fi | |
pushd ~/src | |
if [ ! -d ./tmux ]; then | |
git clone https://github.com/tmux/tmux.git | |
else | |
pushd tmux | |
git pull | |
popd | |
fi | |
if [ ! -d ./neovim ]; then | |
git clone https://github.com/neovim/neovim.git | |
else | |
pushd neovim | |
git pull | |
popd | |
fi | |
pushd tmux | |
echo 'installing LATEST tmux' | |
sh autogen.sh | |
./configure && make && sudo make install | |
popd | |
pushd neovim | |
echo 'installing LATEST neovim' | |
make CMAKE_BUILD_TYPE=RelWithDebInfo | |
sudo make install | |
popd | |
popd | |
else | |
echo 'tmux and neovim installed already...' | |
fi | |
if [ ! -d /opt/Citrix/ICAClient ] && [ ! -z "$ICA_DEB" ]; then | |
sudo dpkg -i "$ICA_DEB" | |
# this settings control what the middle mouse button does - '*' makes the mmb send 'ctrl+v', while setting | |
# it to false sends an mmb signal | |
# 🤦 | |
sudo sed -i 's/MouseSendsControlV=\*/MouseSendsControlV=false/g' /opt/Citrix/ICAClient/Config/All_Regions.ini | |
else | |
echo 'Citrix Workspace already installed or ICA_DEB not provided...' | |
echo 'ICA_DEB = path to icaclient .deb package' | |
fi | |
if [ ! -d /opt/google/chrome ] && [ ! -z "$CHROME_DEB" ]; then | |
sudo dpkg -i "$CHROME_DEB" | |
else | |
echo 'chrome already installed or CHROME_DEB not provided...' | |
echo 'CHROME_DEB = path to chrome .deb package' | |
fi | |
if [ -z $(which dbeaver-ce) ]; then | |
wget --inet4-only https://dbeaver.io/files/dbeaver-ce_latest_amd64.deb -O /tmp/dbeaver.deb | |
sudo dpkg -i /tmp/dbeaver.deb | |
else | |
echo 'dbeaver already installed...' | |
fi | |
if [ -z $(which docker) ]; then | |
sudo install -m 0755 -d /etc/apt/keyrings | |
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc | |
sudo chmod a+r /etc/apt/keyrings/docker.asc | |
echo \ | |
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ | |
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ | |
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt update | |
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | |
else | |
echo 'docker already installed...' | |
fi | |
if [ -z "$(sudo docker ps -a | grep server:2022-latest)" ]; then | |
sudo docker pull mcr.microsoft.com/mssql/server:2022-latest | |
echo 'the MSSQL password must be 8 char long. contain uppercase. lowercase, digit and/or symbol. Linux123 is a valid password.' | |
read -p 'SQL password? ' SQL_PASSWORD | |
sudo docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD='$SQL_PASSWORD'' \ | |
-p 1433:1433 --name sql1 --hostname sql1 \ | |
-d \ | |
mcr.microsoft.com/mssql/server:2022-latest | |
touch /tmp/postinst42 | |
else | |
echo 'mssql on docker already installed...' | |
fi | |
if [ ! -f ~/.ssh/id_rsa_ext ] && [ ! -z "$ID_RSA" ]; then | |
if [ ! -d ~/.ssh ]; then | |
mkdir ~/.ssh | |
fi | |
cp "$ID_RSA" ~/.ssh/id_rsa_ext | |
sudo chmod 700 ~/.ssh/id_rsa_ext | |
ssh-keygen -f ~/.ssh/id_rsa_ext -y > ~/.ssh/id_rsa_ext.pub | |
ssh-add ~/.ssh/id_rsa_ext | |
else | |
echo 'ssh key already installed or ID_RSA not provided...' | |
echo 'ID_RSA = the path to a private RSA key used for ssh' | |
fi | |
if [ ! -d src/dots ] && [ -f ~/.ssh/id_rsa_ext ]; then | |
if [ -f ~/.bashrc ]; then mv -f ~/.bashrc ~/.bashrc.bak; fi | |
if [ -f ~/.profile ]; then mv -f ~/.profile ~/.profile.bak; fi | |
pushd src | |
if [ ! -d dots ]; then | |
git clone git@github.com:kxait/dots.git | |
else | |
pushd dots | |
git pull | |
popd | |
fi | |
pushd dots | |
make delete | |
make | |
popd | |
popd | |
touch /tmp/postinst6 | |
else | |
echo 'dots already installed or ssh key not installed...' | |
fi | |
if [ ! -d ~/.fonts ] || [ -z $(find ~/.fonts | grep JetBrains) ]; then | |
wget --inet4-only https://download.jetbrains.com/fonts/JetBrainsMono-2.304.zip -O /tmp/jbm.zip | |
if [ ! -d ~/.fonts ]; then mkdir ~/.fonts; fi | |
if [ ! -d /tmp/jbm ]; then mkdir /tmp/jbm; fi | |
unzip /tmp/jbm.zip -d /tmp/jbm | |
cp /tmp/jbm/fonts/ttf/* ~/.fonts/ | |
fc-cache -f -v ~/.fonts | |
else | |
echo 'JetBrains Mono already installed' | |
fi | |
if [ ! -d ~/.local/kitty.app ]; then | |
curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin | |
# this makes it show up in the applications menu | |
cp ~/.local/kitty.app/share/applications/kitty.desktop ~/.local/share/applications/kitty.desktop | |
HOME_ESCAPED=$(echo "$HOME" | sed 's/\//\\\//g') | |
# this adds an icon to the application menu entru | |
sed -i 's/Icon=kitty/'$HOME_ESCAPED'\/.local\/kitty.app\/lib\/kitty\/logo\/kitty.png/' ~/.local/share/applications/kitty.desktop | |
# you would have thought the kitty installer would have done this by itself ..... nope | |
else | |
echo 'kitty already installed! =^w^=' | |
fi | |
echo 'done!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment