259 lines
5.8 KiB
Bash
Executable File
259 lines
5.8 KiB
Bash
Executable File
#!/bin/sh -e
|
|
|
|
. ./os.sh
|
|
|
|
apt_install() {
|
|
DEBIAN_FRONTEND="noninteractive" sudo apt-get install -y "$@"
|
|
}
|
|
|
|
pacman_install() {
|
|
sudo pacman -S --noconfirm --needed "$@"
|
|
}
|
|
|
|
yay_install() {
|
|
packages=""
|
|
for package in "$@"; do
|
|
if ! pacman -Q "${package}" >/dev/null 2>&1; then
|
|
packages="${packages} ${package}"
|
|
fi
|
|
done
|
|
if [ ! -z "${packages}" ]; then
|
|
yay -S --noconfirm --needed ${packages}
|
|
fi
|
|
for package in "$@"; do
|
|
if ! pacman -Q "${package}" >/dev/null 2>&1; then
|
|
return 1 # at least one of the packages has not been correctly installed!
|
|
fi
|
|
done
|
|
return 0
|
|
}
|
|
|
|
pacaur_install() {
|
|
pacaur -S --noconfirm --needed "$@"
|
|
}
|
|
|
|
yaourt_install() {
|
|
yaourt -S --noconfirm --needed "$@"
|
|
}
|
|
|
|
pip3_install() {
|
|
pip3 install --ignore-installed --user -U "$@"
|
|
}
|
|
|
|
pipx_install() {
|
|
for pkg in "$@"; do
|
|
pipx install --force "$pkg"
|
|
done
|
|
}
|
|
|
|
download() {
|
|
curl -L "$@"
|
|
}
|
|
|
|
###
|
|
|
|
# Actual package installation code from here
|
|
|
|
# macOS brew
|
|
|
|
if has_tags pm:brew; then
|
|
brew update
|
|
brew install \
|
|
coreutils \
|
|
libarchive \
|
|
gnu-tar \
|
|
gzip \
|
|
xz \
|
|
jq \
|
|
git \
|
|
gnupg \
|
|
md5sha1sum \
|
|
rxvt-unicode \
|
|
zsh \
|
|
zsh-syntax-highlighting
|
|
fi
|
|
|
|
# Arch Linux
|
|
|
|
if has_tags pm:pacman; then
|
|
# libarchive for bsdtar
|
|
sudo pacman -Sy
|
|
pacman_install \
|
|
base-devel \
|
|
libarchive \
|
|
tar \
|
|
gzip \
|
|
xz \
|
|
jq \
|
|
git \
|
|
gnupg \
|
|
thefuck
|
|
|
|
# yay
|
|
if ! has_tags pm:yay; then
|
|
if has_tags pacaur; then
|
|
pacaur_install yay
|
|
elif has_tags yaourt; then
|
|
yaourt_install yay
|
|
else
|
|
(
|
|
dir="$(mktemp -d)"
|
|
cd "${dir}"
|
|
download https://aur.archlinux.org/cgit/aur.git/snapshot/yay.tar.gz | tar -xz --strip=1
|
|
makepkg -sri --noconfirm
|
|
cd
|
|
rm -rf "${dir}"
|
|
)
|
|
fi
|
|
add_tag pm:yay
|
|
fi
|
|
|
|
# from here on we should have yay available
|
|
yay_install \
|
|
bat \
|
|
customizepkg-git \
|
|
zsh \
|
|
zsh-syntax-highlighting \
|
|
logo-ls \
|
|
viddy
|
|
|
|
if has_tags desktop; then
|
|
yay_install \
|
|
powerline-fonts \
|
|
ttf-nerd-fonts-symbols \
|
|
ttf-nerd-fonts-symbols-common \
|
|
ttf-nerd-fonts-symbols-mono \
|
|
ttf-fira-code \
|
|
ttf-segoe-ui-variable
|
|
fi
|
|
|
|
# pip
|
|
if ! has_tags pm:pip3; then
|
|
yay_install python-pip
|
|
add_tag pm:pip3
|
|
fi
|
|
|
|
# pipx
|
|
if ! has_tags pm:pipx; then
|
|
yay_install python-pipx
|
|
add_tag pm:pipx
|
|
fi
|
|
fi
|
|
|
|
# Debian/Ubuntu-ish
|
|
|
|
if has_tags pm:apt; then
|
|
sudo apt update
|
|
apt_install \
|
|
'^(bsdtar|libarchive-tools)$' \
|
|
tar \
|
|
gzip \
|
|
xz-utils \
|
|
python3-pip \
|
|
python3-venv \
|
|
zsh \
|
|
zsh-syntax-highlighting \
|
|
bat \
|
|
jq \
|
|
git \
|
|
gnupg2
|
|
add_tag pm:pip3
|
|
fi
|
|
|
|
# Python3
|
|
|
|
if has_tags pm:pip3 && ! has_tags pm:pipx; then
|
|
pip3_install \
|
|
pipx
|
|
add_tag pm:pipx
|
|
fi
|
|
|
|
if has_tags pm:pipx; then
|
|
pipx_install \
|
|
powerline-status
|
|
fi
|
|
|
|
# change git user settings
|
|
|
|
set_git_config_if_unset() {
|
|
local name
|
|
local value
|
|
name="$1"
|
|
value="$2"
|
|
if ! git config --global --get "$1" >/dev/null; then
|
|
echo "Configuring global git setting: $1 = $2"
|
|
git config --global "$1" "$2"
|
|
fi
|
|
}
|
|
|
|
clear_git_config_if_pointing_nowhere() {
|
|
local name
|
|
name="$1"
|
|
if git config --global --get "$1" >/dev/null && ! command -v $(git config --global --get "$1") >/dev/null; then
|
|
echo "Resetting global git setting since it no longer points anywhere useful: $1"
|
|
git config --global --unset "$1"
|
|
fi
|
|
}
|
|
|
|
set_git_config_if_unset alias.change-commits '!f() { VAR=$1; OLD=$2; NEW=$3; shift 3; git filter-branch --env-filter \"if [[ \\\"$`echo $VAR`\\\" = '"'"'$OLD'"'"' ]]; then export $VAR='"'"'$NEW'"'"'; fi\" $@; }; f'
|
|
set_git_config_if_unset alias.glog 'log --all --pretty="format:%d %Cgreen%h%Creset %an - %s" --graph'
|
|
set_git_config_if_unset commit.gpgsign true
|
|
set_git_config_if_unset core.autocrlf input
|
|
set_git_config_if_unset core.editor "$EDITOR"
|
|
set_git_config_if_unset init.defaultBranch main
|
|
set_git_config_if_unset pull.rebase false
|
|
set_git_config_if_unset tag.gpgsign true
|
|
set_git_config_if_unset user.email "icedream@icedream.pw"
|
|
set_git_config_if_unset user.name "Carl Kittelberger"
|
|
#set_git_config_if_unset user.signingkey B5108C5A158A6608AD3361DA1573F6D8EFE4D0CF
|
|
set_git_config_if_unset user.signingkey 04ADEF85EA6AEC6F75941E84468BBEEBB9EC6AEA
|
|
set_git_config_if_unset push.autoSetupRemote true
|
|
|
|
# set up git-cola
|
|
set_git_config_if_unset cola.spellcheck false
|
|
set_git_config_if_unset cola.startupmode folder
|
|
|
|
# set up kdiff3 as mergetool if it is installed
|
|
clear_git_config_if_pointing_nowhere merge.tool
|
|
for bin in kdiff3 meld p4merge vimdiff; do
|
|
if command -v "$bin" >/dev/null; then
|
|
set_git_config_if_unset merge.tool "$bin"
|
|
fi
|
|
done
|
|
|
|
# change default terminal to urxvt
|
|
|
|
if has_tags desktop; then
|
|
if has_tags os_like:debian; then
|
|
sudo update-alternatives --config urxvt
|
|
fi
|
|
for de in gnome cinnamon; do
|
|
gsettings set org.${de}.desktop.default-applications.terminal exec /usr/bin/urxvt
|
|
gsettings set org.${de}.desktop.default-applications.terminal exec-arg "-x"
|
|
done
|
|
gsettings set org.cinnamon.desktop.interface font-name 'Sans 9'
|
|
gsettings set org.cinnamon.desktop.screensaver font-date 'Sans 24'
|
|
gsettings set org.cinnamon.desktop.screensaver font-message 'Sans 14'
|
|
gsettings set org.cinnamon.desktop.screensaver font-time 'Sans 64'
|
|
gsettings set org.cinnamon.desktop.wm.preferences titlebar-font 'Sans Bold 9'
|
|
gsettings set org.cinnamon.desktop.wm.preferences titlebar-uses-system-font false
|
|
#gsettings set org.gnome.desktop.interface document-font-name 'Cantarell 11'
|
|
gsettings set org.gnome.desktop.interface font-name 'Sans, 10'
|
|
gsettings set org.gnome.desktop.interface monospace-font-name 'Monospace Regular 10'
|
|
gsettings set org.gnome.desktop.wm.preferences titlebar-font 'Sans Bold 9'
|
|
gsettings set org.gnome.desktop.wm.preferences titlebar-uses-system-font false
|
|
gsettings set org.gnome.libgnomekbd.indicator font-family ''
|
|
gsettings set org.gnome.libgnomekbd.indicator font-size 9
|
|
gsettings set org.nemo.desktop font 'Sans 9'
|
|
gsettings set x.dm.slick-greeter font-name 'Sans 9'
|
|
fi
|
|
|
|
# Go privacy stuff
|
|
|
|
if has_tags go; then
|
|
#go env -u GOPROXY
|
|
#go env -u GOSUMDB
|
|
go env -w GOPROXY direct
|
|
go env -w GOSUMDB off
|
|
fi
|