2022-09-02 19:22:31 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
if [ -f '/etc/qubes-release' ]; then
|
|
|
|
# Qubes dom0
|
2022-09-22 03:45:01 -07:00
|
|
|
qvm-create --label red --template debian-11 provision &> /dev/null || EXIT_CODE=$?
|
|
|
|
qvm-run --pass-io provision 'curl -sSL https://gitlab.com/megabyte-labs/dotfiles/-/archive/master/dotfiles-master.tar.gz > dotfiles.tar.gz'
|
|
|
|
qvm-run --pass-io provision "cat dotfiles.tar.gz" > "$HOME/dotfiles.tar.gz"
|
2022-09-02 19:22:31 -07:00
|
|
|
tar -xzf "$HOME/dotfiles.tar.gz" -C "$HOME"
|
|
|
|
rm -f "$HOME/dotfiles.tar.gz"
|
2022-09-03 00:27:26 -07:00
|
|
|
sudo rm -rf /usr/src/professor-dotfiles
|
2022-09-03 00:28:45 -07:00
|
|
|
sudo cp -rf "$HOME/dotfiles-master" /usr/src/professor-dotfiles
|
2022-09-02 19:22:31 -07:00
|
|
|
else
|
2022-09-03 00:27:26 -07:00
|
|
|
if [ -d /usr/src/professor-dotfiles/.git ]; then
|
|
|
|
cd /usr/src/professor-dotfiles
|
2022-09-22 03:45:01 -07:00
|
|
|
sudo git pull origin master
|
2022-09-02 19:22:31 -07:00
|
|
|
cd ~/
|
|
|
|
else
|
2022-09-22 03:45:01 -07:00
|
|
|
sudo rm -rf /usr/src/professor-dotfiles
|
2022-09-03 00:27:26 -07:00
|
|
|
sudo git clone https://gitlab.com/megabyte-labs/dotfiles.git /usr/src/professor-dotfiles
|
2022-09-02 19:22:31 -07:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Copy dotfile folders
|
|
|
|
while read DOTFILE_FOLDER; do
|
|
|
|
BASENAME_FOLDER="$(basename "$DOTFILE_FOLDER")"
|
2022-09-03 00:38:09 -07:00
|
|
|
if [ ! -d "$HOME/$BASENAME_FOLDER" ]; then
|
|
|
|
mkdir -p "$HOME/$BASENAME_FOLDER"
|
|
|
|
fi
|
2022-09-03 00:39:26 -07:00
|
|
|
cp -rf "$DOTFILE_FOLDER/"* "$HOME/$BASENAME_FOLDER"
|
2022-09-03 00:32:57 -07:00
|
|
|
done < <(find /usr/src/professor-dotfiles/dotfiles -maxdepth 1 -mindepth 1 -type d)
|
2022-09-02 19:22:31 -07:00
|
|
|
|
|
|
|
# Copy dotfile files
|
|
|
|
while read DOTFILE_FILE; do
|
|
|
|
BASENAME_FILE="$(basename "$DOTFILE_FILE")"
|
|
|
|
cp "$DOTFILE_FILE" "$HOME/$BASENAME_FILE"
|
|
|
|
chmod 600 "$HOME/$BASENAME_FILE"
|
2022-09-03 00:32:57 -07:00
|
|
|
done < <(find /usr/src/professor-dotfiles/dotfiles -maxdepth 1 -mindepth 1 -type f)
|
2022-09-02 19:22:31 -07:00
|
|
|
|
|
|
|
# Ensure .local/bin contents are executable
|
|
|
|
while read LOCAL_BIN; do
|
|
|
|
chmod +x "${LOCAL_BIN}"
|
2022-09-03 00:33:54 -07:00
|
|
|
done < <(find "$HOME/.local/bin" -maxdepth 1 -mindepth 1 -type f)
|
2022-09-02 19:22:31 -07:00
|
|
|
|
|
|
|
# Firefox theme
|
|
|
|
if [ ! -f ~/.mozilla/firefox ] && [ ! -f '/etc/qubes-release' ]; then
|
|
|
|
git clone https://github.com/EliverLara/firefox-sweet-theme /tmp/firefox-sweet-theme
|
|
|
|
bash /tmp/firefox-sweet-theme/scripts/install.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
# grep -q QT_QPA_PLATFORMTHEME=qt5ct /etc/environment || echo QT_QPA_PLATFORMTHEME=qt5ct | sudo tee -a /etc/environment
|
|
|
|
# sudo cp -rv "$HOME/.local/share/qt5ct" /usr/share
|