-
Notifications
You must be signed in to change notification settings - Fork 2
/
install-msys2.sh
54 lines (48 loc) · 2.04 KB
/
install-msys2.sh
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
#!/usr/bin/env bash
OS=`uname | grep -Eo '^[A-Za-z]+'`
BASEURL="https://github.com/mittelmark/microemacs/releases/download/v09.12.24.beta3/"
KERNEL=`uname -r | grep -Eo '^[0-9]+'`
MECB="windows-microemacs-091224b3-mecb"
MEWB="windows-microemacs-091224b3-mewb"
function install-me {
if [[ ! -f ~/.local/bin/mecb ]]; then
if [ ! -d ~/.local/bin ]; then
mkdir -p ~/.local/bin
fi
# Check if ~/bin is already in the PATH
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
# If it's not in the PATH, add it to ~/.bashrc
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
# Update the PATH for the current session
export PATH="$HOME/.local/bin:$PATH"
echo "To update the current Bash session with the new PATH variable use: 'source ~/.bashrc'"
fi
# Download the dummy.sh script from the internet
URL=${BASEURL}${MECB}
if [[ ! -f "/tmp/${MECB}.zip" ]]; then
curl -fsSL "${URL}.zip" -o /tmp/${MECB}.zip
fi
unzip -p "/tmp/${MECB}.zip" $MECB/bin/mecb.exe > ~/.local/bin/mecb.exe
URL=${BASEURL}${MEWB}
if [[ ! -f "/tmp/${MEWB}.zip" ]]; then
curl -fsSL "${URL}.zip" -o /tmp/${MEWB}.zip
fi
unzip -p "/tmp/${MEWB}.zip" $MEWB/bin/mewb.exe > ~/.local/bin/mewb.exe
# Make the script executable
if [[ ! -f ~/.local/bin/me ]]; then
curl -fsSL https://raw.githubusercontent.com/mittelmark/microemacs/refs/heads/master/install-msys2.sh -o ~/.local/bin/me
fi
echo "Installation complete."
fi
}
#/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/mittelmark/microemacs/refs/heads/master/install-linux.sh)"
install-me
if [[ $1 == "-w" ]]; then
shift
cmd //c "`cygpath -wa ~/.local/bin/mewb.exe | sed -E 's/ /\\ /'`" "$@"
elif [[ $1 == "-n" ]]; then
shift
cmd //c "`cygpath -wa ~/.local/bin/mecb.exe | sed -E 's/ /\\ /'`" "$@"
else
cmd //c "`cygpath -wa ~/.local/bin/mecb.exe | sed -E 's/ /\\ /'`" "$@"
fi