gmenu2x searches opks in /mnt/*/*opk; launcher now stored in /mnt/FunKey/Launchers/launcher.txt
This commit is contained in:
parent
a77c5e67d9
commit
8a62ff605e
|
@ -11,7 +11,6 @@ fi
|
||||||
export PAGER='/bin/more'
|
export PAGER='/bin/more'
|
||||||
export EDITOR='/usr/bin/nano'
|
export EDITOR='/usr/bin/nano'
|
||||||
export SDL_NOMOUSE=1
|
export SDL_NOMOUSE=1
|
||||||
export MEDNAFEN_HOME=/tmp/funkey/.mednafen
|
|
||||||
|
|
||||||
# Source configuration files from /etc/profile.d
|
# Source configuration files from /etc/profile.d
|
||||||
for i in /etc/profile.d/*.sh ; do
|
for i in /etc/profile.d/*.sh ; do
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
/
|
/mnt
|
|
@ -19,8 +19,12 @@ alias l='ls $LS_OPTIONS -lA'
|
||||||
# alias mv='mv -i'
|
# alias mv='mv -i'
|
||||||
|
|
||||||
# Relocate HOME into the r/w partition
|
# Relocate HOME into the r/w partition
|
||||||
export HOME=/mnt/funkey
|
export HOME=/mnt/FunKey
|
||||||
mkdir -p ${HOME}
|
mkdir -p "${HOME}"
|
||||||
|
export MEDNAFEN_HOME=$HOME/.mednafen
|
||||||
|
mkdir -p "${MEDNAFEN_HOME}"
|
||||||
|
export GMENU2X_HOME="$HOME/.gmenu2x"
|
||||||
|
mkdir -p "${GMENU2X_HOME}"
|
||||||
|
|
||||||
# Resize the console to the terminal dimensions
|
# Resize the console to the terminal dimensions
|
||||||
resize() {
|
resize() {
|
||||||
|
|
|
@ -150,14 +150,11 @@ format_backing_store_partition () {
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_files_to_store_partition () {
|
copy_files_to_store_partition () {
|
||||||
# Add file to force assembly tests
|
|
||||||
|
|
||||||
|
|
||||||
mount /mnt/ || die 18 "Cannot mount /mnt"
|
mount /mnt/ || die 18 "Cannot mount /mnt"
|
||||||
unzip -q -o /usr/local/share/mnt_freware_games.zip -d /mnt/
|
unzip -q -o /usr/local/share/mnt_freware_games.zip -d /mnt/
|
||||||
mkdir -p /mnt/apps
|
mkdir -p /mnt/Emulators
|
||||||
set +f
|
set +f
|
||||||
cp -f /usr/games/opk/*.opk /mnt/apps/
|
cp -f /usr/games/opk/*.opk /mnt/Emulators/
|
||||||
set -f
|
set -f
|
||||||
umount /mnt/ || die 20 "Cannot unmount /mnt"
|
umount /mnt/ || die 20 "Cannot unmount /mnt"
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Check args
|
||||||
|
if [ ${#} -ne 0 ]; then
|
||||||
|
echo "Usage: $(basename ${0})"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Launcher File
|
||||||
|
LAUNCHER_FILE=$HOME/Launchers/launcher.txt
|
||||||
|
DEFAULT_LAUNCHER=retrofe
|
||||||
|
|
||||||
|
# Check that file exists
|
||||||
|
[ -f "$LAUNCHER_FILE" ] || set_launcher $DEFAULT_LAUNCHER >/dev/null 2>&1
|
||||||
|
|
||||||
|
# Check Launcher
|
||||||
|
launcher=$(cat "$LAUNCHER_FILE" | head -1)
|
||||||
|
|
||||||
|
# Check not empty
|
||||||
|
[ -z "$LAUNCHER_FILE" ] && launcher=$DEFAULT_LAUNCHER; set_launcher $launcher >/dev/null 2>&1
|
||||||
|
|
||||||
|
# Return launcher name
|
||||||
|
echo $launcher
|
||||||
|
|
||||||
|
exit 0
|
|
@ -3,22 +3,16 @@
|
||||||
# Check number of args
|
# Check number of args
|
||||||
if [ ${#} -ne 1 ]; then
|
if [ ${#} -ne 1 ]; then
|
||||||
echo "Usage: $(basename ${0}) launcher"
|
echo "Usage: $(basename ${0}) launcher"
|
||||||
echo " launcher: retrofe, gmenu2x"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Launcher File
|
||||||
|
LAUNCHER_FILE=$HOME/Launchers/launcher.txt
|
||||||
|
mkdir -p "$(dirname "$LAUNCHER_FILE")"
|
||||||
|
|
||||||
# Check Launcher
|
# Check Launcher
|
||||||
LAUNCHER=${1}
|
NEW_LAUNCHER=${1}
|
||||||
if [ ${LAUNCHER} == "gmenu2x" ]; then
|
echo "Setting launcher: ${NEW_LAUNCHER}"
|
||||||
echo "Setting default launcher: gmenu2x"
|
echo ${NEW_LAUNCHER} > "$LAUNCHER_FILE"
|
||||||
touch /mnt/gmenu2x
|
|
||||||
elif [ ${LAUNCHER} == "retrofe" ]; then
|
|
||||||
echo "Setting default launcher: retrofe"
|
|
||||||
rm -rf /mnt/gmenu2x
|
|
||||||
else
|
|
||||||
echo "Usage: $(basename ${0}) launcher"
|
|
||||||
echo " launcher: retrofe, gmenu2x"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -48,7 +48,8 @@ mount_share () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create the directory structure if required
|
# Create the directory structure if required
|
||||||
(cd /mnt; mkdir -p "Atari lynx" "Game Boy" "Game Boy Color" "Game Boy Advance" "Game Gear" "Neo Geo Pocket" "NES" "PS1" "PS1/bios" "Sega Genesis" "Sega Master System" "SNES" "WonderSwan" "PCE-TurboGrafx")
|
#(cd /mnt; mkdir -p "Applications" "Emulators" "Games" "Atari lynx" "Game Boy" "Game Boy Color" "Game Boy Advance" "Game Gear" "Neo Geo Pocket" "NES" "PS1" "PS1/bios" "Sega Genesis" "Sega Master System" "SNES" "WonderSwan" "PCE-TurboGrafx")
|
||||||
|
(cd /mnt; mkdir -p "Emulators" "Atari lynx" "Game Boy" "Game Boy Color" "Game Boy Advance" "Game Gear" "Neo Geo Pocket" "NES" "PS1" "PS1/bios" "Sega Genesis" "Sega Master System" "SNES" "WonderSwan" "PCE-TurboGrafx")
|
||||||
|
|
||||||
# Check if there is a firmware update file
|
# Check if there is a firmware update file
|
||||||
if [ -f /mnt/FunKey-*.fwu ]; then
|
if [ -f /mnt/FunKey-*.fwu ]; then
|
||||||
|
|
|
@ -18,8 +18,8 @@ fi
|
||||||
touch "${LOCK_FILE}"
|
touch "${LOCK_FILE}"
|
||||||
|
|
||||||
# Increment name and save snapshot
|
# Increment name and save snapshot
|
||||||
SNAPSHOT_DIR=/mnt/funkey/snapshots
|
|
||||||
SNAPSHOT_EXT=PNG
|
SNAPSHOT_EXT=PNG
|
||||||
|
SNAPSHOT_DIR=$HOME/snapshots
|
||||||
mkdir -p "${SNAPSHOT_DIR}"
|
mkdir -p "${SNAPSHOT_DIR}"
|
||||||
last=$(cd ${SNAPSHOT_DIR}; ls IMG_*.${SNAPSHOT_EXT} 2> /dev/null | tail -1 | sed 's/^IMG_0*\([0-9]\+\)\.'${SNAPSHOT_EXT}'$/\1/')
|
last=$(cd ${SNAPSHOT_DIR}; ls IMG_*.${SNAPSHOT_EXT} 2> /dev/null | tail -1 | sed 's/^IMG_0*\([0-9]\+\)\.'${SNAPSHOT_EXT}'$/\1/')
|
||||||
let last=${last}+1
|
let last=${last}+1
|
||||||
|
|
|
@ -6,8 +6,7 @@
|
||||||
LOCK_FILE="/var/lock/launcher.lock"
|
LOCK_FILE="/var/lock/launcher.lock"
|
||||||
INSTANT_PLAY_FILE="/mnt/instant_play"
|
INSTANT_PLAY_FILE="/mnt/instant_play"
|
||||||
PREVENT_LAUNCHER_FILE="/mnt/prevent_launcher"
|
PREVENT_LAUNCHER_FILE="/mnt/prevent_launcher"
|
||||||
GMENU2X_FILE="/mnt/gmenu2x"
|
|
||||||
GMENU2X_HOME="/mnt/funkey/.gmenu2x"
|
|
||||||
|
|
||||||
if [ -f "${LOCK_FILE}" ]; then
|
if [ -f "${LOCK_FILE}" ]; then
|
||||||
echo "${LOCK_FILE} already exists"
|
echo "${LOCK_FILE} already exists"
|
||||||
|
@ -15,12 +14,10 @@ if [ -f "${LOCK_FILE}" ]; then
|
||||||
fi
|
fi
|
||||||
touch "${LOCK_FILE}"
|
touch "${LOCK_FILE}"
|
||||||
|
|
||||||
|
# Sanity cmd: in case these files do not exist
|
||||||
mkdir -p "${MEDNAFEN_HOME}"
|
mkdir -p "${MEDNAFEN_HOME}"
|
||||||
cp "/usr/games/lynxboot.img" "/usr/games/mednafen-09x.cfg" "${MEDNAFEN_HOME}/"
|
cp "/usr/games/lynxboot.img" "/usr/games/mednafen-09x.cfg" "${MEDNAFEN_HOME}/"
|
||||||
|
|
||||||
mkdir -p "${GMENU2X_HOME}"
|
|
||||||
mkdir -p "/mnt/apps"
|
|
||||||
|
|
||||||
# Launch Previous Game if any
|
# Launch Previous Game if any
|
||||||
if [ -f "${INSTANT_PLAY_FILE}" ]; then
|
if [ -f "${INSTANT_PLAY_FILE}" ]; then
|
||||||
echo "Found Instant Play file, restarting previous game with command: "$(head -n 1 "${INSTANT_PLAY_FILE}")
|
echo "Found Instant Play file, restarting previous game with command: "$(head -n 1 "${INSTANT_PLAY_FILE}")
|
||||||
|
@ -37,14 +34,20 @@ while true; do
|
||||||
echo "${PREVENT_LAUNCHER_FILE} file found, not starting launcher"
|
echo "${PREVENT_LAUNCHER_FILE} file found, not starting launcher"
|
||||||
sleep 5
|
sleep 5
|
||||||
else
|
else
|
||||||
if [ -f "${GMENU2X_FILE}" ]; then
|
LAUNCHER=$(get_launcher)
|
||||||
|
|
||||||
|
if [ ${LAUNCHER} == "gmenu2x" ]; then
|
||||||
|
|
||||||
# Launch gmenu2x
|
# Launch gmenu2x
|
||||||
gmenu2x&
|
gmenu2x&
|
||||||
else
|
elif [ ${LAUNCHER} == "retrofe" ]; then
|
||||||
|
|
||||||
# Launch Retrofe
|
# Launch Retrofe
|
||||||
retrofe&
|
retrofe&
|
||||||
|
else
|
||||||
|
DEFAULT_LAUNCHER=retrofe
|
||||||
|
echo "Not recognized launcher: $LAUNCHER, setting $DEFAULT_LAUNCHER"
|
||||||
|
set_launcher $DEFAULT_LAUNCHER
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Record the PID into a file, wait for the
|
# Record the PID into a file, wait for the
|
||||||
|
@ -54,9 +57,7 @@ while true; do
|
||||||
erase_pid
|
erase_pid
|
||||||
|
|
||||||
# Restart ampli audio if necessary
|
# Restart ampli audio if necessary
|
||||||
if [[ "$(volume_get)" -ne "0" ]]; then
|
start_audio_amp 1 >/dev/null 2>&1
|
||||||
start_audio_amp 1 >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# In case retrofe quits with errors, clear graphic VT
|
# In case retrofe quits with errors, clear graphic VT
|
||||||
termfix_all
|
termfix_all
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# gmenu2x
|
# gmenu2x
|
||||||
#
|
#
|
||||||
#############################################################
|
#############################################################
|
||||||
GMENU2X_VERSION = 85402aa
|
GMENU2X_VERSION = ac40292
|
||||||
GMENU2X_SITE_METHOD = git
|
GMENU2X_SITE_METHOD = git
|
||||||
GMENU2X_SITE = https://github.com/FunKey-Project/gmenu2x.git
|
GMENU2X_SITE = https://github.com/FunKey-Project/gmenu2x.git
|
||||||
GMENU2X_LICENSE = GPL-2.0
|
GMENU2X_LICENSE = GPL-2.0
|
||||||
|
|
|
@ -12,19 +12,20 @@ fi
|
||||||
# Lock file (necessary since fbgrab must run in bg not to block the buttons while gaming)
|
# Lock file (necessary since fbgrab must run in bg not to block the buttons while gaming)
|
||||||
LOCK_FILE="/var/lock/snap.lock"
|
LOCK_FILE="/var/lock/snap.lock"
|
||||||
if [ -f "${LOCK_FILE}" ]; then
|
if [ -f "${LOCK_FILE}" ]; then
|
||||||
#echo "${LOCK_FILE} already exists"
|
echo "${LOCK_FILE} already exists"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
touch "${LOCK_FILE}"
|
touch "${LOCK_FILE}"
|
||||||
|
|
||||||
# Increment name and save snapshot
|
# Increment name and save snapshot
|
||||||
SNAPSHOT_DIR=/mnt/funkey/snapshots
|
SNAPSHOT_EXT=PNG
|
||||||
|
SNAPSHOT_DIR=$HOME/snapshots
|
||||||
mkdir -p "${SNAPSHOT_DIR}"
|
mkdir -p "${SNAPSHOT_DIR}"
|
||||||
last=$(cd ${SNAPSHOT_DIR}; ls IMG_*.PNG 2> /dev/null | tail -1 | sed 's/^IMG_0*\([0-9]\+\)\.PNG$/\1/')
|
last=$(cd ${SNAPSHOT_DIR}; ls IMG_*.${SNAPSHOT_EXT} 2> /dev/null | tail -1 | sed 's/^IMG_0*\([0-9]\+\)\.'${SNAPSHOT_EXT}'$/\1/')
|
||||||
let last=${last}+1
|
let last=${last}+1
|
||||||
snapshot_file=$(printf "IMG_%04d.PNG" $last)
|
snapshot_file=$(printf "IMG_%04d.${SNAPSHOT_EXT}" $last)
|
||||||
notif_set 2 " NEW SCREEENSHOT ${snapshot_file}"
|
notif_set 2 " SCREEENSHOT ${snapshot_file}"
|
||||||
fbgrab "${SNAPSHOT_DIR}/${snapshot_file}" &
|
fbgrab "${SNAPSHOT_DIR}/${snapshot_file}" >/dev/null 2>&1 &
|
||||||
|
|
||||||
# Remove lock file
|
# Remove lock file
|
||||||
rm -f "${LOCK_FILE}"
|
rm -f "${LOCK_FILE}"
|
||||||
|
|
|
@ -20,16 +20,21 @@ while true; do
|
||||||
if [ ${perform} -eq 1 ]; then
|
if [ ${perform} -eq 1 ]; then
|
||||||
|
|
||||||
# Compute stats
|
# Compute stats
|
||||||
cpu=$(printf "%.1f\n" $(mpstat -P ALL $UPDATE_PERIOD 1 | tail -1 | awk '{print 100-$12}'))
|
cpu=$(printf "%.0f\n" $(mpstat -P ALL $UPDATE_PERIOD 1 | tail -1 | awk '{print 100-$12}'))
|
||||||
ram_mem=$(printf "%.1f\n" $(free | grep Mem | awk '{print $3/$2 * 100.0}'))
|
ram_mem=$(printf "%.0f\n" $(free | grep Mem | awk '{print $3/$2 * 100.0}'))
|
||||||
ram_swap=$(printf "%.1f\n" $(free | grep Swap | awk '{print $3/$2 * 100.0}'))
|
ram_swap=$(printf "%.0f\n" $(free | grep Swap | awk '{print $3/$2 * 100.0}'))
|
||||||
|
ip_addr=$(ifconfig usb0 | grep "inet " | awk -F'[: ]+' '{ print $4 }')
|
||||||
|
|
||||||
# Notif
|
# Notif
|
||||||
if [ ${notif_dirty} -eq 1 ]; then
|
if [ ${notif_dirty} -eq 1 ]; then
|
||||||
notif_clear
|
notif_clear
|
||||||
notif_dirty=0
|
notif_dirty=0
|
||||||
else
|
else
|
||||||
notif_set 0 "CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%"
|
if [ "x${ip_addr}" != "x" ]; then
|
||||||
|
notif_set 0 " CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%^IP:${ip_addr}"
|
||||||
|
else
|
||||||
|
notif_set 0 " CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
sleep ${UPDATE_PERIOD}
|
sleep ${UPDATE_PERIOD}
|
||||||
|
|
Loading…
Reference in New Issue