Compare commits
2 Commits
3848e880ed
...
68c03ab186
| Author | SHA1 | Date | |
|---|---|---|---|
| 68c03ab186 | |||
| 9587308d84 |
29
installJRMC
29
installJRMC
@@ -1680,11 +1680,11 @@ uninstall() {
|
|||||||
if [[ -d $HOME/.jriver ]]; then
|
if [[ -d $HOME/.jriver ]]; then
|
||||||
if ask_ok "Backup and reset your MC library?"; then
|
if ask_ok "Backup and reset your MC library?"; then
|
||||||
execute mv "$HOME/.jriver" "$HOME/.jriver.bk"
|
execute mv "$HOME/.jriver" "$HOME/.jriver.bk"
|
||||||
echo "Your MC library has been backed up to $HOME/.jriver.bk and reset"
|
echo "Your MC library has been reset and backed up to $HOME/.jriver.bk"
|
||||||
echo "To restore your MC library backup: mv $HOME/.jriver.bk $HOME/.jriver"
|
echo "To restore your MC library: mv $HOME/.jriver.bk $HOME/.jriver"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
echo "To backup and reset your MC library: mv $HOME/.jriver $HOME/.jriver.bk"
|
echo "To reset and backup your MC library: mv $HOME/.jriver $HOME/.jriver.bk"
|
||||||
echo "To remove your MC library: rm -rf $HOME/.jriver"
|
echo "To remove your MC library: rm -rf $HOME/.jriver"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -1715,28 +1715,25 @@ update() {
|
|||||||
[[ "$(git -C "$SCRIPT_DIR" config --get remote.origin.url)" =~ installJRMC|installjrmc ]]; then
|
[[ "$(git -C "$SCRIPT_DIR" config --get remote.origin.url)" =~ installJRMC|installjrmc ]]; then
|
||||||
|
|
||||||
# Get the current commit hash
|
# Get the current commit hash
|
||||||
local before_pull_hash after_pull_hash
|
local before_pull_hash
|
||||||
before_pull_hash=$(git -C "$SCRIPT_DIR" rev-parse HEAD)
|
before_pull_hash=$(git -C "$SCRIPT_DIR" rev-parse HEAD)
|
||||||
|
|
||||||
# Stash local changes before pull
|
# Stash local changes before pull
|
||||||
execute git -C "$SCRIPT_DIR" stash push --quiet
|
execute git -C "$SCRIPT_DIR" stash push --quiet
|
||||||
|
|
||||||
# Pull latest changes
|
# Pull latest changes
|
||||||
debug "Running git pull in $SCRIPT_DIR"
|
execute git -C "$SCRIPT_DIR" pull --quiet
|
||||||
if ! git -C "$SCRIPT_DIR" pull | grep -q "Already up to date"; then
|
|
||||||
# Get the new commit hash after pull
|
|
||||||
after_pull_hash=$(git -C "$SCRIPT_DIR" rev-parse HEAD)
|
|
||||||
|
|
||||||
# If the commit hash has changed, an update occurred
|
# Restore local changes
|
||||||
if [[ "$before_pull_hash" != "$after_pull_hash" ]]; then
|
|
||||||
echo "Detected installJRMC update, restarting"
|
|
||||||
execute git -C "$SCRIPT_DIR" stash pop --quiet
|
|
||||||
exec "$SCRIPT_PATH" "$@" "--no-update"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
execute git -C "$SCRIPT_DIR" stash pop --quiet
|
execute git -C "$SCRIPT_DIR" stash pop --quiet
|
||||||
|
|
||||||
|
# If the commit hash has changed, an update occurred
|
||||||
|
if [[ "$before_pull_hash" != $(git -C "$SCRIPT_DIR" rev-parse HEAD) ]]; then
|
||||||
|
echo "Detected installJRMC update, restarting"
|
||||||
|
exec "$SCRIPT_PATH" "$@" "--no-update"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
debug "Not in a git repository or not the installJRMC repository. Checking for updates via download."
|
debug "Not in the installJRMC repository, checking for installJRMC update via webscrape."
|
||||||
|
|
||||||
local tmp
|
local tmp
|
||||||
tmp=$(mktemp) || { err "Failed to create temporary file."; return 1; }
|
tmp=$(mktemp) || { err "Failed to create temporary file."; return 1; }
|
||||||
|
|||||||
Reference in New Issue
Block a user