first commit

This commit is contained in:
Chris
2025-03-12 14:22:16 -04:00
commit 0ad0c01249
1999 changed files with 189708 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
#!/bin/sh
set -e
CLIARGUMENTS_FILE=""
EXECUTABLESOURCEDIR=""
EXECUTABLETARGETDIR=""
TITLE=""
METHODPATCHDIR=""
PIDFILE=""
while [ "$1" != "" ]; do
case $1 in
-c | --cli-arguments-file )
shift
CLIARGUMENTS_FILE="$1"
;;
--executables-source-dir )
shift
EXECUTABLESOURCEDIR="$1"
;;
--executable-taget-dir )
shift
EXECUTABLETARGETDIR="$1"
;;
--title )
shift
TITLE="$1"
;;
--create-no-window )
shift
CREATENOWINDOW="$1"
;;
-p | --pidfile )
shift
PIDFILE="$1"
;;
-m | --method-patch-dir )
shift
METHODPATCHDIR="$1"
;;
esac
shift
done
if [ -z "/tmp/HotReloadTemp" ] || [ -z "$CLIARGUMENTS_FILE" ] || [ -z "$EXECUTABLESOURCEDIR" ] || [ -z "$EXECUTABLETARGETDIR" ] || [ -z "$TITLE" ] || [ -z "$PIDFILE" ] || [ -z "$METHODPATCHDIR" ] || [ -z "$CREATENOWINDOW" ]; then
echo "Missing arguments"
exit 1
fi
CLIARGUMENTS=$(cat "$CLIARGUMENTS_FILE")
rm "$CLIARGUMENTS_FILE"
# Needs be removed if you have multiple unities
pgrep CodePatcherCLI | xargs -I {} kill {}
rm -rf "$METHODPATCHDIR"
SERVER="$EXECUTABLETARGETDIR/CodePatcherCLI"
TERMINALRUNSCRIPT="$EXECUTABLESOURCEDIR/terminal-run.sh"
sed -i 's/\r//g' "$TERMINALRUNSCRIPT"
chmod +x "$TERMINALRUNSCRIPT"
chmod +x "$SERVER"
HAVETERMINAL=""
"$TERMINALRUNSCRIPT" && HAVETERMINAL="yes"
INTERNALSCRIPT="$EXECUTABLETARGETDIR/hotreload-internal-start"
# see doc/linux-system-freeze.org why I put the nice
cat << EOF > "$INTERNALSCRIPT"
#!/bin/sh
echo \$\$ > "$PIDFILE"
nice -n 5 "$SERVER" $CLIARGUMENTS || read
EOF
chmod +x "$INTERNALSCRIPT"
if [[ -n "$HAVETERMINAL" && "$CREATENOWINDOW" != "True" ]]; then
"$TERMINALRUNSCRIPT" "$TITLE" "$INTERNALSCRIPT"
else
printf "Don't have a terminal to run, printing to unity console instead. Consider hacking:\n%s\n" "$TERMINALRUNSCRIPT"
exec "$INTERNALSCRIPT"
fi

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 69a1a07fd70ddb97f9c75ee89579d1ea
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,39 @@
#!/bin/bash
# Run a terminal with title and command
# User can already hack this file with their own terminal etc.
# I didn't check the other ones
# TODO: User can provide a "terminal-program" in the settings, say you can get inspired by Packages/CodePatcher/Server/linux-x64/terminal-run.sh
# the script is run with 2 args, a title and a command script to run.
# If called with 0 args, signal the capability to start a terminal.
# If you add your own terminal, make sure to also return 0 when called with 0 args.
TITLE="$1"
COMMAND="$2"
if [ -z "$1" ]; then
[ -x "$(command -v gnome-terminal)" ] && exit 0
[ -x "$(command -v xterm)" ] && exit 0
[ -x "$(command -v konsole)" ] && exit 0
[ -x "$(command -v terminator)" ] && exit 0
[ -x "$(command -v urxvt)" ] && exit 0
[ -x "$(command -v Alacritty)" ] && exit 0
exit 1
fi
if [ -x "$(command -v gnome-terminal)" ]; then
gnome-terminal --title="$TITLE" -- "$SHELL" -c "$COMMAND"
elif [ -x "$(command -v xterm)" ]; then
xterm -title "$TITLE" -e "$SHELL -c '$COMMAND'"
elif [ -x "$(command -v konsole)" ]; then
konsole --title "$TITLE" --noclose -e "$SHELL -c '$COMMAND'"
elif [ -x "$(command -v terminator)" ]; then
terminator --title="$TITLE" --command="$SHELL -c '$COMMAND'"
elif [ -x "$(command -v urxvt)" ]; then
urxvt -title "$TITLE" -e "$SHELL" -c "clear && $COMMAND"
elif [ -x "$(command -v Alacritty)" ]; then
alacritty -t "$TITLE" -e "$SHELL -c '$COMMAND'"
fi

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c3a7f96ba696eb649b581af931f26247
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: