mirror of
				https://gitea.blesmrt.net/mikaela/shell-things.git
				synced 2025-11-04 11:27:38 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			509 lines
		
	
	
		
			23 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			509 lines
		
	
	
		
			23 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/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
 | 
						|
set -x
 | 
						|
 | 
						|
# Workaround Chromium selectively understanding --disk-cache-dir=nul
 | 
						|
ln -nsfv /dev/null $HOME/nul
 | 
						|
ln -nsfv /dev/null $HOME/null
 | 
						|
 | 
						|
# Of course LaTeX templates exist
 | 
						|
mkdir -vp ~/texmf/tex/latex/local
 | 
						|
 | 
						|
# If my allowed_signers are present, use them, if not, clone them, and try
 | 
						|
# again. The gitconfig expects them here.
 | 
						|
if [ -d $HOME/src/codeberg.org/Aminda/ssh-allowed_signers ]; then
 | 
						|
	echo "git config --global gpg.ssh.allowedSignersFile $HOME/src/codeberg.org/Aminda/ssh-allowed_signers/allowed_signers"
 | 
						|
	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 $HOME/src/codeberg.org/Aminda/
 | 
						|
	git clone https://codeberg.org/Aminda/ssh-allowed_signers.git $HOME/src/codeberg.org/Aminda/ssh-allowed_signers
 | 
						|
	echo "git config --global gpg.ssh.allowedSignersFile $HOME/src/codeberg.org/Aminda/ssh-allowed_signers/allowed_signers"
 | 
						|
	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.
 | 
						|
export MIKAELA_GREP=$HOME/.MIKAELA_GREP
 | 
						|
 | 
						|
# Copying files in places
 | 
						|
cp -v rc/bashrc $HOME/.bashrc
 | 
						|
cp -v conf/tmux.conf $HOME/.tmux.conf
 | 
						|
cp -v rc/zshrc $HOME/.zshrc
 | 
						|
cp -v rc/profile $HOME/.profile
 | 
						|
 | 
						|
# Create configuration directories missed later
 | 
						|
mkdir -vp $HOME/.config/{autostart,bat,foot,git,MangoHud,mpv,nvim,systemd/user,yt-dlp}/
 | 
						|
 | 
						|
# terminfo just in case it needs to be copied to remote system
 | 
						|
mkdir -vp $HOME/.terminfo/{A..z}
 | 
						|
 | 
						|
# 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 '$HOME/yourgitconfig'`
 | 
						|
cp -v conf/gitconfig $HOME/.config/git/config
 | 
						|
touch $HOME/.gitconfig
 | 
						|
rm $HOME/.gitconfig
 | 
						|
ln -nsfv $HOME/.config/git/config $HOME/.gitconfig
 | 
						|
# Used for `git init` and `git clone`, will contain pre-commit hooks
 | 
						|
mkdir -vp $HOME/.git-template
 | 
						|
 | 
						|
# {n,neo}vim
 | 
						|
cp -v rc/vimrc $HOME/.vimrc
 | 
						|
cp -v conf/init.vim $HOME/.config/nvim/init.vim
 | 
						|
cp -v conf/makepkg.conf $HOME/.makepkg.conf
 | 
						|
 | 
						|
# system information overlay
 | 
						|
if [ ! -f $HOME/.config/MangoHud/MangoHud.conf ]; then
 | 
						|
	cp -v conf/MangoHud.conf $HOME/.config/MangoHud/
 | 
						|
fi
 | 
						|
 | 
						|
# Default cursor font
 | 
						|
if [[ ! -f $HOME/.local/share/icons/default/index.theme && -f /usr/share/icons/Oxygen_Yellow/index.theme ]]; then
 | 
						|
	mkdir -vp $HOME/.local/share/icons/default/
 | 
						|
	cp -v local/share/icons/default/index.theme $HOME/.local/share/icons/default/
 | 
						|
fi
 | 
						|
 | 
						|
# wayland native terminal
 | 
						|
if [ ! -f $HOME/.config/foot/foot.ini ]; then
 | 
						|
	cp -v conf/foot/foot.ini $HOME/.config/foot/foot.ini
 | 
						|
fi
 | 
						|
 | 
						|
#  A cat(1) clone with wings.
 | 
						|
