From be5ebb3c8f250e6df6987d8903c4e047f465711d Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Thu, 8 Aug 2024 10:59:37 +0300 Subject: [PATCH] Add comments to the scripts that shouldn't be ran (but are ran anyway) --- .mikaela_install | 32 ++++++++++++++++++++---- install | 65 +++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 88 insertions(+), 9 deletions(-) diff --git a/.mikaela_install b/.mikaela_install index c0836ad7..b668ebf3 100755 --- a/.mikaela_install +++ b/.mikaela_install @@ -1,34 +1,51 @@ #!/usr/bin/env bash -# Do not use this script unless you know what you are doing! And even when you -# are me and know what you are doing, this is a poor practice I really should -# stop. +# Do not use this script unless you know what you are doing! And even when +# thou art I, and know what thou art doing, this is a poor practice I really +# should stop. set -x +# If the latest commit cannot be verified, exit to error. git verify-commit HEAD || exit 1 +# Place my personal more questionable aliases in place, except that I don't +# actually use them as I keep forgetting about them. cat .mikaela/bash_aliases >~/.bash_aliases cat .mikaela/zsh_aliases >~/.zsh_aliases +# I still question whether xinitrc gets read under wayland, but I am not +# about to start removing this legacy config, just in case of something +# unexpected. cat rc/xinitrc >~/.xinitrc +# My gnupg configuration with questionable options such as always +# encrypting to me, so paws off. mkdir -p ~/.gnupg cat .mikaela/gpg.conf >~/.gnupg/gpg.conf +# my name and all in pastes made through pastebinit, if it still even exists cat .mikaela/pastebinit.xml >~/.pastebinit.xml +# may change your language to Finnish or do other fun someone else than I +# wouldn't expect cat .mikaela/environment >~/.environment +# my git configuration including the names, addresses, public keys, etc. mkdir ~/.config/git -#cat .mikaela/gitconfig >~/.config/git/config git config --global --add include.path '~/.shell-things/.mikaela/gitconfig' cat .gitattributes >~/.config/git/attributes +# unless thou art I, thou don't want my authorized_keys on your system. mkdir -p ~/.ssh cat .mikaela/keys/authorized_keys >~/.ssh/authorized_keys cat etc/ssh/ssh_config >~/.ssh/config +# Text editor configuration (with a lot of bloat) that shouldn't be reached +# anyway since every project should have its own not so bloated editorconfig. cat .editorconfig >~/.editorconfig +# Is Firefox installed to the location I generally use? Then apply my +# autoconfigs. These are very surprising and unexpected unless thou art I, +# thou have been warned. if [ -d ~/.local/firefox/defaults/pref/ ]; then cat conf/autoconfig.js >~/.local/firefox/defaults/pref/autoconfig.js #cat conf/librewolf.overrides.cfg >~/.local/firefox/librewolf.overrides.cfg @@ -42,6 +59,8 @@ cat conf/firefox-forbidden-policies.js >~/.librewolf/librewolf.overrides.cfg #cat conf/librewolf.overrides.cfg >~/.var/app/io.gitlab.librewolf-community/.librewolf/librewolf.overrides.cfg cat conf/firefox-forbidden-policies.js >~/.var/app/io.gitlab.librewolf-community/.librewolf/librewolf.overrides.cfg +# Mainly KDE Plasma Integration extension support, but there may be GNOME +# and similar there too mkdir -p ~/.mozilla/native-messaging-hosts if [ -d /usr/lib64/mozilla/native-messaging-hosts/ ]; then cp -v /usr/lib64/mozilla/native-messaging-hosts/* ~/.mozilla/native-messaging-hosts @@ -49,17 +68,20 @@ elif [ -d /usr/lib/mozilla/native-messaging-hosts/ ]; then cp -v /usr/lib/mozilla/native-messaging-hosts/ ~/.mozilla/native-messaging-hosts fi +# Desktop menu integration mkdir -p ~/.local/share/applications ln -nsfv ~/.shell-things/local/share/applications ~/.local/share/applications/shell-things mkdir -p ~/.local/share/icons/hicolor/128x128/apps/ ln -nsfv ~/.local/firefox/browser/chrome/icons/default/default128.png ~/.local/share/icons/hicolor/128x128/apps/a-firefox.png +# Update desktop menu entries if hash update-desktop-database 2>/dev/null; then update-desktop-database ~/.local/share/applications fi +# Set a marker that this script has been used for the main script to read touch ~/.MIKAELA_GREP set +x -# vim : set ft=sh : +# vim : set ft=bash : diff --git a/install b/install index 7728c5c2..b13e4769 100755 --- a/install +++ b/install @@ -1,61 +1,100 @@ #!/usr/bin/env bash -# Do not use this script unless you know what you are doing! +# 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 +# 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 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 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 +# catting the files around, cat used in hopes of not touching permissions 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'` mkdir -vp ~/.config/git cat conf/gitconfig > ~/.config/git/config touch ~/.gitconfig rm ~/.gitconfig ln -nsfv ~/.config/git/config ~/.gitconfig +# Used for `git init` and `git clone`, will contain pre-commit hooks mkdir -vp ~/.git-template + +# {n,neo}vim cat rc/vimrc > ~/.vimrc mkdir -vp ~/.config/nvim/ cat conf/init.vim > ~/.config/nvim/init.vim cat conf/makepkg.conf > ~/.makepkg.conf + +# the media player mkdir -vp ~/.config/mpv/ cat conf/mpv.conf > ~/.config/mpv/mpv.conf + +# if I am performing ident spoofing already, I don't want to touch it if [ ! -f ~/.oidentd.conf ]; then cat conf/oidentd.conf > ~/.oidentd.conf fi + +# In addition to git, my gnupg configuration should be questioned mkdir -vp ~/.gnupg 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 killall -HUP dirmngr + +# I don't remember using these in ages and I don't think they apply to +# wayland #cat rc/xinitrc > ~/.xinitrc cat conf/pastebinit.xml > ~/.pastebinit.xml cat conf/Xresources > ~/.Xresources + +# Nice sysinfo script mkdir -vp ~/.inxi cat conf/inxi.conf > ~/.inxi/inxi.conf + +# laziness gpg --quiet --import .mikaela/keys/*.asc & + +# Utilized by my ssh_config (not to be confused with sshd_config) mkdir -vp ~/.ssh/sockets/ + +# It will get used later mkdir -vp ~/.local/bin/ + +# Setting permissions chmod a+xr chmod bash -x ./chmod & + +# The submodules contain nice things such as fonts git submodule update --init & +# Aforementioned git template directory and pre-commit 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 @@ -63,32 +102,50 @@ else 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 if [ -f "$MIKAELA_GREP" ]; then - bash -x .mikaela_install + . .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=sh : -#chmod 700 $HOME -R +# vim : set ft=bash :