more tweaking setup script to avoid a symlink and allow more overriding

This commit is contained in:
Gwenhael Le Moine 2024-09-08 15:52:56 +02:00
parent fb8a03725c
commit 29caa54a1b
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -5,35 +5,36 @@ CWD=$(pwd)
CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config} CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
DOTX48NG=${DOTX48NG:-$CONFIG_HOME/x48ng} DOTX48NG=${DOTX48NG:-$CONFIG_HOME/x48ng}
CONFIG_FILE="${DOTX48NG}"/config.lua CONFIG=${CONFIG:-config.lua}
ROM=${ROM:-./ROMs/gxrom-r} ROM=${ROM:-ROMs/gxrom-r}
RAM=${RAM:-ram}
STATE=${STATE:-state}
PORT1=${PORT1:-port1}
PORT2=${PORT2:-port2}
mkdir -p "${DOTX48NG}" mkdir -p "${DOTX48NG}"
[ -e "${CONFIG_FILE}" ] && mv "${CONFIG_FILE}" "${CONFIG_FILE}".orig
x48ng --print-config > "${CONFIG_FILE}"
cp -r "$CWD"/ROMs/ "${DOTX48NG}"/ cp -r "$CWD"/ROMs/ "${DOTX48NG}"/
cd "${DOTX48NG}"/ROMs/ || exit 1 cd "${DOTX48NG}" || exit 1
echo "The next step will download all available HP 48 ROMs from https://hpcalc.org where \"HP graciously began allowing this to be downloaded in mid-2000.\"" echo "The next step will download all available HP 48 ROMs from https://hpcalc.org where \"HP graciously began allowing this to be downloaded in mid-2000.\""
echo "You can hit Ctrl-C now if you do not wish to download them." echo "You can hit Ctrl-C now if you do not wish to download them."
read -r read -r
make get-roms make -C ROMs get-roms
cd "${DOTX48NG}" || exit 1
[ -e rom ] && mv rom rom.orig
ln -s "$ROM" rom
PORT1_SIZE=128 PORT1_SIZE=128
PORT2_SIZE=4096 PORT2_SIZE=4096
if echo "$ROM" | grep -q "sxrom"; then
if echo "$ROM" | grep -q "^sx"; then
PORT2_SIZE=128 PORT2_SIZE=128
fi fi
[ -e ram ] && mv ram ram.orig
[ -e state ] && mv state state.orig
[ -e port1 ] && mv port1 port1.orig [ -e port1 ] && mv port1 port1.orig
dd if=/dev/zero of="$DOTX48NG"/port1 bs=1k count=$PORT1_SIZE
[ -e port2 ] && mv port2 port2.orig [ -e port2 ] && mv port2 port2.orig
dd if=/dev/zero of="$DOTX48NG"/port2 bs=1k count=$PORT2_SIZE [ -e "${CONFIG}" ] && mv "${CONFIG}" "${CONFIG}".orig
dd if=/dev/zero of="$DOTX48NG"/"$PORT1" bs=1k count=$PORT1_SIZE
dd if=/dev/zero of="$DOTX48NG"/"$PORT2" bs=1k count=$PORT2_SIZE
x48ng --rom="$ROM" --ram="$RAM" --state="$STATE" --port1="$PORT1" --port2="$PORT2" --print-config > "${CONFIG}"