40 lines
1.5 KiB
Bash
40 lines
1.5 KiB
Bash
#!/system/bin/sh
|
|
# CamSwapper HAL Hook - Module installation customization
|
|
# This script is SOURCED (not executed) by the Magisk/KernelSU installer
|
|
# after files are extracted and default permissions applied.
|
|
|
|
# Skip default unzip since our module files are at ZIP root
|
|
# (no system/ directory to mount)
|
|
SKIPUNZIP=0
|
|
|
|
# Module doesn't modify /system, so skip mount
|
|
# (we use LD_PRELOAD via wrap property instead)
|
|
|
|
# Set permissions for scripts and library
|
|
set_perm_recursive "$MODPATH" 0 0 0755 0644
|
|
set_perm "$MODPATH/post-fs-data.sh" 0 0 0755
|
|
set_perm "$MODPATH/service.sh" 0 0 0755
|
|
set_perm "$MODPATH/uninstall.sh" 0 0 0755
|
|
set_perm "$MODPATH/libcamera_hook.so" 0 0 0644
|
|
|
|
# Create config directory for HAL hook runtime config
|
|
mkdir -p /data/local/camera_magic
|
|
chmod 755 /data/local/camera_magic
|
|
|
|
# Create default config (virtual camera disabled by default)
|
|
if [ ! -f /data/local/camera_magic/config.txt ]; then
|
|
echo "enabled=0" > /data/local/camera_magic/config.txt
|
|
echo "source_mode=file" >> /data/local/camera_magic/config.txt
|
|
echo "video_path=/data/local/camera_magic/video.mp4" >> /data/local/camera_magic/config.txt
|
|
echo "rtsp_url=" >> /data/local/camera_magic/config.txt
|
|
chmod 644 /data/local/camera_magic/config.txt
|
|
fi
|
|
|
|
ui_print "- Config directory: /data/local/camera_magic/"
|
|
ui_print "- Default config created (HAL mode disabled)"
|
|
ui_print ""
|
|
ui_print "After reboot:"
|
|
ui_print " 1. Enable HAL mode in CamSwapper app"
|
|
ui_print " 2. Or edit /data/local/camera_magic/config.txt"
|
|
ui_print " 3. Open any camera app to see virtual feed"
|