This commit is contained in:
Penelope Gwen 2024-05-30 23:08:22 -06:00
parent 3f5cd90b44
commit 52230660d6
2 changed files with 11 additions and 5 deletions

6
debian/changelog vendored
View file

@ -1,3 +1,9 @@
sapphrc (1.3.1) unstable; urgency=medium
* Fixed filelist logic
-- Penelope Gwen <support@pogmom.me> Thu, 30 May 2024 23:07:39 -0600
sapphrc (1.3.0) unstable; urgency=medium sapphrc (1.3.0) unstable; urgency=medium
* codebase overhaul * codebase overhaul

View file

@ -22,10 +22,10 @@ sapphrc_addfile(){
read -p "${bold}Add the listed files/directories to profile '${PROFILE_NAME}'?${normal} (Y/n)" yn read -p "${bold}Add the listed files/directories to profile '${PROFILE_NAME}'?${normal} (Y/n)" yn
if ! [[ "${yn}" =~ ^([nN][oO]|[nN])$ ]];then if ! [[ "${yn}" =~ ^([nN][oO]|[nN])$ ]];then
for e in ${filelist[@]};do for e in ${filelist[@]};do
if grep -q ^"${e}"$ "${sapphrc_config}/backups/${PROFILE_NAME}/${inex}";then if grep -q ^"${e}"$ "${sapphrc_config}/backups/${PROFILE_NAME}/${LIST}";then
echo "already in file" echo "already in file"
else else
echo $e|tee -a "${sapphrc_config}/backups/${PROFILE_NAME}/${inex}" >/dev/null echo $e|tee -a "${sapphrc_config}/backups/${PROFILE_NAME}/${LIST}" >/dev/null
fi fi
done done
fi fi
@ -37,7 +37,7 @@ sapphrc_rmfile(){
rmfiles+=("$i");i=$(($i+1)) rmfiles+=("$i");i=$(($i+1))
rmfiles+=("$line") rmfiles+=("$line")
rmfiles+=("$line") rmfiles+=("$line")
done < "${sapphrc_config}/backups/${PROFILE_NAME}/${inex}" done < "${sapphrc_config}/backups/${PROFILE_NAME}/${LIST}"
[ ${#rmfiles[@]} -eq 0 ] && echo "No files in list" && exit 1 [ ${#rmfiles[@]} -eq 0 ] && echo "No files in list" && exit 1
choices=($(dialog --checklist --output-fd 1 "Select options:" 0 0 0 "${rmfiles[@]}")) choices=($(dialog --checklist --output-fd 1 "Select options:" 0 0 0 "${rmfiles[@]}"))
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@ -48,8 +48,8 @@ sapphrc_rmfile(){
for choice in "${choices[@]}"; do for choice in "${choices[@]}"; do
rmlines="${rmlines}$((${choice}+1))d;" rmlines="${rmlines}$((${choice}+1))d;"
done done
sed -i "${rmlines}" "${sapphrc_config}/backups/${PROFILE_NAME}/${inex}" sed -i "${rmlines}" "${sapphrc_config}/backups/${PROFILE_NAME}/${LIST}"
echo "Removed ${#choices[@]} paths from ${PROFILE_NAME} ${inex} list" echo "Removed ${#choices[@]} paths from ${PROFILE_NAME} ${LIST} list"
} }
sapphrc_filelists(){ sapphrc_filelists(){