-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
47 lines (35 loc) · 1.24 KB
/
update.sh
File metadata and controls
47 lines (35 loc) · 1.24 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
#!/bin/bash
SHORTCUT="$HOME/.bin/mechm-update"
# Ensure git is installed
if ! command -v git &> /dev/null; then
echo -e "${RED}Error: git is not installed.${NC}"
exit 1
fi
# Shortcut creation (First thing done)
create_shortcut() {
if [ ! -f "$SHORTCUT" ]; then
mkdir -p "$HOME/.bin"
touch "$HOME/.bashrc"
echo "Creating global shortcut 'mechm-t-git' in $HOME/.bin..."
echo "#!/bin/bash" > "$SHORTCUT"
echo "bash $(realpath "$0")" >> "$SHORTCUT"
chmod +x "$SHORTCUT"
echo -e "${GREEN}Shortcut created. You can now run the script using 'mechm-t-git' from anywhere.${NC}"
# Ensure ~/.bin is in PATH
if ! grep -q 'export PATH="$HOME/.bin:$PATH"' "$HOME/.bashrc"; then
echo 'export PATH="$HOME/.bin:$PATH"' >> "$HOME/.bashrc"
fi
if ! grep -q 'export PATH="$HOME/.bin:$PATH"' "$HOME/.zshrc"; then
echo 'export PATH="$HOME/.bin:$PATH"' >> "$HOME/.zshrc"
fi
export PATH="$HOME/.bin:$PATH"
echo -e "${GREEN}Added '$HOME/.bin' to PATH. Restart Termux or run 'source ~/.bashrc' or 'source ~/.zshrc' to apply changes.${NC}"
fi
}
create_shortcut
cd $HOME/mechamancer
git fetch --all
git reset --hard origin/main
chmod +x update.sh
chmod +x install.sh
./install.sh