add script for fetching updates
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# /home/krosh/Documents/Github/nixos-config/home-manager/modules/zsh/next_wallpaper.sh
|
# /home/krosh/Documents/Github/nixos-config/home-manager/modules/zsh/next_wallpaper.sh
|
||||||
# Pick next or random wallpaper from ~/Pictures/Wallpapers and update symlink ~/Pictures/wallpaper.png
|
# Pick next or random wallpaper from ~/Pictures/Wallpapers and update symlink ~/Pictures/wallpaper.png
|
||||||
# Then call: hyprctl hyprpaper reload ,"$WALLPAPER"
|
# Then call: swww img "$WALLPAPER"
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
REPO_DIR="$HOME/Documents/Github/nixos-config"
|
||||||
|
cd "$REPO_DIR" || { echo "Error: cannot change directory to $REPO_DIR" >&2; exit 1; }
|
||||||
|
|
||||||
|
echo "Fetching latest changes from git..."
|
||||||
|
if ! git fetch --all; then
|
||||||
|
echo "Error: git fetch failed" >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
LOCAL_HASH=$(git rev-parse @)
|
||||||
|
REMOTE_HASH=$(git rev-parse @{u})
|
||||||
|
|
||||||
|
if [ "$LOCAL_HASH" = "$REMOTE_HASH" ]; then
|
||||||
|
echo "The repository is already up to date."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Updates are available. Pulling latest changes..."
|
||||||
|
if ! git pull; then
|
||||||
|
echo "Error: git pull failed" >&2; exit 3
|
||||||
|
fi
|
||||||
|
echo "Repository updated successfully."
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod -R u+rwX "$REPO_DIR"
|
||||||
|
|
||||||
|
sudo ./update-nixos.sh
|
||||||
|
|
||||||
|
./update-home-manager.sh
|
||||||
|
|
||||||
|
echo "System update from git completed successfully."
|
||||||
|
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
(writeShellScriptBin "move_avatar" (builtins.readFile ./move_avatar.sh))
|
(writeShellScriptBin "move_avatar" (builtins.readFile ./move_avatar.sh))
|
||||||
(writeShellScriptBin "next_wallpaper"
|
(writeShellScriptBin "next_wallpaper"
|
||||||
(builtins.readFile ./next_wallpaper.sh))
|
(builtins.readFile ./next_wallpaper.sh))
|
||||||
|
(writeShellScriptBin "update_git_config" (builtins.readFile ./update_system_from_git.sh))
|
||||||
zsh-powerlevel10k
|
zsh-powerlevel10k
|
||||||
fzf
|
fzf
|
||||||
fd
|
fd
|
||||||
@@ -92,6 +93,7 @@
|
|||||||
''; # TODO: start system with serviceps://github.com/dylanaraps/pywal/wiki/Customization
|
''; # TODO: start system with serviceps://github.com/dylanaraps/pywal/wiki/Customization
|
||||||
cnfg = "cd nixos-config && code . && exit";
|
cnfg = "cd nixos-config && code . && exit";
|
||||||
x = "select_command";
|
x = "select_command";
|
||||||
|
u = "update_git_config";
|
||||||
|
|
||||||
mv_w = "move_wallpaper";
|
mv_w = "move_wallpaper";
|
||||||
next_w = "next_wallpaper";
|
next_w = "next_wallpaper";
|
||||||
|
|||||||
Reference in New Issue
Block a user