Skip to content

Commit

Permalink
Small improvements to the install-procedure
Browse files Browse the repository at this point in the history
It's now possible to run a single install-part using install.sh (instead
of calling it directly, which only works for a small number of the parts
due to them relying on variables set by install.sh).

On Ubuntu 22.04, "50-landscape-sysinfo" went from an actual file to a
symlink, so "chmod -x" wasn't effective anymore.
  • Loading branch information
thijsputman committed Nov 11, 2023
1 parent dbbe22e commit 66243d4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
14 changes: 9 additions & 5 deletions install/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ Run `📄 install.sh` to setup [`📂 .bashrc.d`](../.bashrc.d/), create various
configuration file symlinks, and make some further
[configuration changes](#configuration-changes).

`📄 install.sh` Runs all executable files in [`📂 install/parts.d`](./parts.d/).
To enable/disable parts of the installation, simply `chmod +x/-x` the scripts in
`📄 install.sh` Runs all executable files in [`📂 parts.d`](./parts.d/). To
enable/disable parts of the installation, simply `chmod +x/-x` the scripts in
question prior to running the installer.

The scripts in `📂 install/parts.d` are idempotent. They can be run multiple
times on an already "installed" system without nasty side-effects.
It is possible to run a _single_ part by using `install.sh <part>` (e.g.
`install.sh 20-home` would execute [`📄 parts.d/20-home`](./parts.d/20-home)).
This is the preferred way of running single parts on-demand – most of them
depend on variables set by `install.sh` and thus cannot be run directly.

The scripts in `📂 parts.d` are idempotent. They can be run multiple times on an
already "installed" system without nasty side-effects.

During installation, `📄 ~/.env` is created from
[a defaults file](./../.env.default) which lists all possible environment
Expand Down Expand Up @@ -53,7 +58,6 @@ To pull down a non-predefined version of the tool, do:

```shell
version=v1.24 ./powerline-go

```

### Configuration changes
Expand Down
6 changes: 4 additions & 2 deletions install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ base=$(dirname "$(realpath "$(dirname "${BASH_SOURCE[0]}")")")

for file in "$base"/install/parts.d/**; do

if [[ -x "$file" ]]; then
echo Installing 📄 "$(basename "$file")"...
file_basename="$(basename "$file")"

if [[ -x $file && (! -v 1 || $1 == "$file_basename") ]]; then
echo Installing 📄 "$file_basename"...
source "$file"
fi

Expand Down
8 changes: 7 additions & 1 deletion install/parts.d/90-motd
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/usr/bin/env bash

sudo chmod --silent -x /etc/update-motd.d/10-help-text || true
sudo chmod --silent -x /etc/update-motd.d/50-landscape-sysinfo || true

landscape_sysinfo=/etc/update-motd.d/50-landscape-sysinfo
if [ -L "$landscape_sysinfo" ]; then
sudo rm "$landscape_sysinfo"
elif [ -f "$landscape_sysinfo" ]; then
sudo chmod --silent -x "$landscape_sysinfo"
fi

if systemctl list-unit-files motd-news.service &> /dev/null; then
sudo systemctl mask motd-news.service || true
Expand Down

0 comments on commit 66243d4

Please sign in to comment.