Skip to content

Latest commit

 

History

History
269 lines (213 loc) · 10 KB

README.md

File metadata and controls

269 lines (213 loc) · 10 KB

Setup 📂 ~/.bashrc.d & 📂 ~/.profile.d

Install

After a clean install, it is recommended to install software prior to setting up your configuration.

  1. Run ⚙️ install.sh base.d to setup the base configuration required to use both 📂 ~/.bashrc.d and 📂 ~/.profile.d
  2. Run ⚙️ install.sh to create various configuration file symlinks and make some further configuration changes

Note that these scripts assume a "full" Ubuntu installation. Coming from a minimal installation, the following packages (most likely) need to be installed manually first:

apt install \
  curl \
  gpg \
  lsb-release \
  sudo \
  tzdata

📂 *.d-folders

By default, 📄 install.sh Runs all executable files in 📂 config.d. To instruct 📄 install.sh to source parts from a different folder, specify the folder-name as its first argument, e.g. ⚙️ install.sh bins.d.

The following folders are available:

All scripts in these folders are idempotent. They can be run multiple times on an already "installed" system without nasty side-effects.

Install "à la carte"

It is possible to run only a subset of parts (in a given folder) by using ⚙️ install.sh [folder] <pattern>. This is the recommended way of running individual parts as most of the scripts depend on variables (and file-descriptors) set by install.sh and thus cannot be run independently.

To run everything inside a folder, use ⚙️ install.sh [folder] '.*' – this is not recommended though...

<pattern> Matches against the parts' filename. You can use either an exact filename match or a regular expression. For example, ⚙️ install.sh '10-.*' executes 📄 config.d/10-home and 📄 config.d/10-home-wsl – mind the quotes as we don't want the shell to treat the pattern as a glob...

If you specify an exact filename match (e.g. ⚙️ install.sh 10-home), that part is run interactively. In case of a regular expression, all matching parts are executed non-interactively with their stdout and stderr hidden (output is only shown in case of errors).

N.B. When running individual parts, the scripts' execute-bit (chmod +x) is ignored. All matching scripts are thus run regardless.

Raspberry Pi

By default, 📄 install.sh installs the WSL2-setup. To have it install the Raspberry Pi-setup instead, do this prior to running the installer-script:

chmod +x ./{base,config}.d/*-rpi
chmod -x ./{base,config}.d/*-wsl

For a generic Linux-setup, do:

chmod -x ./{base,config}.d/*-{rpi,wsl}

Configuration changes

The "higher-order" scripts in 📂 config.d make configuration changes instead of symlinking/copying files from this repo:

  • ❎ 90-auto-upgrades — configure unattended-upgrades to check but not automatically install updates
  • ⬜ 90-gpg-agent-rpi — mask all gpg-agent related units
    • RPi-only; use a forwarded socket for GPG operations instead
  • ❎ 90-motd — removes some unnecessary clutter from the default MOTD
  • ⬜ 90-ubuntu-pro — removes additional clutter from MOTD and apt introduced by Ubuntu Pro

Scripts marked with ⬜ are not executed by default – run them manually via install.sh or chmod +x them before running install.sh.

Software installation

Scripts in 📂 software.d and 📂 bins.d install packages/software from various sources. After a clean install it is recommended to run these scripts before allowing install.sh to make actual configuration changes.

Run ⚙️ install.sh software.d and ⚙️ install.sh bins.d to install the minimal recommended set of software required for an optimal (terminal) experience.

Scripts marked with ⬜ are not executed by default – run them manually via install.sh or chmod +x them before running install.sh.

N.B. The minimal recommended set doesn't install everything required for the scripts in 📂 bashrc.d to function. Take note of the output during installation for further instructions...

📂 software.d

📂 bins.d

The scripts in 📂 bins.d attempt to automatically determine the correct processor architecture; in general they should thus work for both amd64 and arm64 systems.

To install a non-predefined version of one of the binaries, do:

version=v2.12.0 install.sh bins.d hadolint

Outdated glibc

On older distros (e.g. Ubuntu 20.04 and Debian 11 bullseye), issues due to an outdated version of glibc start popping up. If it's not feasible to upgrade the distro (the better solution), the below instructions offer a workaround.

The example assumes fastfetch on arm64, but it should work for other applications and architectures too – mileage may vary...

wget -nv https://ftp.gnu.org/gnu/glibc/glibc-2.35.tar.gz
tar -zxvf glibc-2.35.tar.gz
cd glibc-2.35
mkdir glibc-build
cd glibc-build
../configure --prefix=/opt/glibc-2.35
# If "../configure" fails, one of these is probably missing:
#   gawk bison gcc make wget tar
make -j"$(nproc)"
make install

Then patch the executable(s) in question:

sudo patchelf \
  --set-interpreter /opt/glibc-2.35/lib/ld-linux-aarch64.so.1 \
  --set-rpath /opt/glibc-2.35/lib /usr/bin/fastfetch

Note that ld-linux-aarch64.so.1 is architecture dependent...

Git configuration

The Git user configuration (i.e., name and e-mail address) is split from the main configuration in 📄 ~/.gitconfig_personal. To add additional (folder-based; dynamic) user configurations, modify 📄 ~/.gitconfig along the lines of:

[include]
  path = .gitconfig_personal
[includeIf "gitdir:GitHub/folder_XXX/"]
  path = .gitconfig_XXX
[includeIf "gitdir:GitHub/folder_YYY/"]
  path = .gitconfig_YYY
[alias]
  ...

N.B. Both the 📄 .gitconfig and 📄 .gitconfig_personal files are copied (and not symlinked) from the repo.

Uninstall

To "uninstall", run these commands in 📂 ~/:

find -lname '**/dotfiles/**' -delete
rm -rf ~/.anacron
crontab -l | grep -v '^@hourly .* $HOME/.anacron/etc/anacrontab' | crontab -
cp /etc/skel/{.bashrc,.profile} ~/

This removes all symlinks pointing to 📂 **/dotfiles/** (assuming that's what this Git-repository is called), the 📂 ~/.anacron folder and its crontab-entry, and restores 📄 ~/.bashrc and 📄 ~/.profile to their default state.

Omit -delete from the first command to get a list of symlinks instead of deleting them and manually remove the ones you don't need anymore.

All files symlinked to locations outside of the Git-repository are explicitly mentioned during the installation process; you'll need to manually remove those.

Note that the above leaves behind all files they were copied (instead of symlinked) and that this does not undo any of the configuration changes nor (logically) the software installations.