Add NeoUI passcode configurator, duress mode profile, and Bluetooth OBEX UI

This commit is contained in:
Luxferre committed 2026-10-30 19:28:31 +02:00
1 parent 51a1a91d42
commit 62ac46e498
100 files changed
+2736 -240

No files matched your search

+4
View File
@@ -39,6 +39,10 @@ permit nopass :wheel as root cmd /usr/bin/sxmo_sdcard.sh
permit nopass :wheel as root cmd sxmo_sdcard.sh
permit nopass :wheel as root cmd /usr/bin/bananarchy-verify-passcode
permit nopass :wheel as root cmd bananarchy-verify-passcode
permit nopass :wheel as root cmd /usr/bin/bananarchy-engmenu-exec
permit nopass :wheel as root cmd bananarchy-engmenu-exec
permit nopass :wheel as root cmd /usr/bin/bananarchy-bt-obex
permit nopass :wheel as root cmd bananarchy-bt-obex
permit nopass :wheel as root cmd /usr/bin/plymouth args quit
permit nopass :wheel as root cmd plymouth args quit
permit nopass :wheel as root cmd rc-service args hexagonrpcd-adsp-sensorspd stop
+117
View File
@@ -0,0 +1,117 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
# Activates Bananarchy Duress Mode (blank profile in /tmp/duress_home,
# Nordic theme & wallpaper, SD card unmounted, restricted apps disabled).
export DISPLAY="${DISPLAY:-:0}"
export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/10000}"
# Cache real TAC before switching if not already cached
if [ ! -f /tmp/bananarchy_real_tac ]; then
doas -n /usr/libexec/msm-modem-uim-selection imei 2>/dev/null | \
awk -F= '/^IMEI[12]=/ && length($2) >= 8 { print substr($2, 1, 8) }' > /tmp/bananarchy_real_tac.tmp 2>/dev/null || true
if [ -s /tmp/bananarchy_real_tac.tmp ]; then
mv -f /tmp/bananarchy_real_tac.tmp /tmp/bananarchy_real_tac
else
rm -f /tmp/bananarchy_real_tac.tmp
fi
fi
printf '1\n' > /tmp/bananarchy_duress_mode
chmod 0644 /tmp/bananarchy_duress_mode 2>/dev/null || true
# Generate session-persistent Luhn-valid random IMEIs from the device TAC
if [ ! -s /tmp/bananarchy_duress_imei ]; then
TAC1="$(sed -n '1p' /tmp/bananarchy_real_tac 2>/dev/null | tr -cd '0-9' | cut -c1-8)"
TAC2="$(sed -n '2p' /tmp/bananarchy_real_tac 2>/dev/null | tr -cd '0-9' | cut -c1-8)"
[ "${#TAC1}" -ne 8 ] && TAC1="35829909"
[ "${#TAC2}" -ne 8 ] && TAC2="$TAC1"
S1="$(od -An -N4 -tu4 /dev/urandom 2>/dev/null | tr -d ' ')"
S2="$(od -An -N4 -tu4 /dev/urandom 2>/dev/null | tr -d ' ')"
awk -v t1="$TAC1" -v t2="$TAC2" -v s1="${S1:-12345}" -v s2="${S2:-67890}" '
function gen_imei(tac, seed, snr, body, sum, i, d, chk) {
srand(seed)
snr = sprintf("%06d", int(rand() * 900000) + 100000)
body = substr(tac, 1, 8) snr
sum = 0
for (i = 1; i <= 14; i++) {
d = substr(body, i, 1) + 0
if (i % 2 == 0) {
d = d * 2
if (d > 9) d -= 9
}
sum += d
}
chk = (10 - (sum % 10)) % 10
return body chk
}
BEGIN {
i1 = gen_imei(t1, s1 + 0)
i2 = gen_imei(t2, s2 + 17)
if (i2 == i1) i2 = gen_imei(t2, s2 + 99991)
printf "IMEI1=%s\nIMEI2=%s\nIMEI_SV=01\n", i1, i2
}
' > /tmp/bananarchy_duress_imei
fi
# Unmount SD card immediately
doas -n /usr/bin/sxmo_sdcard.sh --force-unmount >/dev/null 2>&1 || true
# Initialize clean blank profile directory
DURESS_HOME="/tmp/duress_home"
rm -rf "$DURESS_HOME" 2>/dev/null || true
mkdir -p \
"$DURESS_HOME/Desktop" \
"$DURESS_HOME/Documents" \
"$DURESS_HOME/Downloads" \
"$DURESS_HOME/Music" \
"$DURESS_HOME/Pictures" \
"$DURESS_HOME/Projects" \
"$DURESS_HOME/Videos" \
"$DURESS_HOME/.config/sxmo" \
"$DURESS_HOME/.config/dunst" \
"$DURESS_HOME/.local/share/sxmo/modem" \
"$DURESS_HOME/.local/share/sxmo/block" \
"$DURESS_HOME/.local/share/sxmo/notifications" \
"$DURESS_HOME/.cache/sxmo" \
"$DURESS_HOME/.local/state" \
"$DURESS_HOME/.xthemes"
: > "$DURESS_HOME/.config/sxmo/contacts.tsv"
: > "$DURESS_HOME/.config/sxmo/block.tsv"
: > "$DURESS_HOME/.local/share/sxmo/modem/modemlog.tsv"
: > "$DURESS_HOME/.local/share/sxmo/block/modemlog.tsv"
# Clear active notification files
rm -rf "$XDG_RUNTIME_DIR/sxmo_notifications"/* 2>/dev/null || true
# Set Nordic theme (NordFrost.xth) and nordic-peaks.png wallpaper only
NORD_SRC="/etc/skel/.xthemes/NordFrost.xth"
[ ! -r "$NORD_SRC" ] && NORD_SRC="/home/user/.xthemes/NordFrost.xth"
if [ -r "$NORD_SRC" ]; then
cp -f "$NORD_SRC" "$DURESS_HOME/.xthemes/NordFrost.xth"
cp -f "$NORD_SRC" "$DURESS_HOME/.Xresources"
fi
printf '/usr/share/wallpapers/nordic-peaks.png\n' > "$DURESS_HOME/.config/sxmo/wallpaper"
printf 'fill\n' > "$DURESS_HOME/.config/sxmo/wallpaper_mode"
if [ -r "$DURESS_HOME/.Xresources" ]; then
xrdb -load "$DURESS_HOME/.Xresources" >/dev/null 2>&1 || true
fi
feh --no-fehbg --bg-fill /usr/share/wallpapers/nordic-peaks.png >/dev/null 2>&1 </dev/null &
# Terminate any open terminals and restricted apps
pkill -9 -x st >/dev/null 2>&1 || true
# Notify all plugins to close overlays and reload theme/profile
for p in dmenu xdrawer passcode tox irc sip engmenu dialer calllog contacts sms files camera themes modem networks ringtones wallpapers music email smallweb gps; do
fifo="/tmp/dwm_plugin_${p}.fifo"
if [ -p "$fifo" ]; then
printf 'CLOSE\nRELOAD_THEME\n' > "$fifo" 2>/dev/null || true
fi
done
/usr/bin/bananarchy-sync-dunst-theme >/dev/null 2>&1 &
dunstctl close-all >/dev/null 2>&1 || true
exit 0
Binary file not shown.
Binary file not shown.
@@ -123,6 +123,7 @@ while [ "$(cat "$SESSION_PID_FILE" 2>/dev/null)" = "$$" ]; do
exit 0
fi
xrdb -merge "$HOME/.Xresources" >/dev/null 2>&1 || true
/usr/bin/bananarchy-sync-dunst-theme --no-restart >/dev/null 2>&1 || true
WP_FILE="/usr/share/wallpapers/bananarchy.png"
if [ -f "$XDG_CONFIG_HOME/sxmo/wallpaper" ]; then
custom_wp="$(head -n 1 "$XDG_CONFIG_HOME/sxmo/wallpaper" 2>/dev/null)"
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -1
View File
@@ -225,7 +225,8 @@ $icon_phl Modem Log^0^sxmo_modemlog.sh"
bt_is_unblocked_fast && _bt_icon="$icon_ton"
_susp_icon="$icon_ton"
[ -e "${XDG_CACHE_HOME:-$HOME/.cache}/sxmo/sxmo.nosuspend" ] && _susp_icon="$icon_tof"
CHOICES="$icon_cfg Themes^0^xthemes
CHOICES="$icon_plk Passcode^0^xpasscode
$icon_cfg Themes^0^xthemes
$icon_aru Brightness^1^sxmo_brightness.sh up
$icon_ard Brightness^1^sxmo_brightness.sh down
$icon_bth Bluetooth $_bt_icon^1^doas sxmo_bluetoothtoggle.sh && sxmo_hook_statusbar.sh bluetooth
+13
View File
@@ -5,6 +5,19 @@
# This script is meant to be sourced by various sxmo scripts
# and defines some common settings
if [ -e /tmp/bananarchy_duress_mode ]; then
export HOME="/tmp/duress_home"
export XDG_CONFIG_HOME="/tmp/duress_home/.config"
export XDG_DATA_HOME="/tmp/duress_home/.local/share"
export XDG_CACHE_HOME="/tmp/duress_home/.cache"
export XDG_STATE_HOME="/tmp/duress_home/.local/state"
export SXMO_CONTACTFILE="/tmp/duress_home/.config/sxmo/contacts.tsv"
export SXMO_BLOCKFILE="/tmp/duress_home/.config/sxmo/block.tsv"
export SXMO_BLOCKDIR="/tmp/duress_home/.local/share/sxmo/block"
export SXMO_LOGDIR="/tmp/duress_home/.local/share/sxmo/modem"
export SXMO_NOTIFDIR="/tmp/duress_home/.local/share/sxmo/notifications"
fi
export HOME="${HOME:-/home/user}"
export DISPLAY="${DISPLAY:-:0}"
export SXMO_WM="${SXMO_WM:-dwm}"
+53 -4
View File
@@ -76,6 +76,9 @@ find_sd_part() {
}
probe_controller() {
if [ -f /tmp/bananarchy_duress_mode ]; then
return 1
fi
if [ -b /dev/mmcblk1 ]; then
return 0
fi
@@ -91,11 +94,18 @@ probe_controller() {
sleep 0.1
i="$(( i + 1 ))"
done
if [ ! -b /dev/mmcblk1 ]; then
printf "7864900.sdhci" > /sys/bus/platform/drivers/sdhci_msm/unbind 2>/dev/null || true
fi
fi
[ -b /dev/mmcblk1 ]
}
do_mount() {
if [ -f /tmp/bananarchy_duress_mode ]; then
rm -f "$STATE_FILE" 2>/dev/null || true
return 1
fi
if [ "$(id -u)" -ne 0 ]; then
exec doas /usr/bin/sxmo_sdcard.sh mount "$@"
fi
@@ -178,16 +188,30 @@ do_unmount() {
exec doas /usr/bin/sxmo_sdcard.sh unmount "$@"
fi
force_mode=0
if [ "${1:-}" = "--force-unmount" ]; then
force_mode=1
fi
sync
if ! is_mounted; then
rm -f "$STATE_FILE" 2>/dev/null || true
if [ "$force_mode" -eq 1 ] && [ -w /sys/bus/platform/drivers/sdhci_msm/unbind ]; then
printf "7864900.sdhci" > /sys/bus/platform/drivers/sdhci_msm/unbind 2>/dev/null || true
fi
printf "SD card is not mounted\n"
return 0
fi
if umount "$MOUNT_POINT" 2>/dev/null || umount -l "$MOUNT_POINT" 2>/dev/null; then
rm -f "$STATE_FILE" 2>/dev/null || true
notify_user "SD Card" "Safely unmounted $MOUNT_POINT"
if [ "$force_mode" -eq 1 ]; then
if [ -w /sys/bus/platform/drivers/sdhci_msm/unbind ]; then
printf "7864900.sdhci" > /sys/bus/platform/drivers/sdhci_msm/unbind 2>/dev/null || true
fi
else
notify_user "SD Card" "Safely unmounted $MOUNT_POINT"
fi
printf "Unmounted %s\n" "$MOUNT_POINT"
return 0
fi
@@ -197,6 +221,10 @@ do_unmount() {
}
do_rescan() {
if [ -f /tmp/bananarchy_duress_mode ]; then
rm -f "$STATE_FILE" 2>/dev/null || true
return 1
fi
if [ "$(id -u)" -ne 0 ]; then
exec doas /usr/bin/sxmo_sdcard.sh rescan
fi
@@ -212,6 +240,11 @@ do_rescan() {
}
do_status() {
if [ -f /tmp/bananarchy_duress_mode ]; then
rm -f "$STATE_FILE" 2>/dev/null || true
printf "absent\n"
return 0
fi
if is_mounted; then
printf "1\n" > "$STATE_FILE" 2>/dev/null || true
dev="$(findmnt -rn -o SOURCE "$MOUNT_POINT" 2>/dev/null || printf "/dev/mmcblk1p1")"
@@ -233,6 +266,9 @@ do_status() {
}
do_menu() {
if [ -f /tmp/bananarchy_duress_mode ]; then
exit 0
fi
. sxmo_hook_icons.sh
. sxmo_common.sh
@@ -280,10 +316,10 @@ case "$cmd" in
do_status
;;
is_mounted|ismounted)
is_mounted
[ ! -f /tmp/bananarchy_duress_mode ] && is_mounted
;;
is_present|ispresent)
find_sd_part >/dev/null 2>&1
[ ! -f /tmp/bananarchy_duress_mode ] && find_sd_part >/dev/null 2>&1
;;
mount)
do_mount "$@"
@@ -291,6 +327,9 @@ case "$cmd" in
unmount|umount|eject)
do_unmount "$@"
;;
--force-unmount)
do_unmount --force-unmount
;;
rescan|detect|probe)
do_rescan
;;
@@ -299,11 +338,16 @@ case "$cmd" in
kname="${2:-}"
case "$act" in
add|boot)
if [ -f /tmp/bananarchy_duress_mode ]; then
exit 0
fi
if [ -n "$kname" ]; then
do_mount "/dev/$kname" >/dev/null 2>&1 || true
else
if find_sd_part >/dev/null 2>&1; then
do_mount >/dev/null 2>&1 || true
elif [ -w /sys/bus/platform/drivers/sdhci_msm/unbind ]; then
printf "7864900.sdhci" > /sys/bus/platform/drivers/sdhci_msm/unbind 2>/dev/null || true
fi
fi
;;
@@ -311,7 +355,12 @@ case "$cmd" in
if [ "$(id -u)" -eq 0 ]; then
umount -l "$MOUNT_POINT" 2>/dev/null || true
rm -f "$STATE_FILE" 2>/dev/null || true
notify_user "SD Card" "SD card removed"
if [ -w /sys/bus/platform/drivers/sdhci_msm/unbind ]; then
printf "7864900.sdhci" > /sys/bus/platform/drivers/sdhci_msm/unbind 2>/dev/null || true
fi
if [ ! -f /tmp/bananarchy_duress_mode ]; then
notify_user "SD Card" "SD card removed"
fi
fi
;;
esac
+4
View File
@@ -8,6 +8,10 @@ export CHARSET=UTF-8
export LANG=C.UTF-8
export LC_ALL=C.UTF-8
if [ -f /tmp/bananarchy_duress_mode ]; then
exit 1
fi
SXMO_TERMINAL="${SXMO_TERMINAL:-st}"
if [ -z "$*" ]; then
+1
View File
@@ -0,0 +1 @@
dwm-plugin
+1
View File
@@ -0,0 +1 @@
dwm-plugin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.