if hash bat 2> /dev/null; then
 | 
						|
	mkdir -vp $(bat --config-dir)
 | 
						|
	if [ ! -f $(bat --config-file) ]; then
 | 
						|
		bat --generate-config-file
 | 
						|
		cat conf/bat.conf >> $(bat --config-file)
 | 
						|
	fi
 | 
						|
fi
 | 
						|
 | 
						|
# the media player
 | 
						|
cp -v conf/mpv.conf $HOME/.config/mpv/mpv.conf
 | 
						|
mkdir -vp $HOME/.var/app/io.mpv.Mpv/config/mpv
 | 
						|
cp -v conf/mpv.conf $HOME/.var/app/io.mpv.Mpv/config/mpv/mpv.conf
 | 
						|
 | 
						|
# Create KDE expected config files
 | 
						|
touch $HOME/.config/k{screenlocker,xkb}rc
 | 
						|
 | 
						|
# if I am performing ident spoofing already, I don't want to touch it
 | 
						|
if [ ! -f $HOME/.oidentd.conf ]; then
 | 
						|
	cp -v conf/oidentd.conf $HOME/.oidentd.conf
 | 
						|
fi
 | 
						|
 | 
						|
# In addition to git, my gnupg configuration should be questioned
 | 
						|
mkdir -vp $HOME/.gnupg
 | 
						|
cp -v gpg/gpg.conf $HOME/.gnupg/gpg.conf
 | 
						|
cp -v gpg/gpg-agent.conf $HOME/.gnupg/gpg-agent.conf
 | 
						|
cp -v gpg/dirmngr.conf $HOME/.gnupg/dirmngr.conf
 | 
						|
# Issues with GPG? SIGHUP dirmngr
 | 
						|
killall -HUP dirmngr
 | 
						|
 | 
						|
# I don't remember using these in ages and I don't think they apply to
 | 
						|
# wayland
 | 
						|
#cp -v rc/xinitrc $HOME/.xinitrc
 | 
						|
cp -v conf/pastebinit.xml $HOME/.pastebinit.xml
 | 
						|
cp -v conf/Xresources $HOME/.Xresources
 | 
						|
 | 
						|
# Nice sysinfo script
 | 
						|
mkdir -vp $HOME/.inxi
 | 
						|
cp -v conf/inxi.conf $HOME/.inxi/inxi.conf
 | 
						|
 | 
						|
# laziness
 | 
						|
