Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding bulk reenable #11

Merged
merged 1 commit into from
Dec 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions xteve/rootfs/usr/local/bin/docker-xteve-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ else
fi

chown -R ${UID}:${GID} /etc/xteve
sudo -H -u xteve -- "/usr/local/bin/xteve_enable_mappings"

if [[ -x "/usr/bin/xteve" ]]; then
echo >&2 "🆗 Ready 3"
Expand Down
45 changes: 45 additions & 0 deletions xteve/rootfs/usr/local/bin/xteve_enable_mappings
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
# Script to re-enable all xteve mappings
# Performs a regex on the config file
# s/(\s+\"x-active\": )false(,)/\1true\2/
#
# Passed as command line switches
# -c or --conf: The config file (default /etc/xteve/config/xepg.json)
#
# Example:
# xteve_enable_mappings conf=/etc/xteve/config/xepg.json
#
# Author: Troy Kelly
# Date: 2022-12-18
# Version: 0.1

# Get command line
while [[ $# -gt 0 ]]
do
key="$1"

case $key in
-c|--conf)
CONF="$2"
shift # past argument
shift # past value
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters

# Set defaults
CONF=${CONF:-"/etc/xteve/config/xepg.json"}

# Check for config file
if [ ! -f "$CONF" ]; then
echo "Config file not found: $CONF"
exit 1
fi

# Perform regex
sed -i --regexp-extended "s/(\s+\"x-active\": )false(,)/\1true\2/" "$CONF"