Update 1 file: bootstrap.sh
This commit is contained in:
+6
-6
@@ -8,12 +8,12 @@ warn() { printf "\033[1;33m%s\033[0m\n" "$*"; }
|
|||||||
error() { printf "\033[1;31m%s\033[0m\n" "$*"; }
|
error() { printf "\033[1;31m%s\033[0m\n" "$*"; }
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
dotstate activate || true
|
dotstate activate &>/dev/null || true
|
||||||
|
|
||||||
sed -i.bak 's/^repo_mode\s*=\s*".*"/repo_mode = "Local"/' ~/.config/dotstate/config.toml || echo 'repo_mode = "Local"' >> ~/.config/dotstate/config.toml
|
sed -i.bak 's/^repo_mode\s*=\s*".*"/repo_mode = "Local"/' ~/.config/dotstate/config.toml &>/dev/null || echo 'repo_mode = "Local"' >> ~/.config/dotstate/config.toml &>/dev/null
|
||||||
|
|
||||||
dotstate doctor --fix || true
|
dotstate doctor --fix &>/dev/null || true
|
||||||
dotstate activate || true
|
dotstate activate &>/dev/null || true
|
||||||
|
|
||||||
info "done"
|
info "done"
|
||||||
}
|
}
|
||||||
@@ -151,12 +151,12 @@ TARGET_DIR="$HOME/.config/dotstate/storage"
|
|||||||
|
|
||||||
if [[ -d "$TARGET_DIR/.git" ]]; then
|
if [[ -d "$TARGET_DIR/.git" ]]; then
|
||||||
# Case 1: It is already a git repo -> Pull updates
|
# Case 1: It is already a git repo -> Pull updates
|
||||||
echo "Repository exists. Pulling updates..."
|
info "Repository exists. Pulling updates..."
|
||||||
git -C "$TARGET_DIR" pull &>/dev/null
|
git -C "$TARGET_DIR" pull &>/dev/null
|
||||||
else
|
else
|
||||||
# Case 2: Not a repo (or doesn't exist) -> Clone fresh
|
# Case 2: Not a repo (or doesn't exist) -> Clone fresh
|
||||||
# Note: git clone will fail if TARGET_DIR exists as a non-empty non-git dir
|
# Note: git clone will fail if TARGET_DIR exists as a non-empty non-git dir
|
||||||
echo "Repository not found. Cloning..."
|
info "Repository not found. Cloning..."
|
||||||
git clone --depth=1 "$REPO_URL" "$TARGET_DIR" &>/dev/null
|
git clone --depth=1 "$REPO_URL" "$TARGET_DIR" &>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user