-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinstall_ux.sh
More file actions
executable file
·87 lines (64 loc) · 2.2 KB
/
install_ux.sh
File metadata and controls
executable file
·87 lines (64 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh
# 7800basic Unix installer (WASM edition)
# Pick a sensible default shell profile
PROFILE="$HOME/.profile"
for PRO in "$HOME/.bashrc" "$HOME/.bash_profile" "$HOME/.bash_login" "$HOME/.zshrc"; do
[ -r "$PRO" ] && PROFILE="$PRO"
done
bas7800dir=$PWD
if [ ! -r "$bas7800dir/7800basic.sh" ]; then
base7800dir=$(dirname "$0")
if [ ! "$base7800dir" ] || [ "$base7800dir" = "." ]; then
echo
echo "Error: Couldn't determine the 7800basic directory."
echo "Please cd into the 7800basic directory and run:"
echo " ./install_ux.sh"
echo
exit 1
fi
fi
# --- Check for wasmtime ---
if ! command -v wasmtime >/dev/null 2>&1; then
cat <<EOF
### ERROR: wasmtime is not installed or not in PATH.
You can install it using:
- macOS/Linux: curl https://wasmtime.dev/install.sh -sSf | bash
- Or download directly: https://wasmtime.dev/
EOF
exit 1
fi
cat <<EOF
__________________________The_7800basic_Unix_Installer_v2__________________________
This script will update your $PROFILE file to
set the following variables each time you open a terminal window:
export bas7800dir="$bas7800dir"
export PATH=\$PATH:\$bas7800dir
You may run this script as many times as you like, and should do so if you're
installing a new version of 7800basic, or if you relocate this basic directory.
Hit [ENTER] to begin, or type Q and [ENTER] to quit.
EOF
read ANSWER
[ "$ANSWER" ] && exit 1
# ensure the profile exists
[ -r "$PROFILE" ] || touch "$PROFILE"
# backup
cp "$PROFILE" "$PROFILE.$(date +%y%m%d%H%M%S)"
# remove old entries
grep -v bas7800dir "$PROFILE" > "$PROFILE.new"
# add new entries
{
echo "##### 7800basic/bas7800dir variables, added by installer on $(date +%y/%m/%d)"
echo "export bas7800dir=\"$bas7800dir\""
echo 'export PATH=$PATH:$bas7800dir'
} >> "$PROFILE.new"
# replace profile
cat "$PROFILE.new" > "$PROFILE" && rm "$PROFILE.new"
cat <<EOF
$PROFILE has been updated successfully.
To test the new setup:
1. Open another terminal window (so the updated profile is loaded).
2. Run: cd "$bas7800dir/samples/simple"
3. Run: 7800basic.sh simple.bas
If everything worked, you'll get simple.bas.bin and simple.bas.a78 in that
directory, ready for real hardware or emulation.
EOF