Skip to content

Commit

Permalink
task: /boot/config.txt is not an symlink anymore (#600)
Browse files Browse the repository at this point in the history
* install-photobooth: /boot/config.txt is not an symlink anymore

* remotebuzzer-server: use /boot/firmware/config.txt on sanity check

* remotebuzzer-server: remove unneeded const
  • Loading branch information
andi34 committed Feb 19, 2024
1 parent 3a81c71 commit 050bf73
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
14 changes: 4 additions & 10 deletions install-photobooth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -759,16 +759,10 @@ ask_usb_sync() {
raspberry_permission() {
info "### Remote Buzzer Feature"
info "### Configure Raspberry PI GPIOs for Photobooth - please reboot in order use the Remote Buzzer Feature"
BOOT_CONFIG="/boot/config.txt"
if [[ -L "$BOOT_CONFIG" ]]; then
info "### $BOOT_CONFIG is a symlink."
DESTINATION=$(readlink -f "$BOOT_CONFIG")
if [ -n "$DESTINATION" ]; then
info "### Found symlink of $DESTINATION"
BOOT_CONFIG=$DESTINATION
else
warn "WARN: Unable to determine the destination of $BOOT_CONFIG."
fi
if [ -f '/boot/firmware/config.txt' ]; then
BOOT_CONFIG="/boot/firmware/config.txt"
else
BOOT_CONFIG="/boot/config.txt"
fi
usermod -a -G gpio www-data
# remove old artifacts from node-rpio library, if there was
Expand Down
8 changes: 6 additions & 2 deletions src/js/remotebuzzer_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,16 @@ function gpioSanity(gpioconfig) {
throw new Error(gpioconfig + ' is not a valid number');
}

cmd = 'sed -n "s/^gpio=\\(.*\\)=pu/\\1/p" /boot/config.txt';
const configPath = fs.existsSync('/boot/firmware/config.txt')
? '/boot/firmware/config.txt'
: '/boot/config.txt';

cmd = 'sed -n "s/^gpio=\\(.*\\)=pu/\\1/p" ' + configPath;
stdout = execSync(cmd).toString();

if (!stdout.split(',').find((el) => el == gpioconfig)) {
throw new Error(
'GPIO' + gpioconfig + ' is not configured as PULLUP in /boot/config.txt - see FAQ for details'
'GPIO' + gpioconfig + ' is not configured as PULLUP in ' + configPath + ' - see FAQ for details'
);
}

Expand Down

0 comments on commit 050bf73

Please sign in to comment.