Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Script #4

Merged
merged 10 commits into from
May 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .config/spicetify/Themes
Submodule Themes added at 18b4d3
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule ".config/xmonad/xmonad-contrib"]
path = .config/xmonad/xmonad-contrib
url = https://github.com/xmonad/xmonad-contrib
[submodule ".config/spicetify/Themes"]
path = .config/spicetify/Themes
url = https://github.com/reyniersbram/spicetify-themes
16 changes: 11 additions & 5 deletions .stow-local-ignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
# _ _
# ___| |_ _____ __ (_) __ _ _ __ ___ _ __ ___
# / __| __/ _ \ \ /\ / /____| |/ _` | '_ \ / _ \| '__/ _ \
# _\__ \ || (_) \ V V /_____| | (_| | | | | (_) | | | __/
# (_)___/\__\___/ \_/\_/ |_|\__, |_| |_|\___/|_| \___|
# |___/
#
# Files stow should ignore

# Git files
/.git
.gitignore
.gitmodules
LICENSE
README.md

# Setup files
# The setup scrip
setup
/setup-scripts

# Other
LICENSE
README.md
TODO.txt
.stow-local-ignore
/etc

Empty file added etc/packages.txt
Empty file.
Empty file added etc/packages_paru.txt
Empty file.
1 change: 1 addition & 0 deletions etc/required.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stow
73 changes: 59 additions & 14 deletions setup
Original file line number Diff line number Diff line change
@@ -1,21 +1,66 @@
#!/bin/bash
#!/usr/bin/env sh

# The directory of this repository
CDIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "Finding path to this repo..."
current_directory=$(cd -- "$( dirname -- "$0")" > /dev/null 2>&1 && pwd)
echo "Repo detected at ${current_directory}"

# Make sure some directories exist before symlinking
$CDIR/setup-scripts/ensure-dirs.sh
echo "Doing a full system upgrade before starting the installation..."
sudo pacman -Syyu

# Download paru (https://aur.archlinux.org/packages/paru) so packages from the AUR can be installed.
$CDIR/setup-scripts/paru.sh
echo "Installing packages required to run the install script..."
packages="${current_directory}/etc/required.txt"
if [ -s "$packages" ]; then
# shellcheck disable=SC2024
sudo pacman -S --needed - < "$packages"
fi

# Download themes for Spicetify
# TODO: add as submodule
$CDIR/setup-scripts/spicetify_themes.sh
# Make sure XDG Base Directory Specification is used
XDG_CONFIG_HOME="${HOME}/.config"
XDG_CACHE_HOME="${HOME}/.cache"
XDG_DATA_HOME="${HOME}/.local/share"
XDG_STATE_HOME="${HOME}/.local/state"

# Symlink files
$CDIR/setup-scripts/stow.sh $CDIR
echo "Creating directories according to the XDG Base Directory Specification..."
mkdir -vp "${XDG_CONFIG_HOME}"
mkdir -vp "${XDG_CACHE_HOME}"
mkdir -vp "${XDG_DATA_HOME}"
mkdir -vp "${XDG_STATE_HOME}"

sudo ln -sf $CDIR/etc/unlock-conservation-mode.service /etc/systemd/system/
sudo systemctl enable unlock-conservation-mode
echo "Creating directories necessary for the installation..."
mkdir -vp "${HOME}/.local/bin"

# Use stow to do most of this work
echo "Symlinking files with stow..."
stow --verbose=2 --dir "${current_directory}" --target "${HOME}"

# sudo ln -sf $current_directory/etc/unlock-conservation-mode.service /etc/systemd/system/
# sudo systemctl enable unlock-conservation-mode

echo "Installing additional packages..."

if ! (which paru > /dev/null 2>&1); then
echo "Installing paru from AUR..."
if (
git clone https://aur.archlinux.org/paru.git
cd paru || exit
makepkg -si --clean
cd ..
rm -rf paru
); then
echo "Failed to install paru" >&2
fi
else
echo "paru already installed, skipping..."
fi

packages="${current_directory}/etc/packages.txt"
if [ -s "$packages" ]; then
# shellcheck disable=SC2024
sudo pacman -S --needed - < "$packages"
fi

packages="${current_directory}/etc/packages_paru.txt"
if [ -s "$packages" ]; then
# shellcheck disable=SC2024
sudo paru -S --needed - < "$packages"
fi
9 changes: 0 additions & 9 deletions setup-scripts/ensure-dirs.sh

This file was deleted.

18 changes: 0 additions & 18 deletions setup-scripts/fonts.sh

This file was deleted.

19 changes: 0 additions & 19 deletions setup-scripts/paru.sh

This file was deleted.

24 changes: 0 additions & 24 deletions setup-scripts/spicetify_themes.sh

This file was deleted.

16 changes: 0 additions & 16 deletions setup-scripts/stow.sh

This file was deleted.