Update Scripts

This commit is contained in:
Cameron Miller 2021-12-02 15:31:32 +00:00
parent bba11420be
commit 46b42a07c9
5 changed files with 305 additions and 1 deletions

View File

@ -1,7 +1,7 @@
#+TITLE: CBSH Postinstall Scripts (very original name i swear) #+TITLE: CBSH Postinstall Scripts (very original name i swear)
#+DESCRIPTION: A Bunch of Postinstall Scripts im calling CBSH #+DESCRIPTION: A Bunch of Postinstall Scripts im calling CBSH
#+AUTHOR: Cabooshy (Cameron Miller) #+AUTHOR: Cabooshy (Cameron Miller)
#+PROPERTY: header-args :tangle cbsh #+PROPERTY: header-args :tangle cbsh_arch.sh
#+STARTUP: showeverything #+STARTUP: showeverything
* TABLE OF CONTENTS :toc: * TABLE OF CONTENTS :toc:
@ -16,6 +16,13 @@
- [[#shebang-plus-comments][Shebang plus Comments]] - [[#shebang-plus-comments][Shebang plus Comments]]
- [[#check-that-user-is-not-root][Check that user is NOT root!]] - [[#check-that-user-is-not-root][Check that user is NOT root!]]
- [[#error-handling][Error Handling]] - [[#error-handling][Error Handling]]
- [[#sync-the-repos-and-install-dialog][Sync The Repos, and Install 'dialog']]
- [[#sync-the-aur-too][Sync the AUR too.]]
- [[#the-welcome-message][The Welcome Message]]
- [[#adding-the-cbsh-repos-to-your-system][Adding the CBSH Repos to your system.]]
- [[#adding-keyservers-to-gpgconf][Adding keyservers to gpg.conf]]
- [[#installing-the-packages-from-the-repos][Installing the packages from the repos]]
- [[#copying-over-the-configs-from-etccbsh-to-home][Copying over the configs from /etc/cbsh to $HOME]]
* About CBSH * About CBSH
CBSH is the name for a set of Linux Postinstall Scripts that give you my set of programs i use and my Desktop Layout, for both Arch and Debian based distros. CBSH is the name for a set of Linux Postinstall Scripts that give you my set of programs i use and my Desktop Layout, for both Arch and Debian based distros.
@ -50,6 +57,7 @@ So For Example, Updating on Arch would be the standard way, as below:
#+begin_example #+begin_example
sudo pacman -Syu sudo pacman -Syu
#+end_example #+end_example
If you have a AUR Helper installed to, do not forget to add that as well.
And on Debian: And on Debian:
#+begin_example #+begin_example
@ -105,3 +113,88 @@ err() { \
clear; printf "ERR:\\n%s\\n" "$1" >&2; exit 1; clear; printf "ERR:\\n%s\\n" "$1" >&2; exit 1;
} }
#+end_src #+end_src
* Sync The Repos, and Install 'dialog'
#+begin_src bash
echo "##########################################################################"
echo "###### Syncing the Repos and installing 'dialog' if not installed ######"
echo "########################################################################"
sudo pacman --noconfirm --needed -Syu dialog || error "Error syncing the repos."
#+end_src
* Sync the AUR too.
#+begin_src bash
echo "###################################################"
echo "###### install yay and Sync the AUR As Well. ######"
echo "###################################################"
if [!"command -v yay"]; then
sudo pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
makepkg -si
yay -Syu
else
yay -Syu
fi
#+end_src
* The Welcome Message
#+begin_src bash
welcome () { \
dialog --colors --title "\Z7\ZbInstalling CBSH!" --msgbox "\Z4This Postinstall Script will install my Qtile Desktop as well as Doom Emacs, Zsh with the Starship Prompt, the Kitty Shell and some other essential programs to make my dotfiles and programs work.\\n\\n-Cabooshy" 16 60
dialog --colors --title "\Z7\ZbStay Near your PC!" --yes-label "Continue" --no-label "Exit" --yesno "\Z4This script cannot be run as root, but when needed you will be asked for your sudo password during the installation. This will give PACMAN the necessary permissions to install the software needed. So stay near the computer" 10 60
}
welcome || err "User choose to exit."
#+end_src
* Adding the CBSH Repos to your system.
#+begin_src bash
addrepos() { \
echo "####################################################"
echo "## Adding the CBSH repository to /etc/pacman.conf ##"
echo "####################################################"
grep -qxF "[cbsh-arch-repo]" /etc/pacman.conf ||
(echo "[cbsh-arch-repo]"; echo "SigLevel = Required DatabaseOptional"; \
echo "Server = https://gitlab.com/cabooshyy/\$repo/-/raw/main/\$arch") | sudo tee -a /etc/pacman.conf
}
addrepos || err "Error adding the Repo to /etc/pacman.conf."
#+end_src
* Adding keyservers to gpg.conf
#+begin_src bash
addkeyservers() { \
echo "#######################################################"
echo "## Adding Keyservers to /etc/pacman.d/gnupg/gpg.conf ##"
echo "#######################################################"
grep -qxF "keyserver.ubuntu.com:80" /etc/pacman.d/gnupg/gpg.conf || echo "keyserver hkp://keyserver.ubuntu.com:80" | sudo tee -a /etc/pacman.d/gnupg/gpg.conf
grep -qxF "keyserver.ubuntu.com:443" /etc/pacman.d/gnupg/gpg.conf || echo "keyserver hkps://keyserver.ubuntu.com:443" | sudo tee -a /etc/pacman.d/gnupg/gpg.conf
}
addkeyservers || err "Error adding the Keyservers to /etc/pacman.d/gnupg/gpg.conf"
#+end_src
* Installing the packages from the repos
All packages listed are either in the standard Arch Repos or in my CBSH repos. these will all get installed with pacman. the only exception is DOOM Emacs which will be installed later in the script.
~NOTE:~ The `-ask 4` option tells pacman that all questions regarding removing conflicting packages are automatically answered YES
#+begin_src bash
# Let's install all of the packages listed in the pkglist.txt file.
sudo pacman --needed --ask 4 -Sy - < pkglist.txt
#+end_src
* Copying over the configs from /etc/cbsh to $HOME
Pacman cannot install files to $HOME, so normally we place them in /etc/skel, but as some distro's such as Manjaro and Arco use /etc/skel for their own specific config files, we place them in /etc/cbsh so there are no conflicts on any arch based distro. the config files are placed here and then copied over to $HOME, we backup config just in case anything goes wrong. BEWARE!
~NOTE:~ The /etc/cbsh directory contains all of the files and directories that will get automatically copied to a new users $HOME when they are created using `useradd` or `adduser` depending on the distro.
#+begin_src bash
echo "#########################################################"
echo "## Copying the config files from /etc/cbsh into \$HOME ##"
echo "#########################################################"
[ ! -d /etc/cbsh ] && sudo mkdir /etc/cbsh
[ -d /etc/cbsh ] && mkdir ~/cbsh-backup-$(date +%Y.%m.%d-%H%M) && cp -Rf /etc/cbsh ~/cbsh-backup-$(date +%Y.%m.%d-%H%M)
[ ! -d ~/.config ] && mkdir ~/.config
[ -d ~/.config ] && mkdir ~/.config-$(date +%Y.%m.%d-%H%M) && cp -Rf ~/.config ~/.config-backup-$(date +%Y.%m.%d-%H%M)
#+end_src

38
cbsh Executable file
View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
# ____ ____ ____ _ _
# / ___|| __ )/ ___| | | | |
# | | | _ \\___ \ | |_| |
# | |___ | |_) |___) || _ |
# \____||____/|____/ |_| |_|
#
# NAME: CBSH -- ARCH
# DESC: An installation and deployment script that installs Cabooshy's Desktop on Arch Linux and Arch based Distro's
# WARNING: Run this script at your own risk.
# DEPENDENCIES: dialog
if [ "$(id -u)" = 0 ]; then
echo "#######################################################################"
echo "This script MUST NOT be run as root user since it makes changes to the"
echo "\$HOME directory of the \$USER executing this script. We dont want"
echo "those to be 'root' and '/root',We don't want to mess around in there"
echo "and potentially break something, So run this script as a normal user."
echo "You will be asked for a sudo password when necessary."
echo "######################################################################"
exit 1
fi
err() { \
clear; printf "ERR:\\n%s\\n" "$1" >&2; exit 1;
}
echo "########################################################################"
echo "###### Syncing the Repos and installing 'dialog' if not installed ######"
echo "########################################################################"
sudo pacman --noconfirm --needed -Syu dialog || error "Error syncing the repos."
welcome () { \
dialog --colors --title "\Z7\ZbInstalling CBSH!" --msgbox "\Z4This Postinstall Script will install my Qtile Desktop as well as Doom Emacs, Zsh with the Starship Prompt, the Kitty Shell and some other essential programs to make my dotfiles and programs work.\\n\\n-Cabooshy" 16 60
dialog --colors --title "\Z7\ZbStay Near your PC!" --yes-label "Continue" --no-label "Exit" --yesno "\Z4This script cannot be run as root, but when needed you will be asked for your sudo password during the installation. This will give PACMAN the necessary permissions to install the software needed. So stay near the computer" 10 60
}
welcome || err "User choose to exit."

43
cbsh_arch Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/env bash
# ____ ____ ____ _ _
# / ___|| __ )/ ___| | | | |
# | | | _ \\___ \ | |_| |
# | |___ | |_) |___) || _ |
# \____||____/|____/ |_| |_|
#
# NAME: CBSH -- ARCH
# DESC: An installation and deployment script that installs Cabooshy's Desktop on Arch Linux and Arch based Distro's
# WARNING: Run this script at your own risk.
# DEPENDENCIES: dialog
if [ "$(id -u)" = 0 ]; then
echo "#######################################################################"
echo "This script MUST NOT be run as root user since it makes changes to the"
echo "\$HOME directory of the \$USER executing this script. We dont want"
echo "those to be 'root' and '/root',We don't want to mess around in there"
echo "and potentially break something, So run this script as a normal user."
echo "You will be asked for a sudo password when necessary."
echo "######################################################################"
exit 1
fi
err() { \
clear; printf "ERR:\\n%s\\n" "$1" >&2; exit 1;
}
echo "########################################################################"
echo "###### Syncing the Repos and installing 'dialog' if not installed ######"
echo "########################################################################"
sudo pacman --noconfirm --needed -Syu dialog || error "Error syncing the repos."
echo "######################################"
echo "###### Syncing the AUR As Well. ######"
echo "######################################"
yay -Syu
welcome () { \
dialog --colors --title "\Z7\ZbInstalling CBSH!" --msgbox "\Z4This Postinstall Script will install my Qtile Desktop as well as Doom Emacs, Zsh with the Starship Prompt, the Kitty Shell and some other essential programs to make my dotfiles and programs work.\\n\\n-Cabooshy" 16 60
dialog --colors --title "\Z7\ZbStay Near your PC!" --yes-label "Continue" --no-label "Exit" --yesno "\Z4This script cannot be run as root, but when needed you will be asked for your sudo password during the installation. This will give PACMAN the necessary permissions to install the software needed. So stay near the computer" 10 60
}
welcome || err "User choose to exit."

81
cbsh_arch.sh Executable file
View File

@ -0,0 +1,81 @@
#!/usr/bin/env bash
# ____ ____ ____ _ _
# / ___|| __ )/ ___| | | | |
# | | | _ \\___ \ | |_| |
# | |___ | |_) |___) || _ |
# \____||____/|____/ |_| |_|
#
# NAME: CBSH -- ARCH
# DESC: An installation and deployment script that installs Cabooshy's Desktop on Arch Linux and Arch based Distro's
# WARNING: Run this script at your own risk.
# DEPENDENCIES: dialog
if [ "$(id -u)" = 0 ]; then
echo "#######################################################################"
echo "This script MUST NOT be run as root user since it makes changes to the"
echo "\$HOME directory of the \$USER executing this script. We dont want"
echo "those to be 'root' and '/root',We don't want to mess around in there"
echo "and potentially break something, So run this script as a normal user."
echo "You will be asked for a sudo password when necessary."
echo "######################################################################"
exit 1
fi
err() { \
clear; printf "ERR:\\n%s\\n" "$1" >&2; exit 1;
}
echo "##########################################################################"
echo "###### Syncing the Repos and installing 'dialog' if not installed ######"
echo "########################################################################"
sudo pacman --noconfirm --needed -Syu dialog || error "Error syncing the repos."
echo "###################################################"
echo "###### install yay and Sync the AUR As Well. ######"
echo "###################################################"
if [!"command -v yay"]; then
sudo pacman -S --needed git base-devel
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
makepkg -si
yay -Syu
else
yay -Syu
fi
welcome () { \
dialog --colors --title "\Z7\ZbInstalling CBSH!" --msgbox "\Z4This Postinstall Script will install my Qtile Desktop as well as Doom Emacs, Zsh with the Starship Prompt, the Kitty Shell and some other essential programs to make my dotfiles and programs work.\\n\\n-Cabooshy" 16 60
dialog --colors --title "\Z7\ZbStay Near your PC!" --yes-label "Continue" --no-label "Exit" --yesno "\Z4This script cannot be run as root, but when needed you will be asked for your sudo password during the installation. This will give PACMAN the necessary permissions to install the software needed. So stay near the computer" 10 60
}
welcome || err "User choose to exit."
addrepos() { \
echo "####################################################"
echo "## Adding the CBSH repository to /etc/pacman.conf ##"
echo "####################################################"
grep -qxF "[cbsh-arch-repo]" /etc/pacman.conf ||
(echo "[cbsh-arch-repo]"; echo "SigLevel = Required DatabaseOptional"; \
echo "Server = https://gitlab.com/cabooshyy/\$repo/-/raw/main/\$arch") | sudo tee -a /etc/pacman.conf
}
addrepos || err "Error adding the Repo to /etc/pacman.conf."
addkeyservers() { \
echo "#######################################################"
echo "## Adding Keyservers to /etc/pacman.d/gnupg/gpg.conf ##"
echo "#######################################################"
grep -qxF "keyserver.ubuntu.com:80" /etc/pacman.d/gnupg/gpg.conf || echo "keyserver hkp://keyserver.ubuntu.com:80" | sudo tee -a /etc/pacman.d/gnupg/gpg.conf
grep -qxF "keyserver.ubuntu.com:443" /etc/pacman.d/gnupg/gpg.conf || echo "keyserver hkps://keyserver.ubuntu.com:443" | sudo tee -a /etc/pacman.d/gnupg/gpg.conf
}
addkeyservers || err "Error adding the Keyservers to /etc/pacman.d/gnupg/gpg.conf"
# Let's install all of the packages listed in the pkglist.txt file.
sudo pacman --needed --ask 4 -Sy - < pkglist.txt
echo "#########################################################"
echo "## Copying the config files from /etc/cbsh into \$HOME ##"
echo "#########################################################"
[ ! -d /etc/cbsh ] && sudo mkdir /etc/cbsh
[ -d /etc/cbsh ] && mkdir ~/cbsh-backup-$(date +%Y.%m.%d-%H%M) && cp -Rf /etc/cbsh ~/cbsh-backup-$(date +%Y.%m.%d-%H%M)
[ ! -d ~/.config ] && mkdir ~/.config
[ -d ~/.config ] && mkdir ~/.config-$(date +%Y.%m.%d-%H%M) && cp -Rf ~/.config ~/.config-backup-$(date +%Y.%m.%d-%H%M)

49
pkglist.txt Normal file
View File

@ -0,0 +1,49 @@
alacritty
pikaur
base-devel
bash
cups
alacritty-cbsh
dmenu-cbsh
dmenu-scripts
doom-cbsh
kitty-cbsh
qtile-cbsh
st-cbsh
zsh-cbsh
emacs
exa
fd
zsh
git
htop
lolcat
lxappearance
lxsession
mpv
network-manager-applet
pacman-contrib
pcmanfm
picom
qt5ct
qutebrowser
ripgrep
sddm
starship
ttf-ubuntu-font-family
xorg-server
xorg-xkill
xorg-xmessage
xorg-xprop
xorg-xrdb
xorg-xset
xorg-xsetroot
xterm
xf86-video-intel
vim
dunst
xdotool
xev
volumeicon
qtile
element-desktop