shell-things/install

152 lines
4.8 KiB
Plaintext
Raw Normal View History

2014-12-27 10:01:16 +01:00
#!/usr/bin/env bash
# Do not use this script unless you know what you are doing! Even then this
# script isn't that much above `curl | bash`ing
2014-12-27 10:01:16 +01:00
set -x
# If my allowed_signers are present, use them, if not, clone them, and try
# again. The gitconfig expects them here.
if [ -d ~/src/gitea.blesmrt.net/Mikaela/ssh-allowed_signers ]; then
2024-07-30 13:20:32 +02:00
git verify-commit HEAD || exit 1
sleep 3
else
echo "Keys not found, cloning..."
# -vp - verbose, parent. This comment won't be repeated.
mkdir -vp ~/src/gitea.blesmrt.net/Mikaela/
git clone https://gitea.blesmrt.net/Mikaela/ssh-allowed_signers.git ~/src/gitea.blesmrt.net/Mikaela/ssh-allowed_signers
2024-08-08 09:35:20 +02:00
git verify-commit HEAD || exit 1
sleep 3
fi
# marker that I have ran the other script that runs things like installing
# my public keys as authorized. See bottom of this script.
2014-12-27 10:01:16 +01:00
export MIKAELA_GREP=$HOME/.MIKAELA_GREP
# catting the files around, cat used in hopes of not touching permissions
2024-06-11 20:14:38 +02:00
cat rc/bashrc > ~/.bashrc
cat conf/tmux.conf > ~/.tmux.conf
cat rc/zshrc > ~/.zshrc
cat rc/profile > ~/.profile
# Git config, legacy support for old location as well.
# The other script appends sourced file, so if thou aren't I, thou should
# consider it as well; `git config --global --add include.path '~/yourgitconfig'`
2024-06-30 16:37:00 +02:00
mkdir -vp ~/.config/git
2024-06-11 20:14:38 +02:00
cat conf/gitconfig > ~/.config/git/config
2024-02-26 09:03:41 +01:00
touch ~/.gitconfig
2024-02-26 07:37:48 +01:00
rm ~/.gitconfig
2024-05-19 13:07:21 +02:00
ln -nsfv ~/.config/git/config ~/.gitconfig
# Used for `git init` and `git clone`, will contain pre-commit hooks
2024-06-30 16:37:00 +02:00
mkdir -vp ~/.git-template
# {n,neo}vim
2024-06-11 20:14:38 +02:00
cat rc/vimrc > ~/.vimrc
2024-06-30 16:37:00 +02:00
mkdir -vp ~/.config/nvim/
2024-06-11 20:14:38 +02:00
cat conf/init.vim > ~/.config/nvim/init.vim
cat conf/makepkg.conf > ~/.makepkg.conf
# the media player
2024-06-30 16:37:00 +02:00
mkdir -vp ~/.config/mpv/
2024-06-11 20:14:38 +02:00
cat conf/mpv.conf > ~/.config/mpv/mpv.conf
# if I am performing ident spoofing already, I don't want to touch it
2014-12-27 10:01:16 +01:00
if [ ! -f ~/.oidentd.conf ]; then
2024-06-11 20:14:38 +02:00
cat conf/oidentd.conf > ~/.oidentd.conf
2014-12-27 10:01:16 +01:00
fi
# In addition to git, my gnupg configuration should be questioned
2024-06-30 16:37:00 +02:00
mkdir -vp ~/.gnupg
2024-06-11 20:14:38 +02:00
cat gpg/gpg.conf > ~/.gnupg/gpg.conf
cat gpg/gpg-agent.conf > ~/.gnupg/gpg-agent.conf
cat gpg/dirmngr.conf > ~/.gnupg/dirmngr.conf
# Issues with GPG? SIGHUP dirmngr
2019-07-01 10:47:27 +02:00
killall -HUP dirmngr
# I don't remember using these in ages and I don't think they apply to
# wayland
#cat rc/xinitrc > ~/.xinitrc
2024-06-11 20:14:38 +02:00
cat conf/pastebinit.xml > ~/.pastebinit.xml
cat conf/Xresources > ~/.Xresources
# Nice sysinfo script
2024-06-30 16:37:00 +02:00
mkdir -vp ~/.inxi
2024-06-11 20:14:38 +02:00
cat conf/inxi.conf > ~/.inxi/inxi.conf
# laziness
2023-05-18 10:58:51 +02:00
gpg --quiet --import .mikaela/keys/*.asc &
# Utilized by my ssh_config (not to be confused with sshd_config)
2024-06-30 16:37:00 +02:00
mkdir -vp ~/.ssh/sockets/
# It will get used later
2024-06-30 16:37:00 +02:00
mkdir -vp ~/.local/bin/
# Setting permissions
2014-12-27 10:01:16 +01:00
chmod a+xr chmod
2023-05-18 10:58:51 +02:00
bash -x ./chmod &
# The submodules contain nice things such as fonts
git submodule update --init &
2014-12-27 10:01:16 +01:00
# Aforementioned git template directory and pre-commit
2024-06-11 20:14:38 +02:00
if hash pre-commit 2> /dev/null; then
pre-commit init-templatedir ~/.git-template
pre-commit gc
fi
# If symlinks are installed, remove dead/dangling ones from ~/.local/bin
# so corepack won't get confused if those are present
if hash symlinks 2> /dev/null; then
symlinks -d ~/.local/bin/
else
echo "WARNING! Executable named symlinks not found in PATH."
sleep 3
fi
# node package manager manager
if hash corepack 2> /dev/null; then
# Will install symlinks for pnpm, yarn, etc., but not npm unless
# explicitly requested as below
corepack enable --install-directory ~/.local/bin/
corepack enable npm --install-directory ~/.local/bin/
# pnpm can utilize the same packagemanager field as corepack, even when
# used alone
corepack pnpm config set manage-package-manager-versions=true
elif hash pnpm 2> /dev/null; then
# see above which is more relevant in this case
pnpm config set manage-package-manager-versions=true
else
echo "WARNING! corepack is not installed."
sleep 3
fi
# If running as root, which I am doing regardless of not being supposed to,
if [ "$(id -u)" == "0" ]; then
# Enables laziness on checking whether or not apt is installed
mkdir -vp /etc/apt/apt.conf.d/
# Enables progress bar and colours for apt/dpkg, which are helpful at
# times when guesstimating when will things happen
echo 'Dpkg::Progress-Fancy "1";' > /etc/apt/apt.conf.d/99progressbar
echo 'APT::Color "1";' > /etc/apt/apt.conf.d/99color
# If some locate variant is installed, now is a great time to ensure its
# database is up-to-date. This may also enable automated database
# updates.
if hash updatedb 2> /dev/null; then
(updatedb &)
fi
fi
# If the previously mentioned marker is present, include the even more
# questionable script (yay!) into our current execution
2023-05-18 10:58:51 +02:00
if [ -f "$MIKAELA_GREP" ]; then
. .mikaela_install
2014-12-27 10:01:16 +01:00
fi
# If git-lfs is installed, configure git with it, otherwise this will just
# error in forked background process which will no longer hurt the current
# execution.
(git lfs install | true &)
2014-12-27 10:01:16 +01:00
set +x
# vim : set ft=bash :