Devboot update: 23-10-06-22-33-51
This commit is contained in:
61
runBackup.sh
61
runBackup.sh
@@ -1,11 +1,54 @@
|
||||
mkdir --parents dot-conf
|
||||
mkdir --parents dot-conf/.config/lvim dot-conf/.tmuxifier/layouts
|
||||
#!/bin/bash
|
||||
|
||||
cp ${HOME}/.zshrc ./dot-conf/
|
||||
cp ${HOME}/.tmux.conf ./dot-conf/
|
||||
cp --recursive ${HOME}/.config/lvim/ ./dot-conf/.config
|
||||
cp --recursive ${HOME}/.tmuxifier/layouts/ ./dot-conf/.tmuxifier/layouts/
|
||||
only_backup=false
|
||||
only_commit=false
|
||||
|
||||
fulltime=$(date +%y-%m-%d-%H-%M-%S)
|
||||
git add .
|
||||
git commit -m "Devboot update: ${fulltime}"
|
||||
show_help() {
|
||||
echo "Usage: $0 [--help|-h show help] [--only-commit]"
|
||||
echo "Options:"
|
||||
echo " --only-commit Makes the script only create a commit"
|
||||
echo " --help|h Display this message"
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--help|-h)
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
--only-backup)
|
||||
only_backup=true
|
||||
shift
|
||||
;;
|
||||
--only-commit)
|
||||
only_commit=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown option '$1'"
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$only_backup" = true ] && [ "$only_commit" = true ]; then
|
||||
echo "Error: Cannot use both --only-backup and --only-commit together."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$only_commit" = false ]; then
|
||||
mkdir --parents dot-conf
|
||||
mkdir --parents dot-conf/.config/lvim dot-conf/.tmuxifier/layouts
|
||||
|
||||
cp ${HOME}/.zshrc ./dot-conf/
|
||||
cp ${HOME}/.tmux.conf ./dot-conf/
|
||||
cp --recursive ${HOME}/.config/lvim/ ./dot-conf/.config
|
||||
cp --recursive ${HOME}/.tmuxifier/layouts/ ./dot-conf/.tmuxifier/layouts/
|
||||
fi
|
||||
|
||||
if [ "$only_backup" = false ]; then
|
||||
fulltime=$(date +%y-%m-%d-%H-%M-%S)
|
||||
git add .
|
||||
git commit -m "Devboot update: ${fulltime}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user