testing appears ready for initial release

This commit is contained in:
Penelope Gwen 2024-03-27 15:17:38 -06:00
parent 252001a05d
commit c4f13c800c
10 changed files with 52 additions and 31 deletions

View file

@ -3,7 +3,7 @@
sapphrc_config="$HOME/.config/sapphrc"
usage(){
echo -n "spm "
echo -n "sapphrc "
cat /usr/share/doc/sapphrc/$(basename $0)
}
@ -98,5 +98,10 @@ inex_rm(){
}
validate_backupdir(){
[ -d "$HOME/.config/sapphrc/backups/.git" ] || echo "git repo not initialized! Something's gone wrong" && exit 1
if [ -d "$HOME/.config/sapphrc/backups/.git" ];then
echo "backup folder looks good!"
else
echo "git repo not initialized! Something's gone wrong"
exit 1
fi
}

View file

@ -27,9 +27,17 @@ push() {
sapphrc_push $@
}
include(){
sapphrc_include $@
}
exclude(){
sapphrc_exclude $@
}
usage() {
echo "Sapphic Package Manager v${VERSION}"
cat ./usr/share/doc/sapphrc/sapphrc
cat /usr/share/doc/sapphrc/sapphrc
sed -e 's/^/ /' /usr/share/doc/sapphrc/sapphrc_setup
sed -e 's/^/ /' /usr/share/doc/sapphrc/sapphrc_profile
sed -e 's/^/ /' /usr/share/doc/sapphrc/sapphrc_backup
@ -37,7 +45,7 @@ usage() {
}
case $COMMAND in
setup|profile|backup|restore|updown|push )
setup|profile|backup|restore|updown|push|include|exclude )
shift 1;;&
setup )
setup $@;;
@ -51,6 +59,10 @@ case $COMMAND in
updown $@;;
push )
push $@;;
include )
include $@;;
exclude )
exclude $@;;
*|usage )
usage;;
esac

View file

@ -1,7 +1,7 @@
#!/bin/bash
source ./lib/sapphrc/sapphrc-functions
source ./lib/sapphrc/sapphrc-font
source /lib/sapphrc/sapphrc-functions
source /lib/sapphrc/sapphrc-font
validate_backupdir
sapphrc_config="$HOME/.config/sapphrc"
@ -11,5 +11,9 @@ do
backup_homedir="$sapphrc_config/backups/${profile_name}/home"
include_list="$sapphrc_config/backups/${profile_name}/include"
exclude_list="$sapphrc_config/backups/${profile_name}/exclude"
rsync -avSH --files-from="${include_list}" --exclude-from="${exclude_list}" --exclude '.config/sapphrc/' "${HOME}" "${backup_homedir}"
echo "${include_list}"
echo "${exclude_list}"
echo "${HOME}"
echo "${backup_homedir}"
rsync -arvSH --files-from="${include_list}" --exclude-from="${exclude_list}" --exclude '.config/sapphrc/' "${HOME}" "${backup_homedir}"
done

View file

@ -2,9 +2,8 @@
COMMAND=$1
source ./lib/sapphrc/sapphrc-functions
source ./lib/sapphrc/sapphrc-font
validate_backupdir
source /lib/sapphrc/sapphrc-functions
source /lib/sapphrc/sapphrc-font
inex="exclude"
@ -27,6 +26,8 @@ while getopts 'hp:' flag; do
esac
done
validate_backupdir
case "${action}" in
add )
inex_func "$@";;

View file

@ -2,9 +2,8 @@
COMMAND=$1
source ./lib/sapphrc/sapphrc-functions
source ./lib/sapphrc/sapphrc-font
validate_backupdir
source /lib/sapphrc/sapphrc-functions
source /lib/sapphrc/sapphrc-font
inex="include"
@ -27,6 +26,8 @@ while getopts 'hp:' flag; do
esac
done
validate_backupdir
case "${action}" in
add )
inex_func "$@";;

View file

