diff options
-rw-r--r-- | mod/hakchi/init | 20 | ||||
-rwxr-xr-x | mod/hakchi/rootfs/bin/chmenu | 1 | ||||
-rwxr-xr-x | mod/hakchi/rootfs/etc/init.d/S78clvcon | 47 | ||||
-rw-r--r-- | mod/hakchi/rootfs/etc/inittab | 2 | ||||
-rw-r--r-- | mod/hakchi/rootfs/etc/preinit.d/b0000_defines | 34 | ||||
-rw-r--r-- | mod/hakchi/rootfs/etc/preinit.d/b0010_functions | 39 | ||||
-rw-r--r-- | mod/hakchi/rootfs/etc/preinit.d/pa100_games | 6 | ||||
-rw-r--r-- | mod/hakchi/script/base | 19 | ||||
-rw-r--r-- | mod/hakchi/script/install | 9 | ||||
-rw-r--r-- | mod/hakchi/script/transfer | 9 |
10 files changed, 133 insertions, 53 deletions
diff --git a/mod/hakchi/init b/mod/hakchi/init index ac0ebf1..e885e8e 100644 --- a/mod/hakchi/init +++ b/mod/hakchi/init @@ -2,16 +2,16 @@ init(){ echo /bin/busybox --install -s /bin/ -local modname=hakchi -local modpath=/$modname -local mountpoint=/newroot -local installpath=$mountpoint/var/lib/$modname -local firmwarepath=$installpath/firmware -local rootfs=$installpath/rootfs -local preinit=$rootfs/etc/preinit -local preinitpath=$preinit.d -local gamepath=/usr/share/games/nes/kachikachi -local temppath=/tmp +local modname="hakchi" +local modpath="/$modname" +local mountpoint="/newroot" +local installpath +local firmwarepath +local rootfs +local preinit +local preinitpath +local gamepath +local temppath="/tmp" mkdir -p "$temppath" diff --git a/mod/hakchi/rootfs/bin/chmenu b/mod/hakchi/rootfs/bin/chmenu index b5d76c6..dfff917 100755 --- a/mod/hakchi/rootfs/bin/chmenu +++ b/mod/hakchi/rootfs/bin/chmenu @@ -31,6 +31,7 @@ fi pkill -KILL clover-mcp pkill -KILL ReedPlayer-Clover +rm -rf /var/cache/clover overmount_games diff --git a/mod/hakchi/rootfs/etc/init.d/S78clvcon b/mod/hakchi/rootfs/etc/init.d/S78clvcon new file mode 100755 index 0000000..9b47abc --- /dev/null +++ b/mod/hakchi/rootfs/etc/init.d/S78clvcon @@ -0,0 +1,47 @@ +#!/bin/sh + +CLV_BOARD_NAME=$(cat /etc/clover/boardtype) +MODULE="clvcon" +[ -f "/lib/modules/$(uname -r)/extra/$MODULE.ko" ] || MODULE="clovercon" + +start() +{ + echo "$MODULE: starting driver" + case "${CLV_BOARD_NAME}" in + fp) + # inverted c1/c2 detect lines + MODULE_PARAMS="2,195,1,194" + ;; + ep|dp-nes|dp-shvc) + # regular setup w/ detect lines + MODULE_PARAMS="1,195,2,194" + ;; + dp-hvc) + # no detect lines + MODULE_PARAMS="1,-1,2,-1" + ;; + esac + modprobe "$MODULE" module_params=$MODULE_PARAMS +} + +stop() +{ + echo "$MODULE: stopping driver" + modprobe -r "$MODULE" +} + +case "$1" in +start) + start +;; +stop) + stop +;; +restart) + stop + start +;; +*) + echo "$MODULE: Please use start, stop, or restart." + exit 1 +esac diff --git a/mod/hakchi/rootfs/etc/inittab b/mod/hakchi/rootfs/etc/inittab index 8bba354..ee87e54 100644 --- a/mod/hakchi/rootfs/etc/inittab +++ b/mod/hakchi/rootfs/etc/inittab @@ -5,7 +5,7 @@ null::sysinit:/bin/mkdir -p /var/cache /var/lock /var/log /var/spool null::sysinit:/bin/ln -s /tmp /var/tmp null::sysinit:/bin/ln -s /run /var/run -null::sysinit:/bin/mkdir -p /var/cache/clover/reed-libs/tmp /var/lib/clover/profiles/0/home-menu /var/lib/clover/config/reed-libs +null::sysinit:/bin/mkdir -p /var/cache/clover/reed-libs/tmp /var/lib/clover/profiles/0/home-menu /var/lib/clover/config/reed-libs /var/lib/profiling-data null::sysinit:/etc/init.d/rcS diff --git a/mod/hakchi/rootfs/etc/preinit.d/b0000_defines b/mod/hakchi/rootfs/etc/preinit.d/b0000_defines index 59c101e..f4e20ec 100644 --- a/mod/hakchi/rootfs/etc/preinit.d/b0000_defines +++ b/mod/hakchi/rootfs/etc/preinit.d/b0000_defines @@ -1,9 +1,25 @@ -modname=hakchi -modpath=/$modname -installpath=$mountpoint/var/lib/$modname -firmwarepath=$installpath/firmware -rootfs=$installpath/rootfs -preinit=$rootfs/etc/preinit -preinitpath=$preinit.d -gamepath=/usr/share/games/nes/kachikachi -temppath=/tmp +set_gamepath(){ + local feck="$mountpoint/var/lib/clover/profiles/0/home-menu/save/system-save.json" + if [ -f "$mountpoint/etc/clover/version/canoe" ]; then + echo "SNES gamepath" + gamepath="/usr/share/games" + [ -f "$feck" ] && rm -f "$feck" + else + echo "NES gamepath" + gamepath="/usr/share/games/nes/kachikachi" + [ -d "$feck" ] && rm -rf "$feck" + fi +} + +modname="hakchi" +modpath="/$modname" +#mountpoint="/newroot" +installpath="$mountpoint/var/lib/$modname" +firmwarepath="$installpath/firmware" +rootfs="$installpath/rootfs" +preinit="$rootfs/etc/preinit" +preinitpath="$preinit.d" +gamepath="" +set_gamepath +temppath="/tmp" + diff --git a/mod/hakchi/rootfs/etc/preinit.d/b0010_functions b/mod/hakchi/rootfs/etc/preinit.d/b0010_functions index 6ae5fee..2689c24 100644 --- a/mod/hakchi/rootfs/etc/preinit.d/b0010_functions +++ b/mod/hakchi/rootfs/etc/preinit.d/b0010_functions @@ -10,6 +10,34 @@ umount_base(){ umount "$mountpoint/var" } +remove_old(){ + [ -d "$1" ] || return 1 + [ -f "$modpath/script/removed" ] || return 0 + local basepath="$1" + source "$modpath/script/removed" +} + +mod_repair_etc(){ + remove_old "$rootfs" + rm -f "$modpath/rootfs/etc/preinit.d/p0000_config" + chown -R 0:0 $modpath/ + + local etc="$temppath/etc" + rm -rf "$etc" + mkdir -p "$etc" + copy "$mountpoint/etc/" "$etc/" + if [ "$1" == "full" ]; then + copy "$modpath/rootfs/etc/" "$etc/" + else + copy "$rootfs/etc/inittab" "$etc/inittab" + fi + copy "$etc/" "$rootfs/etc/" +} + +mod_repair_modules(){ + restore "/lib/modules/$(uname -r)/" +} + remount_root(){ [ -z "$(mount | grep -F loop)" ] || return 1 @@ -29,7 +57,16 @@ load_firmware(){ [ -d "$firmwarepath" ] || return 0 local firmware=$(find "$firmwarepath" -type f -name "*.hsqs" | sort | head -n 1) [ -f "$firmware" ] || return 0 - remount_root "$firmware" && cryptsetup close root-crypt + mod_repair_modules + remount_root "$firmware" || return 0 + cryptsetup close root-crypt + mod_repair_etc + if [ -d "$rootfs/lib/modules/$(uname -r)" ]; then + overmount "/lib/modules" + else + echo "no modules for loaded kernel $(uname -r)" + fi + set_gamepath } shutdown(){ diff --git a/mod/hakchi/rootfs/etc/preinit.d/pa100_games b/mod/hakchi/rootfs/etc/preinit.d/pa100_games index d0df244..73cf771 100644 --- a/mod/hakchi/rootfs/etc/preinit.d/pa100_games +++ b/mod/hakchi/rootfs/etc/preinit.d/pa100_games @@ -1 +1,5 @@ -overmount_games +if [ -z "$(ls $rootfs$gamepath/CLV-* 2>/dev/null)" ]; then + echo "no romz found" +else + overmount_games +fi diff --git a/mod/hakchi/script/base b/mod/hakchi/script/base index 5e43990..db197dd 100644 --- a/mod/hakchi/script/base +++ b/mod/hakchi/script/base @@ -1,17 +1,2 @@ -mount_base(){ - mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs "$mountpoint/var" - mkdir -p "$mountpoint/var/lib" - mount -o defaults,nosuid,nodev,noatime /dev/nandc "$mountpoint/var/lib" -} - -umount_base(){ - sync - umount "$mountpoint/var/lib" - umount "$mountpoint/var" -} - -remove_old(){ - [ -d "$1" ] || return 1 - local basepath="$1" - source "$modpath/script/removed" -} +source "$modpath/rootfs/etc/preinit" +source_base "$modpath/rootfs/etc/preinit.d" diff --git a/mod/hakchi/script/install b/mod/hakchi/script/install index 9c9f059..f8d6d0a 100644 --- a/mod/hakchi/script/install +++ b/mod/hakchi/script/install @@ -6,17 +6,14 @@ mod_uninstall(){ } mod_repair(){ - restore "/etc/clover/" - restore "/etc/issue" - rm -f "$modpath/rootfs/etc/preinit.d/p0000_config" - chown -R 0:0 $modpath/ + mod_repair_etc full chmod 755 $modpath/rootfs/bin/* - copy "$modpath/rootfs/" "$rootfs/" copy "/bin/" "$rootfs/bin/" copy "/sbin/cryptsetup" "$rootfs/bin/cryptsetup" + copy "$modpath/rootfs/" "$rootfs/" # This file required by hakchi2 kernel... - echo hakchi_enabled=y > "$temppath/config" + echo "hakchi_enabled=y" > "$temppath/config" copy "$temppath/config" "$installpath/" } diff --git a/mod/hakchi/script/transfer b/mod/hakchi/script/transfer index 8d17a07..0ec983c 100644 --- a/mod/hakchi/script/transfer +++ b/mod/hakchi/script/transfer @@ -7,16 +7,9 @@ backup_nandc mount_base backup -remove_old "$modpath/rootfs" -remove_old "$rootfs" - -source "$modpath/rootfs/etc/preinit" -source_base "$modpath/rootfs/etc/preinit.d" source_config -remove_old "$rootfs" - -local transferpath=$modpath/transfer +local transferpath="$modpath/transfer" [ -f "$transferpath/earlybird" ] && source "$transferpath/earlybird" rm -f "$transferpath/earlybird" |