Re-write README.md; unify installation scripts

main
Marie-Joseph 2 years ago
parent a304a17c03
commit 676640a8c4

@ -2,15 +2,34 @@
A shell script and systemd service unit file to ensure overscan is disabled
on Raspberry Pis running Debian-based systems.
## Overview
This simply does what it says on the tin. The shell script `check-overscan.sh` does the "hard"
work of iterating over the lines of `/boot/firmware/config.txt` and adding
`disable_overscan=1` if it's not found. The unit file `check-overscan.service`
just tells systemd that we want to run this check on poweroff or reboot, as
vanilla Debian overwrites `config.txt` on kernel upgrades.
## What
The contents of this directory are simply:
* `check-overscan`: a shell script to check if `disable_overscan=1` is in the Raspberry Pi's
`config.txt` file and add it if it isn't
* `check-overscan.service`: a systemd unit file to run `check-overscan.sh` at shutdown or reboot
* `install.sh`: a shell script to install and enable the script and service, as well as disable
and uninstall them (in that order)
* `README.md`: this document
## Installation
You should be able to simply run `install.sh` with privileges (eg `sudo sh install.sh`) and everything
will be done for you. Note that this has not been tested anywhere but vanilla
Debian arm64 using Raspberry Pi 4-compatible images. `uninstall.sh` will simply remove the files and disable the service.
## Why
On the vanilla Debian arm64 Raspberry Pi image, updating the kernel overwrites any changes
made to `config.txt`. This script and service make sure you don't forget to add back
`disable_overscan=1`.
## How (Usage)
To install the service, simply download this repository (such as cloning it with git), enter it,
and run `install.sh`.
```
git clone https://github.com/Marie-Joseph/rpi-check-overscan.git
cd rpi-check-overscan
sh install.sh
```
To uninstall it, simply run `install.sh` again with `--uninstall` or `-u`.
```
cd rpi-check-overscan
sh install.sh --uninstall
```
Note that on Raspberry Pi OS, the Raspberry Pi Foundation's spin of Debian, the
path to `config.txt` is slightly different. For these cases, simply edit the
path for `configFile` in `check-overscan.sh` with a text editor.

@ -1,6 +1,6 @@
#!/bin/sh
configFile="/boot/firmware/config.txt"
configFile="/boot/firmware/config.txt";
if [ ! $(awk '/disable_overscan=1/ { print("1") }' $configFile) ]; then
echo "disable_overscan=1" >> $configFile;

@ -5,7 +5,7 @@ Before=shutdown.target reboot.target
[Service]
Type=oneshot
ExecStart=/usr/bin/check-overscan.sh
ExecStart=/usr/bin/check-overscan
TimeoutStartSec=0
[Install]

@ -2,16 +2,28 @@
systemdDir="/lib/systemd/system"
binDir="/bin"
script="check-overscan.sh"
script="check-overscan"
service="check-overscan.service"
systemctl daemon-reload
echo -n "Installing $script... "
cp $script $binDir/
chmod +x $binDir/$script
echo "Done."
if [ $1 = "-u" ] || [ $1 = "--uninstall" ]; then
echo -n "Uninstalling $service... ";
systemctl disable $service;
rm $systemdDir/$service;
systemctl daemon-reload;
echo "Done.";
echo -n "Installing $service... "
cp $service $systemdDir/
systemctl enable $service
echo "Done."
echo -n "Uninstalling $script... ";
rm $binDir/$script;
echo "Done.";
else
echo -n "Installing $script... ";
cp $script $binDir/;
chmod +x $binDir/$script;
echo "Done.";
echo -n "Installing $service... ";
cp $service $systemdDir/;
systemctl daemon-reload;
systemctl enable $service;
echo "Done.";
fi;

@ -1,9 +0,0 @@
#!/bin/sh
script="/bin/check-overscan.sh"
service="check-overscan.service"
systemdDir="/lib/systemd/system"
systemctl disable $service
rm $script $systemdDir/$service
systemctl daemon-reload