@ -1,8 +1,7 @@
#!/bin/bash
source ./lib/sapphrc/sapphrc-functions
source ./lib/sapphrc/sapphrc-font
validate_backupdir
source /lib/sapphrc/sapphrc-functions
source /lib/sapphrc/sapphrc-font
COMMAND="${1}"
@ -58,7 +57,7 @@ list(){
case $COMMAND in
create|remove|join|leave )
shift 1;
validate_backupdir;shift 1;
validate_profile $@;;&
create )
create $@;;

View file

@ -1,7 +1,7 @@
#!/bin/bash
source ./lib/sapphrc/sapphrc-functions
source ./lib/sapphrc/sapphrc-font
source /lib/sapphrc/sapphrc-functions
source /lib/sapphrc/sapphrc-font
validate_backupdir
cd "$HOME/.config/sapphrc/backups"

View file

@ -1,7 +1,7 @@
#!/bin/bash
source ./lib/sapphrc/sapphrc-functions
source ./lib/sapphrc/sapphrc-font
source /lib/sapphrc/sapphrc-functions
source /lib/sapphrc/sapphrc-font
validate_backupdir
cd "$HOME/.config/sapphrc/backups"
@ -14,5 +14,5 @@ do
backup_homedir="$sapphrc_config/backups/${profile_name}/home"
include_list="$sapphrc_config/backups/${profile_name}/include"
exclude_list="$sapphrc_config/backups/${profile_name}/exclude"
rsync -avSH --files-from="${include_list}" --exclude-from="${exclude_list}" --exclude '.config/sapphrc/' "${backup_homedir}" "${HOME}"
rsync -arvSH --files-from="${include_list}" --exclude-from="${exclude_list}" --exclude '.config/sapphrc/' "${backup_homedir}" "${HOME}"
done

View file

@ -1,7 +1,7 @@
#!/bin/bash
sapphrc_config="$HOME/.config/sapphrc"
if [ -f "${aspphic_config}/.init_complete" ];then
if [ -f "${aspphic_config}/backups/.init_complete" ];then
echo "already setup"
exit 0
fi
@ -14,12 +14,11 @@ while true;do
case $gitrepo_exists in
[Yy] )
read -p "Enter YOUR git repo url: " git_url
git clone "${git_url}" "${sapphic_config}/backups"
touch "${aspphic_config}/.init_complete"
git clone "${git_url}" "${sapphrc_config}/backups"
touch "${sapphrc_config}/backups/.init_complete"
backup_count="0"
backups=($(ls "${sapphrc_config}/backups/"))
for b in ${backups[@]};do
echo $b
[ -d "${sapphrc_config}/backups/${b}" ] && backup_count=$(($backup_count+1))
done
@ -35,7 +34,7 @@ while true;do
mkdir -p "${sapphrc_config}/backups"
cd "${sapphrc_config}/backups"
git init
touch ./active_profiles
touch "${sapphrc_config}/backups/.init_complete"
git add .
git commit -m "first commit"
git branch -M main
@ -51,8 +50,8 @@ done
sapphrc_bashrc="$(awk '/.sapphrc/,/done/' ~/.bashrc)"
if [[ "${#sapphrc_bashrc}" -eq 0 ]];then
echo "for file in ~/.sapphrc/* ; do" >> $HOME/.bashrc
echo " if [ -f \"$file\" ] ; then" >> $HOME/.bashrc
echo " source \"$file\"" >> $HOME/.bashrc
echo " if [ -f \""'$file'"\" ] ; then" >> $HOME/.bashrc
echo " source \""'$file'"\"" >> $HOME/.bashrc
echo " fi" >> $HOME/.bashrc
echo "done" >> $HOME/.bashrc
fi

View file

@ -1,7 +1,7 @@
#!/bin/bash
source ./lib/sapphrc/sapphrc-functions
source ./lib/sapphrc/sapphrc-font
source /lib/sapphrc/sapphrc-functions
source /lib/sapphrc/sapphrc-font
validate_backupdir
cd "$HOME/.config/sapphrc/backups"