Cleanup hooks
This add a script to use either the user hook or the default one. Sometime we checked the user hook or a default code. We move this default code in a defaut hook. Signed-off-by: Stacy Harper <contact@stacyharper.net> Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This commit is contained in:
parent
0ed27f8538
commit
e6ea657634
22 changed files with 160 additions and 254 deletions
37
configs/default_hooks/unlocksim
Normal file
37
configs/default_hooks/unlocksim
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# include common definitions
|
||||
# shellcheck source=scripts/core/sxmo_common.sh
|
||||
. "$(dirname "$0")/sxmo_common.sh"
|
||||
|
||||
modem_n() {
|
||||
MODEMS="$(mmcli -L)"
|
||||
echo "$MODEMS" | grep -oE 'Modem\/([0-9]+)' | cut -d'/' -f2
|
||||
return
|
||||
}
|
||||
|
||||
sim_n() {
|
||||
SIMS="$(mmcli -m "$(modem_n)" | grep SIM)"
|
||||
echo "$SIMS" | grep -oE 'SIM\/([0-9]+)' | cut -d'/' -f2
|
||||
return
|
||||
}
|
||||
|
||||
retry=1
|
||||
pkill dmenu #kill existing dmenu
|
||||
while [ $retry -eq 1 ]; do
|
||||
PICKED="$(
|
||||
# shellcheck disable=SC2039,SC3037
|
||||
echo -e "Cancel\n0000\n1234" | sxmo_dmenu_with_kb.sh -l 3 -c -p "PIN:" | tr -d "\n\r "
|
||||
)"
|
||||
if [ -n "$PICKED" ] && [ "$PICKED" != "Cancel" ]; then
|
||||
retry=0
|
||||
mmcli -i "$(sim_n)" --pin "$PICKED" > /tmp/unlockmsg 2>&1 || retry=1
|
||||
MSG=$(cat /tmp/unlockmsg)
|
||||
[ -n "$MSG" ] && notify-send "$MSG"
|
||||
if echo "$MSG" | grep -q "not SIM-PIN locked"; then
|
||||
retry=0
|
||||
fi
|
||||
else
|
||||
retry=0
|
||||
fi
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue