2024-08-12 08:34:06 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# Another take on my install script, but using symlinks and with a chance of
|
|
|
|
# replacing the other ones.
|
|
|
|
|
2024-08-14 07:26:33 +02:00
|
|
|
set -x
|
2024-08-12 08:34:06 +02:00
|
|
|
# Tails appears to come with lsb_release and return Tails
|
|
|
|
export DISTROID="$(lsb_release -si)"
|
|
|
|
|
2024-08-12 12:40:53 +02:00
|
|
|
# Tails persistent directories
|
2024-08-12 08:37:57 +02:00
|
|
|
export PERSISTDIR="$HOME/Persistent"
|
2024-08-12 12:40:53 +02:00
|
|
|
export PERSISTDOTFILESDIR="/live/persistence/TailsData_unlocked/dotfiles"
|
2024-08-12 08:34:06 +02:00
|
|
|
|
|
|
|
# This target directory
|
2024-08-12 08:37:57 +02:00
|
|
|
export SHELL_THINGS_REPO="$HOME/Persistent/src/codeberg.org/Aminda/shell-things"
|
2024-08-12 08:34:06 +02:00
|
|
|
|
|
|
|
# WARNING!
|
|
|
|
printf "USING THESE FILES IS EVEN MORE DANGEROUS ON TAILS THAN IN GENERAL.\n"
|
|
|
|
printf "PLEASE DON'T DO THIS EVEN IF THOU ART I. THOU HAVE BEEN WARNED!\n"
|
|
|
|
sleep 3
|
|
|
|
|
|
|
|
# NOTE!
|
|
|
|
if [[ $DISTROID != "Tails" ]]; then
|
|
|
|
printf "\nThis distro identifies itself as $DISTROID instead of Tails...\n"
|
|
|
|
sleep 3
|
|
|
|
fi
|
|
|
|
|
|
|
|
# WARNING again!
|
|
|
|
if [[ ! -d "$PERSISTDIR" ]]; then
|
|
|
|
printf "\nWARNING! Persistent directory not found, Tails may not be setup"
|
|
|
|
printf " correctly. To override:\n\tmkdir -vp $PERSISTDIR \n\n"
|
|
|
|
sleep 3
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# THIS IS YOUR FINAL WARNING!
|
2024-08-12 12:40:53 +02:00
|
|
|
if [[ ! -d "$PERSISTDOTFILESDIR" ]]; then
|
|
|
|
printf "\nWARNING! $PERSISTDOTFILESDIR directory not found, check"
|
2024-08-12 08:34:06 +02:00
|
|
|
printf "\npersistent storage settings To override:\n"
|
2024-08-12 12:40:53 +02:00
|
|
|
printf "\tmkdir -vp $PERSISTDOTFILESDIR \n\n"
|
2024-08-12 08:34:06 +02:00
|
|
|
sleep 3
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# This is just a copy-paste of my nastyish function
|
2024-08-12 08:48:26 +02:00
|
|
|
if [ -d "$SHELL_THINGS_REPO" ]; then
|
2024-08-12 08:34:06 +02:00
|
|
|
printf "$SHELL_THINGS_REPO exists, git pulling...\n\n"
|
|
|
|
cd $SHELL_THINGS_REPO
|
|
|
|
git remote set-url origin https://codeberg.org/Aminda/shell-things.git
|
|
|
|
git fetch --all
|
2024-08-12 09:46:20 +02:00
|
|
|
git checkout -b cxefa origin/cxefa > /dev/null 2>&1
|
2024-08-12 08:34:06 +02:00
|
|
|
git pull
|
2024-08-12 08:48:26 +02:00
|
|
|
git submodule update --init
|
|
|
|
git config --global gpg.ssh.allowedSignersFile "$SHELL_THINGS_REPO/submodules/ssh-allowed_signers/allowed_signers"
|
|
|
|
sleep 3
|
2024-08-12 08:34:06 +02:00
|
|
|
git verify-commit HEAD || exit 1
|
|
|
|
sleep 3
|
|
|
|
else
|
|
|
|
printf "shell-things: $SHELL_THINGS_REPO doesn't exist, cloning...\n\n"
|
|
|
|
git clone https://codeberg.org/Aminda/shell-things.git $SHELL_THINGS_REPO
|
|
|
|
cd $SHELL_THINGS_REPO
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd
|
|
|
|
|
|
|
|
# bash
|
2024-08-12 12:40:53 +02:00
|
|
|
cp -v $SHELL_THINGS_REPO/rc/bashrc $PERSISTDOTFILESDIR/.bashrc
|
|
|
|
ln -nsfv $PERSISTDOTFILESDIR/.bashrc $HOME/
|
2024-08-12 08:34:06 +02:00
|
|
|
# zsh
|
2024-08-12 12:40:53 +02:00
|
|
|
cp -v $SHELL_THINGS_REPO/rc/zshrc $PERSISTDOTFILESDIR/.zshrc
|
|
|
|
ln -nsfv $PERSISTDOTFILESDIR/.zshrc $HOME/
|
2024-08-12 08:34:06 +02:00
|
|
|
# tmux
|
2024-08-12 12:40:53 +02:00
|
|
|
cp -v $SHELL_THINGS_REPO/conf/tmux.conf $PERSISTDOTFILESDIR/.tmux.conf
|
|
|
|
ln -nsfv $PERSISTDOTFILESDIR/.tmux.conf $HOME/
|
2024-08-12 08:34:06 +02:00
|
|
|
# git
|
|
|
|
git config --global gpg.ssh.allowedSignersFile $PERSISTDIR/src/codeberg.org/Aminda/ssh-allowed_signers/allowed_signers
|
2024-08-12 12:40:53 +02:00
|
|
|
cp $SHELL_THINGS_REPO/conf/gitconfig $PERSISTDOTFILESDIR/.gitconfig
|
|
|
|
ln -nsfv $PERSISTDOTFILESDIR/.gitconfig $HOME/
|
2024-08-14 07:27:55 +02:00
|
|
|
git config --global gpg.ssh.allowedSignersFile "$SHELL_THINGS_REPO/submodules/ssh-allowed_signers/allowed_signers"
|
2024-08-12 08:34:06 +02:00
|
|
|
|
2024-08-14 06:26:22 +02:00
|
|
|
# Ensure existence of netrc & curlrc for easing git over https
|
|
|
|
touch $PERSISTDOTFILESDIR/.{netrc,curlrc}
|
|
|
|
ln -nsfv $PERSISTDOTFILESDIR/.netrc $HOME/
|
|
|
|
ln -nsfv $PERSISTDOTFILESDIR/.curlrc $HOME/
|
|
|
|
|
2024-08-12 09:41:23 +02:00
|
|
|
# Hack for directories expecting it to work, although only for this boot
|
2024-08-12 09:35:27 +02:00
|
|
|
ln -nsfv $SHELL_THINGS_REPO $HOME/.shell-things
|
|
|
|
|
2024-08-12 08:34:06 +02:00
|
|
|
# Let's go home
|
|
|
|
cd
|
|
|
|
|
2024-08-14 07:26:33 +02:00
|
|
|
set +x
|
2024-08-12 08:34:06 +02:00
|
|
|
# vim: filetype=bash
|