if [ -d submodules/pgp-alt-wot/me ]; then
 | 
						|
	gpg --quiet --import submodules/pgp-alt-wot/me/*.asc &
 | 
						|
else
 | 
						|
	gpg --quiet --import .mikaela/keys/*.asc &
 | 
						|
fi
 | 
						|
 | 
						|
# Utilized by my ssh_config (not to be confused with sshd_config)
 | 
						|
mkdir -vp $HOME/.ssh/sockets/
 | 
						|
 | 
						|
# It will get used later
 | 
						|
mkdir -vp $HOME/.local/bin/
 | 
						|
 | 
						|
# Setting permissions
 | 
						|
chmod a+xr chmod
 | 
						|
bash -x ./chmod &
 | 
						|
 | 
						|
# The submodules contain nice things such as fonts
 | 
						|
git submodule update &
 | 
						|
git gc &
 | 
						|
 | 
						|
# Aforementioned git template directory and pre-commit
 | 
						|
if hash pre-commit 2> /dev/null; then
 | 
						|
	pre-commit init-templatedir $HOME/.git-template
 | 
						|
	pre-commit gc
 | 
						|
fi
 | 
						|
 | 
						|
# If symlinks are installed, remove dead/dangling ones from $HOME/.local/bin
 | 
						|
# so corepack won't get confused if those are present
 | 
						|
if hash symlinks 2> /dev/null; then
 | 
						|
	symlinks -d $HOME/.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 $HOME/.local/bin/
 | 
						|
	corepack enable npm --install-directory $HOME/.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
 | 
						|
 | 
						|
	# Fedora Atomic compatibility
 | 
						|
	if [ -d /var/roothome ]; then
 | 
						|
		chmod -v a+x /var/roothome
 | 
						|
	fi
 | 
						|
 | 
						|
	# Desktop entries
 | 
						|
	mkdir -vp /usr/local/share/applications/
 | 
						|
	cp -v local/share/applications/*.desktop /usr/local/share/applications/
 | 
						|
 | 
						|
	# Additional configuration for sudo SECURITY WARNING DANGER ALARM BELLS!
 | 
						|
	if [ -d /etc/sudoers.d ]; then
 | 
						|
		cp -v etc/sudoers.d/{lecture,password-feedback,always-ask-password,envkeep-extras} /etc/sudoers.d/
 | 
						|
	fi
 | 
						|
 | 
						|
	# Profile configuration. SECURITY WARNING
 | 
						|
	cp -v etc/profile.d/*.sh /etc/profile.d/
 | 
						|
	chmod -v a+r /etc/profile.d/*.sh
 | 
						|
 | 
						|
	# Kernel configuration. SECURITY WARNING
 | 
						|
	cp -v etc/sysctl.d/*.conf /etc/sysctl.d/
 | 
						|
	chmod -v a+r /etc/sysctl.d/*.conf
 | 
						|
	(sysctl -p --system &)
 | 
						|
 | 
						|
	# udev configuration. SECURITY WARNING
 | 
						|
	mkdir -vp /etc/udev/rules.d/
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/steam-devices/*.rules /etc/udev/rules.d/
 | 
						|
 | 
						|
	# SSHd hardening hopefully. SECURITY WARNING
 | 
						|
	mkdir -vp /etc/ssh/sshd_config.d/
 | 
						|
	chmod -v a+x /etc/ssh/sshd_config.d/
 | 
						|
	cp etc/ssh/sshd_config.d/{00-basic-security.conf,01-acceptenv.conf} /etc/ssh/sshd_config.d/
 | 
						|
	chmod -v a+r /etc/ssh/sshd_config.d/*.conf
 | 
						|
 | 
						|
	# Systemd configuration directories. SECURITY WARNINGS!
 | 
						|
	mkdir -vp /etc/systemd/{system,system-preset,user,network}/
 | 
						|
	mkdir -vp /etc/systemd/system/{app.slice.d,service.d,socket.d}/
 | 
						|
	cp -v etc/systemd/system/app.slice.d/90-cpuquota.conf /etc/systemd/system/app.slice.d/90-cpuquota.conf
 | 
						|
	mkdir -vp /etc/systemd/{coredump,login,oomd,journald,resolved,system,timesyncd}.conf.d/
 | 
						|
	cp -v etc/systemd/oomd.conf.d/20-oomd.conf /etc/systemd/oomd.conf.d/20-oomd.conf
 | 
						|
	mkdir -vp /etc/systemd/system/{aminda-duperemove,aminda-nocron-reboot,ssh,sshd,sshguard,systemd-resolved,systemd-networkd,monthly-btrfs-balance,NetworkManager,iwd,unbound,tor,oidentd,yggdrasil}.service.d/
 | 
						|
	mkdir -vp /etc/systemd/system/{ssh,sshd,oidentd}.socket.d/
 | 
						|
	# SECURITY WARNING!
 | 
						|
	cp -v etc/systemd/system/service.d/rngd-wanted.conf /etc/systemd/system/service.d/
 | 
						|
	cp -v etc/systemd/system/socket.d/{dualstack-bind,freebind,upheld}.conf /etc/systemd/system/socket.d/
 | 
						|
	# SECURITY WARNING!
 | 
						|
	cp -v etc/systemd/system/service.d/never-fail.conf /etc/systemd/system/ssh.service.d/
 | 
						|
	cp -v etc/systemd/system/service.d/never-fail.conf /etc/systemd/system/sshd.service.d/
 | 
						|
	cp -v etc/systemd/system/service.d/never-fail.conf /etc/systemd/system/sshguard.service.d/
 | 
						|
	cp -v etc/systemd/system/service.d/never-fail.conf /etc/systemd/system/systemd-resolved.service.d/
 | 
						|
	cp -v etc/systemd/system/service.d/never-fail.conf /etc/systemd/system/systemd-networkd.service.d/
 | 
						|
	cp -v etc/systemd/system/service.d/never-fail.conf /etc/systemd/system/oidentd.service.d/
 | 
						|
	cp -v etc/systemd/system/service.d/never-fail.conf /etc/systemd/system/NetworkManager.service.d/
 | 
						|
	cp -v etc/systemd/system/service.d/never-fail.conf /etc/systemd/system/iwd.service.d/
 | 
						|
	cp -v etc/systemd/system/service.d/never-fail.conf /etc/systemd/system/unbound.service.d/
 | 
						|
	cp -v etc/systemd/system/service.d/never-fail.conf /etc/systemd/system/tor.service.d/
 | 
						|
	cp -v etc/systemd/system/service.d/never-fail.conf /etc/systemd/system/yggdrasil.service.d/
 | 
						|
	#cp -v etc/systemd/system/socket.d/dualstack-bind.conf /etc/systemd/system/ssh.socket.d/
 | 
						|
	#cp -v etc/systemd/system/socket.d/dualstack-bind.conf /etc/systemd/system/sshd.socket.d/
 | 
						|
	#cp -v etc/systemd/system/socket.d/dualstack-bind.conf /etc/systemd/system/oidentd.socket.d/
 | 
						|
	rm -v /etc/systemd/system/*.socket.d/dualstack-bind.conf
 | 
						|
 | 
						|
	# SECURITY WARNING! Automatic flatpak updates
 | 
						|
	if hash flatpak 2> /dev/null; then
 | 
						|
		cp -v etc/systemd/system/flatpak-update.{timer,service} /etc/systemd/system/
 | 
						|
	fi
 | 
						|
 | 
						|
	# STRANGE BEHAVIOUR WARNING IF NOT ME.
 | 
						|
	cp -v etc/systemd/system/{aminda-nocron-reboot,aminda-nocron-rebootish,sysctl-p--system}.service /etc/systemd/system/
 | 
						|
	cp -v etc/systemd/system/{aminda-nocron-reboot,aminda-nocron-rebootish,sysctl-p--system}.timer /etc/systemd/system/
 | 
						|
	# This is now how I assume Kinoite
 | 
						|
	if [ -f /usr/etc/rpm-ostreed.conf ]; then
 | 
						|
		cp -v etc/systemd/system/{aminda-duperemove,monthly-btrfs-balance}.service /etc/systemd/system/
 | 
						|
		cp -v etc/systemd/system/{aminda-duperemove,monthly-btrfs-balance}.timer /etc/systemd/system/
 | 
						|
		# As we are Kinoite/Atomic and known to use BTRFS
 | 
						|
		cp -v etc/systemd/system/aminda-duperemove.service.d/{90-btrfs-balance,91-fedora-atomic}.conf /etc/systemd/system/aminda-duperemove.service.d/
 | 
						|
		cp -v etc/systemd/system/monthly-btrfs-balance.service.d/fedora-atomic.conf /etc/systemd/system/monthly-btrfs-balance.service.d/
 | 
						|
	fi
 | 
						|
 | 
						|
	if hash systemctl 2> /dev/null; then
 | 
						|
		systemctl daemon-reload
 | 
						|
		(systemctl --global enable darkman.service &)
 | 
						|
		# SECURITY WARNING! Practically a backdoor unless you are me and expect this!
 | 
						|
		# WARNING! Likely breaks SSHd outside of port 22 unless override exists!
 | 
						|
		(systemctl --global enable foot-server.socket &)
 | 
						|
		(systemctl enable --now ssh.socket &)
 | 
						|
		(systemctl enable --now sshd.socket &)
 | 
						|
		(systemctl enable --now avahi-daemon.socket &)
 | 
						|
		(systemctl enable --now systemd-oomd.socket &)
 | 
						|
		(systemctl enable --now oidentd.socket &)
 | 
						|
 | 
						|
		# sshd is critical and I don't want it to fail due to the service holding the listener
 | 
						|
		if [ -f /etc/systemd/system/sockets.target.wants/ssh.socket ]; then
 | 
						|
			(systemctl disable --now ssh.service &)
 | 
						|
			(systemctl enable --now ssh.socket &)
 | 
						|
		elif [ -f /etc/systemd/system/sockets.target.wants/sshd.socket ]; then
 | 
						|
			(systemctl disable --now sshd.service &)
 | 
						|
			(systemctl enable --now sshd.socket &)
 | 
						|
		fi
 | 
						|
 | 
						|
		# Aminda weirdness
 | 
						|
		(systemctl enable --now {aminda-nocron-reboot,aminda-nocron-rebootish,sysctl-p--system}.timer &)
 | 
						|
 | 
						|
		if hash flatpak 2> /dev/null; then
 | 
						|
			(systemctl enable flatpak-update.timer &)
 | 
						|
		fi
 | 
						|
 | 
						|
		if [ -f /usr/etc/rpm-ostreed.conf ]; then
 | 
						|
			(systemctl enable {aminda-duperemove,monthly-btrfs-balance}.timer &)
 | 
						|
		fi
 | 
						|
 | 
						|
	fi
 | 
						|
 | 
						|
	# SECURITY WARNING, autostarts
 | 
						|
	(rm -v /etc/xdg/autostart/footclient-tmux.desktop &)
 | 
						|
	cp -v etc/xdg/autostart/foot-tmux.desktop /etc/xdg/autostart/
 | 
						|
	if hash journalctl 2> /dev/null; then
 | 
						|
		cp -v etc/xdg/autostart/footclient-journal.desktop /etc/xdg/autostart/
 | 
						|
		cp -v etc/xdg/autostart/footclient-journal-dns.desktop /etc/xdg/autostart/
 | 
						|
		cp -v etc/xdg/autostart/footclient-journal-network.desktop /etc/xdg/autostart/
 | 
						|
		cp -v etc/xdg/autostart/footclient-journal-time.desktop /etc/xdg/autostart/
 | 
						|
	fi
 | 
						|
	cp -v etc/xdg/autostart/easyeffects-service.desktop /etc/xdg/autostart/
 | 
						|
	ln -nsfv /usr/local/share/applications/a-firefox.desktop /etc/xdg/autostart/
 | 
						|
	ln -nsfv /var/lib/flatpak/exports/share/applications/org.kde.kteatime.desktop /etc/xdg/autostart/
 | 
						|
 | 
						|
	# If apt is installed, enable progress bar and colors
 | 
						|
	if hash apt-get 2> /dev/null; then
 | 
						|
		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
 | 
						|
	fi
 | 
						|
 | 
						|
	# Workarounds for Debian binary names
 | 
						|
	# nodejs -> node was traditionally an eternity issue for me
 | 
						|
	if [[ -f /usr/bin/nodejs && ! -f /usr/bin/node ]]; then
 | 
						|
		ln -nsfv /usr/bin/nodejs /usr/local/bin/node
 | 
						|
	fi
 | 
						|
	# batcat? I expect bat everywhere rather than Bacula
 | 
						|
	if [[ -f /usr/bin/batcat && ! -f /usr/bin/btraceback && ! -f bsmtp ]]; then
 | 
						|
		ln -nsfv /usr/bin/batcat /usr/local/bin/bat
 | 
						|
	fi
 | 
						|
 | 
						|
	# 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
 | 
						|
 | 
						|
	# If LaTeX fonts are available, make them available for the rest of the
 | 
						|
	# system too.
 | 
						|
	if [ -d "/usr/share/texlive/texmf-dist/fonts/" ]; then
 | 
						|
		mkdir -p /usr/local/share/fonts
 | 
						|
		ln -nsfv /usr/share/texlive/texmf-dist/fonts /usr/local/share/fonts/texlive
 | 
						|
	fi
 | 
						|
 | 
						|
	# They say to not repeat yourself, but copy-pasting from below is the
 | 
						|
	# easiest way to make the submodule fonts available to the system.
 | 
						|
	if [ -d "$HOME/.shell-things" ]; then
 | 
						|
		mkdir -p /usr/local/share/fonts
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/comicneue/Fonts/OTF /usr/local/share/fonts/comicneue
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/comic-shanns-mono/fonts/ComicShannsMono-Regular.otf /usr/local/share/fonts/
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/opendyslexic/compiled/OpenDyslexic-*.otf /usr/local/share/fonts/
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/serious-sans/SeriousShanns/otf /usr/local/share/fonts/SeriousShanns
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/serious-sans/SeriousShanns/NerdFont /usr/local/share/fonts/
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/serious-sans/SeriousShanns/NerdFontMono /usr/local/share/fonts/
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/serious-sans/SeriousShanns/NerdFontPropo /usr/local/share/fonts/
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/Inclusive-Sans/fonts/variable /usr/local/share/fonts/Inclusive-Sans
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/atkinson-hyperlegible/fonts/otf /usr/local/share/fonts/atkinson-hyperlegible
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/atkinson-hyperlegible-next/fonts/variable /usr/local/share/fonts/atkinson-hyperlegible-next
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/atkinson-hyperlegible-next-mono/fonts/variable /usr/local/share/fonts/atkinson-hyperlegible-next-mono
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/nicoverbruggen-ebook-fonts/fonts /usr/local/share/fonts/nicoverbruggen-ebook-fonts
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/microsoft-fonts/Symbols/*.ttf /usr/local/share/fonts/
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/microsoft-fonts/Symbols/*.otf /usr/local/share/fonts/
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/source-sans/VF/*.otf /usr/local/share/fonts/
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/source-sans/OTF/ /usr/local/share/fonts/source-sans
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/source-serif/VAR/*.otf /usr/local/share/fonts/
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/source-serif/OTF /usr/local/share/fonts/source-serif
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/source-code-pro/VF/*.otf /usr/local/share/fonts/
 | 
						|
		ln -nsfv $HOME/.shell-things/submodules/source-code-pro/OTF/ /usr/local/share/fonts/source-code-pro
 | 
						|
	fi
 | 
						|
 | 
						|
	# Symlink cleanup
 | 
						|
	if hash symlinks 2> /dev/null; then
 | 
						|
		symlinks -d /etc/xdg/autostart/
 | 
						|
		symlinks -d /etc/udev/rules.d/
 | 
						|
		symlinks -d /usr/local/bin/
 | 
						|
		symlinks -d /usr/local/share/fonts/
 | 
						|
	else
 | 
						|
		echo "WARNING! Executable named symlinks not found in PATH."
 | 
						|
		sleep 3
 | 
						|
	fi
 | 
						|
else
 | 
						|
	# rootless-only tasks
 | 
						|
 | 
						|
	# Figure out the localization of $HOME/Desktop
 | 
						|
	if hash xdg-user-dir 2> /dev/null; then
 | 
						|
		DESKTOP=$(xdg-user-dir DESKTOP)
 | 
						|
 | 
						|
		if [ -d ~/.config/autostart ]; then
 | 
						|
			ln -nsfv ~/.config/autostart/*.desktop $DESKTOP/
 | 
						|
		fi
 | 
						|
 | 
						|
		# Ensure there is foot-server.socket before creating a shortcut for footclient
 | 
						|
		if hash systemctl 2> /dev/null; then
 | 
						|
			systemctl --user enable --now foot-server.socket
 | 
						|
			ln -nsfv /usr/share/applications/footclient.desktop $DESKTOP/
 | 
						|
		else
 | 
						|
			ln -nsfv /usr/share/applications/foot.desktop $DESKTOP/
 | 
						|
		fi
 | 
						|
 | 
						|
		# Create desktop shortcuts/symlinks for apps
 | 
						|
		ln -nsfv /usr/share/applications/org.kde.discover.desktop $DESKTOP/
 | 
						|
		ln -nsfv /usr/share/applications/org.kde.kdeconnect-settings.desktop $DESKTOP/
 | 
						|
		ln -nsfv /usr/share/applications/org.kde.kdeconnect.app.desktop $DESKTOP/
 | 
						|
		#ln -nsfv /usr/share/applications/org.mozilla.firefox.desktop $DESKTOP/
 | 
						|
		ln -nsfv /usr/share/applications/org.kde.plasma-welcome.desktop $DESKTOP/
 | 
						|
		ln -nsfv /usr/share/applications/org.kde.dolphin.desktop $DESKTOP/
 | 
						|
		ln -nsfv /usr/share/applications/kdesystemsettings.desktop $DESKTOP/
 | 
						|
		ln -nsfv /usr/share/applications/virtualbox.desktop $DESKTOP/
 | 
						|
		ln -nsfv /usr/share/applications/org.kde.kwrite.desktop $DESKTOP/
 | 
						|
		ln -nsfv /usr/share/applications/mpv.desktop $DESKTOP/
 | 
						|
		ln -nsfv /usr/share/applications/io.github.celluloid_player.Celluloid.desktop $DESKTOP/
 | 
						|
		ln -nsfv /usr/share/applications/org.kde.kinfocenter.desktop $DESKTOP/
 | 
						|
		ln -nsfv /usr/share/applications/org.kde.plasma-systemmonitor.desktop $DESKTOP/
 | 
						|
		#ln -nsfv /usr/share/applications/org.kde.haruna.desktop $DESKTOP/
 | 
						|
		# scripts repo
 | 
						|
		ln -nsfv /usr/local/share/applications/a-firefox.desktop $DESKTOP/
 | 
						|
		if [ -f "/usr/bin/chromium-browser" ]; then
 | 
						|
			ln -nsfv /usr/local/share/applications/a-chromium.desktop $DESKTOP/
 | 
						|
		fi
 | 
						|
		if [ -f "/usr/bin/google-chrome-stable" ]; then
 | 
						|
			ln -nsfv /usr/local/share/applications/a-google-chrome.desktop $DESKTOP/
 | 
						|
		fi
 | 
						|
		if [ -f "/usr/bin/microsoft-edge-stable" ]; then
 | 
						|
			ln -nsfv /usr/local/share/applications/a-microsoft-edge.desktop $DESKTOP/
 | 
						|
		fi
 | 
						|
		if [ -f "/usr/bin/vivaldi-stable" ]; then
 | 
						|
			ln -nsfv /usr/local/share/applications/a-vivaldi.desktop $DESKTOP/
 | 
						|
		fi
 | 
						|
		if [ -f "/usr/bin/librewolf" ]; then
 | 
						|
			ln -nsfv /usr/local/share/applications/libreawoo.desktop $DESKTOP/
 | 
						|
		fi
 | 
						|
 | 
						|
		ln -nsfv /usr/local/share/applications/flatpak-steam-bigpicture.desktop $DESKTOP/
 | 
						|
		ln -nsfv /usr/local/share/applications/a-steam.desktop $DESKTOP/
 | 
						|
		if [ -f "/var/lib/flatpak/exports/bin/org.signal.Signal" ]; then
 | 
						|
			ln -nsfv /usr/local/share/applications/a-signal.desktop $DESKTOP/
 | 
						|
		fi
 | 
						|
		ln -nsfv /usr/local/share/applications/a-firefox-cups.desktop $DESKTOP/
 | 
						|
		# flatpaks
 | 
						|
		ln -nsfv /var/lib/flatpak/exports/share/applications/com.valvesoftware.SteamLink.desktop $DESKTOP/
 | 
						|
		ln -nsfv /var/lib/flatpak/exports/share/applications/com.heroicgameslauncher.hgl.desktop $DESKTOP/
 | 
						|
		ln -nsfv /var/lib/flatpak/exports/share/applications/com.rafaelmardojai.Blanket.desktop $DESKTOP/
 | 
						|
		ln -nsfv /var/lib/flatpak/exports/share/applications/de.haeckerfelix.Shortwave.desktop $DESKTOP/
 | 
						|
		ln -nsfv /var/lib/flatpak/exports/share/applications/org.pulseaudio.pavucontrol.desktop $DESKTOP/
 | 
						|
		ln -nsfv /var/lib/flatpak/exports/share/applications/org.telegram.desktop.desktop $DESKTOP/
 | 
						|
		ln -nsfv /var/lib/flatpak/exports/share/applications/org.torproject.torbrowser-launcher.desktop $DESKTOP/
 | 
						|
		ln -nsfv /var/lib/flatpak/exports/share/applications/org.kde.audiotube.desktop $DESKTOP/
 | 
						|
		#ln -nsfv /var/lib/flatpak/exports/share/applications/org.videolan.VLC.desktop $DESKTOP/
 | 
						|
		ln -nsfv /var/lib/flatpak/exports/share/applications/org.kde.elisa.desktop $DESKTOP/
 | 
						|
		ln -nsfv /var/lib/flatpak/exports/share/applications/org.libreoffice.LibreOffice.desktop $DESKTOP/
 | 
						|
		ln -nsfv /var/lib/flatpak/exports/share/applications/app.devsuite.Ptyxis.desktop $DESKTOP/
 | 
						|
		ln -nsfv /var/lib/flatpak/exports/share/applications/org.kde.skanpage.desktop $DESKTOP/
 | 
						|
	fi
 | 
						|
 | 
						|
	# Ensure a-firefox.desktop has an icon
 | 
						|
	mkdir -p $HOME/.local/share/icons/hicolor/128x128/apps/
 | 
						|
	if [ -f "$HOME/.local/firefox/browser/chrome/icons/default/default128.png" ]; then
 | 
						|
		ln -nsfv $HOME/.local/firefox/browser/chrome/icons/default/default128.png ~/.local/share/icons/hicolor/128x128/apps/a-firefox.png
 | 
						|
	elif [ -f "/usr/share/icons/hicolor/256x256/apps/firefox.png" ]; then
 | 
						|
		ln -nsfv /usr/share/icons/hicolor/256x256/apps/firefox.png ~/.local/share/icons/hicolor/128x128/apps/a-firefox.png
 | 
						|
	elif [ -f "/usr/share/icons/HighContrast/256x256/apps/firefox.png" ]; then
 | 
						|
		ln -nsfv /usr/share/icons/HighContrast/256x256/apps/firefox.png ~/.local/share/icons/hicolor/128x128/apps/a-firefox.png
 | 
						|
	fi
 | 
						|
 | 
						|
	# Remove dead symlinks
 | 
						|
	if hash symlinks 2> /dev/null; then
 | 
						|
		symlinks -d $DESKTOP/
 | 
						|
	else
 | 
						|
		echo "WARNING! Executable named symlinks not found in PATH."
 | 
						|
		sleep 3
 | 
						|
	fi
 | 
						|
fi
 | 
						|
 | 
						|
# Make the submoduled fonts available to the system
 | 
						|
if [ -d "$HOME/.shell-things" ]; then
 | 
						|
	mkdir -p $HOME/.local/share/fonts
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/comicneue/Fonts/OTF $HOME/.local/share/fonts/comicneue
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/comic-shanns-mono/fonts/ComicShannsMono-Regular.otf $HOME/.local/share/fonts/
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/opendyslexic/compiled/OpenDyslexic-*.otf $HOME/.local/share/fonts/
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/serious-sans/SeriousShanns/otf $HOME/.local/share/fonts/SeriousShanns
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/serious-sans/SeriousShanns/NerdFont $HOME/.local/share/fonts/
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/serious-sans/SeriousShanns/NerdFontMono $HOME/.local/share/fonts/
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/serious-sans/SeriousShanns/NerdFontPropo $HOME/.local/share/fonts/
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/Inclusive-Sans/fonts/variable $HOME/.local/share/fonts/Inclusive-Sans
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/atkinson-hyperlegible/fonts/otf $HOME/.local/share/fonts/atkinson-hyperlegible
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/atkinson-hyperlegible-next/fonts/variable $HOME/.local/share/fonts/atkinson-hyperlegible-next
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/atkinson-hyperlegible-next-mono/fonts/variable $HOME/.local/share/fonts/atkinson-hyperlegible-next-mono
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/nicoverbruggen-ebook-fonts/fonts $HOME/.local/share/fonts/nicoverbruggen-ebook-fonts
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/microsoft-fonts/Symbols/*.ttf $HOME/.local/share/fonts/
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/microsoft-fonts/Symbols/*.otf $HOME/.local/share/fonts/
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/source-sans/VF/*.otf $HOME/.local/share/fonts/
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/source-sans/OTF/ $HOME/.local/share/fonts/source-sans
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/source-serif/VAR/*.otf $HOME/.local/share/fonts/
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/source-serif/OTF $HOME/.local/share/fonts/source-serif
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/source-code-pro/VF/*.otf $HOME/.local/share/fonts/
 | 
						|
	ln -nsfv $HOME/.shell-things/submodules/source-code-pro/OTF/ $HOME/.local/share/fonts/source-code-pro
 | 
						|
 | 
						|
	# Font cleanup
 | 
						|
	if hash symlinks 2> /dev/null; then
 | 
						|
		symlinks -d $HOME/.local/share/fonts/
 | 
						|
	else
 | 
						|
		echo "WARNING! Executable named symlinks not found in PATH."
 | 
						|
		sleep 3
 | 
						|
	fi
 | 
						|
fi
 | 
						|
 | 
						|
if hash fc-cache 2> /dev/null; then
 | 
						|
	(fc-cache &)
 | 
						|
fi
 | 
						|
 | 
						|
# If the previously mentioned marker is present, include the even more
 | 
						|
# questionable script (yay!) into our current execution
 | 
						|
if [ -f "$MIKAELA_GREP" ]; then
 | 
						|
	. .mikaela_install
 | 
						|
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 &)
 | 
						|
 | 
						|
set +x
 | 
						|
# vim : set ft=bash :
 |