mirror of
https://github.com/DictXiong/dotfiles.git
synced 2025-04-24 21:46:52 +08:00
bug fix
This commit is contained in:
parent
3a368c07cd
commit
2a9efc8baa
|
@ -5,7 +5,7 @@ export DOTFILES=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||||
dfs_commit=$(curl -fsSL https://api.beardic.cn/get-var/dfs-commit-id)
|
dfs_commit=$(curl -fsSL https://api.beardic.cn/get-var/dfs-commit-id)
|
||||||
if [[ ${#dfs_commit} != 40 ]]; then
|
if [[ ${#dfs_commit} != 40 ]]; then
|
||||||
echo "Error: invalid commit id."
|
echo "Error: invalid commit id."
|
||||||
python3 "${DOTFILES}/post-log.py" "[ERROR] update.sh: invalid commit id: ${dfs_commit}"
|
python3 "${DOTFILES}/tools/post-log.py" "[ERROR] update.sh: invalid commit id: ${dfs_commit}"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
# fetch origin
|
# fetch origin
|
||||||
|
@ -13,17 +13,17 @@ cd $DOTFILES
|
||||||
git fetch
|
git fetch
|
||||||
if [[ -n "$(git status -s)" ]]; then
|
if [[ -n "$(git status -s)" ]]; then
|
||||||
echo "Error: directory not clean."
|
echo "Error: directory not clean."
|
||||||
python3 "${DOTFILES}/post-log.py" "[ERROR] update.sh: directory not clean"
|
python3 "${DOTFILES}/tools/post-log.py" "[ERROR] update.sh: directory not clean"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
# update
|
# update
|
||||||
if [[ "$(git rev-parse HEAD)" == "$dfs_commit" ]]; then
|
if [[ "$(git rev-parse HEAD)" == "$dfs_commit" ]]; then
|
||||||
echo "Nothing to do."
|
echo "Nothing to do."
|
||||||
python3 "${DOTFILES}/post-log.py" "[INFO] update.sh: Nothing to do"
|
python3 "${DOTFILES}/tools/post-log.py" "[INFO] update.sh: Nothing to do"
|
||||||
else
|
else
|
||||||
echo "Checking out to commit $dfs_commit ..."
|
echo "Checking out to commit $dfs_commit ..."
|
||||||
git -c advice.detachedHead=false checkout $dfs_commit
|
git -c advice.detachedHead=false checkout $dfs_commit
|
||||||
cp ./.update.sh ./update.sh
|
cp ./.update.sh ./update.sh
|
||||||
chmod +x ./update.sh
|
chmod +x ./update.sh
|
||||||
python3 "${DOTFILES}/post-log.py" "[INFO] update.sh: Checked out to commit $dfs_commit"
|
python3 "${DOTFILES}/tools/post-log.py" "[INFO] update.sh: Checked out to commit $dfs_commit"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user