#!/bin/sh HOME_DIR="/home/newsboat/.newsboat" URLS_FILE="${HOME_DIR}/urls" # No point starting if they don't have config, also we don't # want to store the actual user data in the container so force # a mount. if [ ! -d $HOME_DIR ]; then echo "Mount your newsboat config to /home/newsboat/.newsboat" exit 1 fi # Also force a urls file because this newsboat will just fail # anyhow without it. if [ ! -f $URLS_FILE ]; then echo "Create a urls file in your newsboat config first" exit 1 fi # Allow users to specify the UID/GID in the environment but # default these to the existing owner of the files in their # mounted config, which should be sane. UID=${UID:-$(stat -c "%u" $URLS_FILE)} GID=${GID:-$(stat -c "%u" $URLS_FILE)} # Create the user and group addgroup -g ${GID} -S newsboat adduser -u ${UID} -S -h /home/newsboat -H -D -G newsboat newsboat /sbin/su-exec newsboat "$@"