Driver Manager v2.0.0 - LSPosed-style rewrite
Complete rewrite with: - Per-app driver scoping via mount namespace isolation (LSPosed-style) - System-wide driver mode selection - .ko kernel module manager with autoload and dependency tracking - Driver integrity protection (monitor/enforce modes) - Driver registry with auto-discovery and SHA256 hashing - LSPosed-style dark WebUI with 6 tabs: Dashboard, Drivers, Apps, Modules, Protection, Logs - RESTful API handler for WebUI communication - Zygote process monitor for auto-applying scopes to new app launches Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
101
customize.sh
Normal file
101
customize.sh
Normal file
@@ -0,0 +1,101 @@
|
||||
#!/system/bin/sh
|
||||
# Driver Manager v2 - Installation Script
|
||||
# Runs during KernelSU module installation
|
||||
|
||||
MODDIR=${MODPATH:-/data/adb/modules/driver-manager}
|
||||
CONFIGDIR="$MODDIR/config"
|
||||
MODULESDIR="$MODDIR/modules"
|
||||
DRIVERSDIR="$MODDIR/drivers"
|
||||
BACKUPDIR="$MODDIR/backup"
|
||||
LOGFILE="$MODDIR/install.log"
|
||||
|
||||
log() { echo "[driver-manager] $1" >> "$LOGFILE" 2>/dev/null; ui_print "$1"; }
|
||||
|
||||
ui_print "================================================"
|
||||
ui_print " Driver Manager v2.0.0"
|
||||
ui_print " LSPosed-style driver management"
|
||||
ui_print "================================================"
|
||||
|
||||
# --- Detect Hardware ---
|
||||
DEVICE=$(getprop ro.product.device 2>/dev/null || echo "unknown")
|
||||
MODEL=$(getprop ro.product.model 2>/dev/null || echo "unknown")
|
||||
SOC=$(getprop ro.hardware.chipname 2>/dev/null || getprop ro.board.platform 2>/dev/null || echo "unknown")
|
||||
ARCH=$(getprop ro.product.cpu.abi 2>/dev/null || echo "arm64-v8a")
|
||||
API=$(getprop ro.build.version.sdk 2>/dev/null || echo "35")
|
||||
KERNEL=$(uname -r 2>/dev/null || echo "unknown")
|
||||
|
||||
ui_print " Device: $MODEL ($DEVICE)"
|
||||
ui_print " SoC: $SOC"
|
||||
ui_print " Arch: $ARCH"
|
||||
ui_print " API: $API"
|
||||
ui_print " Kernel: $KERNEL"
|
||||
ui_print "------------------------------------------------"
|
||||
|
||||
# --- Create directories ---
|
||||
mkdir -p "$CONFIGDIR"
|
||||
mkdir -p "$MODULESDIR"
|
||||
mkdir -p "$DRIVERSDIR"
|
||||
mkdir -p "$BACKUPDIR"
|
||||
mkdir -p "$MODDIR/run"
|
||||
mkdir -p "$MODDIR/logs"
|
||||
|
||||
# --- Device profile ---
|
||||
cat > "$CONFIGDIR/device.json" << DEVEOF
|
||||
{
|
||||
"device": "$DEVICE",
|
||||
"model": "$MODEL",
|
||||
"soc": "$SOC",
|
||||
"arch": "$ARCH",
|
||||
"api": $API,
|
||||
"kernel": "$KERNEL",
|
||||
"install_time": "$(date -Iseconds 2>/dev/null || date)"
|
||||
}
|
||||
DEVEOF
|
||||
|
||||
# --- Default configuration ---
|
||||
cat > "$CONFIGDIR/settings.json" << SETEOF
|
||||
{
|
||||
"protection_mode": "monitor",
|
||||
"protection_interval": 300,
|
||||
"scope_mode": "app",
|
||||
"log_level": "info",
|
||||
"auto_apply_scopes": true,
|
||||
"monitor_zygote": true
|
||||
}
|
||||
SETEOF
|
||||
|
||||
# --- Initialize empty scopes ---
|
||||
[ ! -f "$CONFIGDIR/scopes.json" ] && echo '{"scopes":[]}' > "$CONFIGDIR/scopes.json"
|
||||
|
||||
# --- Initialize empty autoload ---
|
||||
[ ! -f "$CONFIGDIR/autoload.conf" ] && touch "$CONFIGDIR/autoload.conf"
|
||||
|
||||
# --- Scan and register system drivers ---
|
||||
ui_print " Scanning system drivers..."
|
||||
if [ -f "$MODDIR/scripts/driver_registry.sh" ]; then
|
||||
sh "$MODDIR/scripts/driver_registry.sh" scan 2>> "$LOGFILE"
|
||||
DRIVER_COUNT=$(sh "$MODDIR/scripts/driver_registry.sh" count 2>/dev/null || echo "0")
|
||||
ui_print " Found $DRIVER_COUNT driver categories"
|
||||
else
|
||||
ui_print " [WARN] driver_registry.sh not found, will scan on first boot"
|
||||
fi
|
||||
|
||||
# --- Create protection baseline ---
|
||||
ui_print " Creating driver protection baseline..."
|
||||
if [ -f "$MODDIR/scripts/protect.sh" ]; then
|
||||
sh "$MODDIR/scripts/protect.sh" baseline 2>> "$LOGFILE"
|
||||
ui_print " Protection baseline created"
|
||||
else
|
||||
ui_print " [WARN] protect.sh not found, will baseline on first boot"
|
||||
fi
|
||||
|
||||
# --- Set permissions ---
|
||||
set_perm_recursive $MODDIR/scripts 0 0 0755 0755
|
||||
set_perm $MODDIR/service.sh 0 0 0755
|
||||
set_perm $MODDIR/post-fs-data.sh 0 0 0755
|
||||
set_perm $MODDIR/uninstall.sh 0 0 0755
|
||||
|
||||
ui_print "------------------------------------------------"
|
||||
ui_print " Installation complete!"
|
||||
ui_print " Open KernelSU WebUI to manage drivers"
|
||||
ui_print "================================================"
|
||||
Reference in New Issue
Block a user