#!/bin/sh # SPDX-License-Identifier: AGPL-3.0-only # Copyright 2022 Sxmo Contributors # shellcheck source=configs/default_hooks/sxmo_hook_icons.sh . sxmo_hook_icons.sh # shellcheck source=scripts/core/sxmo_common.sh . "$(dirname "$0")/sxmo_common.sh" set -e VVM_BASE_DIR="${SXMO_VVM_BASE_DIR:-"$HOME"/.vvm/modemmanager}" VVMCONFIG="$VVM_BASE_DIR/vvm" defaultconfig() { cat < "$FILE" continue ;; esac KEY="$(printf %s "$CHOICE" | cut -d= -f1)" VALUE="$(printf %s "$CHOICE" | cut -d= -f2-)" NEWVALUE="$(valuemenu "$KEY" "$VALUE")" sed -i "$FILE" -e "s|^$CHOICE$|$KEY=$NEWVALUE|" done } newfile() { tmp="$(mktemp)" defaultconfig > "$tmp" editfile "$tmp" mv "$tmp" "$VVMCONFIG" } mkdir -p "$VVM_BASE_DIR" superctl stop vvmd finish() { superctl start vvmd } trap 'finish' EXIT if [ -f "$VVMCONFIG" ]; then editfile "$VVMCONFIG" else newfile fi