Skip to content

Commit

Permalink
unlink isn't supported on all platforms, so standardize on rm instead…
Browse files Browse the repository at this point in the history
…. Issue graysky2#344
  • Loading branch information
morgant committed Jan 1, 2023
1 parent 0b81842 commit 0184623
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions common/profile-sync-daemon.in
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ ungraceful_state_check() {
exit 1
else
echo "Ungraceful state detected for $DIR so fixing"
unlink "$DIR"
rm "${DIR%/}"
# refuse to start browser while recovery
ln -s /dev/null "$DIR"
fi
Expand Down Expand Up @@ -317,7 +317,7 @@ ungraceful_state_check() {
cp -a --reflink=auto "$TARGETTOKEEP" "$BACKUP-crashrecovery-$NOW"
fi

unlink "$DIR"
rm "${DIR%/}"
mv --no-target-directory "$TARGETTOKEEP" "$DIR"
rm -rf "$BACKUP"
else
Expand All @@ -327,7 +327,7 @@ ungraceful_state_check() {

if [[ $CRRE -eq 1 ]]; then
cp -a --reflink=auto "$BACKUP" "$BACKUP-crashrecovery-$NOW"
unlink "$DIR"
rm "${DIR%/}"
mv --no-target-directory "$BACKUP" "$DIR"
fi
fi
Expand Down Expand Up @@ -518,7 +518,7 @@ do_sync_for() {
fi

# now browser can start
[[ $(readlink "$DIR") = "/dev/null" ]] && unlink "$DIR"
[[ $(readlink "$DIR") = "/dev/null" ]] && rm "${DIR%/}"
ln -s "$TMP" "$DIR"
chown -h "$user":"$group" "$DIR"
touch "$DIR/.flagged"
Expand Down Expand Up @@ -599,7 +599,7 @@ do_unsync() {
WORK="$VOLATILE/.$user-$browser${suffix}"
# check if user has browser profile
if [[ -h "$DIR" ]]; then
unlink "$DIR"
rm "${DIR%/}"
# this assumes that the backup is always updated so
# be sure to invoke a sync before an unsync
#
Expand Down

0 comments on commit 0184623

Please sign in to comment.