more polishing for release

This commit is contained in:
Penelope Gwen 2024-03-27 13:35:50 -06:00
parent 3ec54ba492
commit 252001a05d
10 changed files with 47 additions and 10 deletions

View file

@ -96,3 +96,7 @@ inex_rm(){
sed -i "${rmlines}" "${sapphrc_config}/backups/${profile_name}/${inex}" sed -i "${rmlines}" "${sapphrc_config}/backups/${profile_name}/${inex}"
echo "Removed ${#choices[@]} paths from ${profile_name} ${inex} list" echo "Removed ${#choices[@]} paths from ${profile_name} ${inex} list"
} }
validate_backupdir(){
[ -d "$HOME/.config/sapphrc/backups/.git" ] || echo "git repo not initialized! Something's gone wrong" && exit 1
}

View file

@ -19,6 +19,14 @@ restore() {
sapphrc_restore $@ sapphrc_restore $@
} }
updown() {
sapphrc_updown $@
}
push() {
sapphrc_push $@
}
usage() { usage() {
echo "Sapphic Package Manager v${VERSION}" echo "Sapphic Package Manager v${VERSION}"
cat ./usr/share/doc/sapphrc/sapphrc cat ./usr/share/doc/sapphrc/sapphrc
@ -29,7 +37,7 @@ usage() {
} }
case $COMMAND in case $COMMAND in
setup|profile|backup|restore ) setup|profile|backup|restore|updown|push )
shift 1;;& shift 1;;&
setup ) setup )
setup $@;; setup $@;;
@ -39,6 +47,10 @@ case $COMMAND in
backup $@;; backup $@;;
restore ) restore )
restore $@;; restore $@;;
updown )
updown $@;;
push )
push $@;;
*|usage ) *|usage )
usage;; usage;;
esac esac

View file

@ -1,5 +1,9 @@
#!/bin/bash #!/bin/bash
source ./lib/sapphrc/sapphrc-functions
source ./lib/sapphrc/sapphrc-font
validate_backupdir
sapphrc_config="$HOME/.config/sapphrc" sapphrc_config="$HOME/.config/sapphrc"
cat "${sapphrc_config}/active_profiles" | while read profile_name cat "${sapphrc_config}/active_profiles" | while read profile_name

View file

@ -4,6 +4,7 @@ COMMAND=$1
source ./lib/sapphrc/sapphrc-functions source ./lib/sapphrc/sapphrc-functions
source ./lib/sapphrc/sapphrc-font source ./lib/sapphrc/sapphrc-font
validate_backupdir
inex="exclude" inex="exclude"

View file

@ -4,6 +4,7 @@ COMMAND=$1
source ./lib/sapphrc/sapphrc-functions source ./lib/sapphrc/sapphrc-functions
source ./lib/sapphrc/sapphrc-font source ./lib/sapphrc/sapphrc-font
validate_backupdir
inex="include" inex="include"

View file

@ -2,6 +2,7 @@
source ./lib/sapphrc/sapphrc-functions source ./lib/sapphrc/sapphrc-functions
source ./lib/sapphrc/sapphrc-font source ./lib/sapphrc/sapphrc-font
validate_backupdir
COMMAND="${1}" COMMAND="${1}"

View file

@ -1,5 +1,9 @@
#!/bin/bash #!/bin/bash
source ./lib/sapphrc/sapphrc-functions
source ./lib/sapphrc/sapphrc-font
validate_backupdir
cd "$HOME/.config/sapphrc/backups" cd "$HOME/.config/sapphrc/backups"
git add .; git add .;
git add -u; git add -u;

View file

@ -1,5 +1,9 @@
#!/bin/bash #!/bin/bash
source ./lib/sapphrc/sapphrc-functions
source ./lib/sapphrc/sapphrc-font
validate_backupdir
cd "$HOME/.config/sapphrc/backups" cd "$HOME/.config/sapphrc/backups"
git pull --no-edit git pull --no-edit

View file

@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
sapphrc_config="$HOME/.config/sapphrc" sapphrc_config="$HOME/.config/sapphrc"
if [ -f "${aspphic_config}/.init_complete" ];then if [ -f "${aspphic_config}/.init_complete" ];then
echo "already setup" echo "already setup"
@ -11,7 +10,7 @@ mkdir -p "${sapphrc_config}"
mkdir -p "${HOME}/.sapphrc" mkdir -p "${HOME}/.sapphrc"
while true;do while true;do
read -p "use an existing git repo? (y/n)" gitrepo_exists read -p "pull from an existing backup repo? (y/n) " gitrepo_exists
case $gitrepo_exists in case $gitrepo_exists in
[Yy] ) [Yy] )
read -p "Enter YOUR git repo url: " git_url read -p "Enter YOUR git repo url: " git_url
@ -36,7 +35,8 @@ while true;do
mkdir -p "${sapphrc_config}/backups" mkdir -p "${sapphrc_config}/backups"
cd "${sapphrc_config}/backups" cd "${sapphrc_config}/backups"
git init git init
git add "${sapphrc_config}/backups/." touch ./active_profiles
git add .
git commit -m "first commit" git commit -m "first commit"
git branch -M main git branch -M main
read -p "Enter YOUR git repo url: " git_url read -p "Enter YOUR git repo url: " git_url
@ -57,8 +57,10 @@ if [[ "${#sapphrc_bashrc}" -eq 0 ]];then
echo "done" >> $HOME/.bashrc echo "done" >> $HOME/.bashrc
fi fi
if [ ! "$(crontab -l | grep -i 'sapphrc_updown')" ];then
mkdir -p $HOME/.cache/sapphrc/ mkdir -p $HOME/.cache/sapphrc/
crontab -l > $HOME/.cache/sapphrc/crontab crontab -l > $HOME/.cache/sapphrc/crontab
echo "*/15 * * * * sapphrc_updown" >> $HOME/.cache/sapphrc/crontab echo "*/15 * * * * sapphrc_updown" >> $HOME/.cache/sapphrc/crontab
crontab $HOME/.cache/sapphrc/crontab crontab $HOME/.cache/sapphrc/crontab
rm $HOME/.cache/sapphrc/crontab rm $HOME/.cache/sapphrc/crontab
fi

View file

@ -1,5 +1,9 @@
#!/bin/bash #!/bin/bash
source ./lib/sapphrc/sapphrc-functions
source ./lib/sapphrc/sapphrc-font
validate_backupdir
cd "$HOME/.config/sapphrc/backups" cd "$HOME/.config/sapphrc/backups"
sapphrc_backup sapphrc_backup
gs="$(git status | grep -i 'modified')" gs="$(git status | grep -i 'modified')"