Skip to content

Commit

Permalink
feat: Add iOS, macOS, and BSD native support
Browse files Browse the repository at this point in the history
  • Loading branch information
brian6932 committed Feb 1, 2025
1 parent 159e7c6 commit 0c8bc90
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions apt-fast
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ VERBOSE_OUTPUT=
# Download command.
_DOWNLOADER='aria2c --no-conf -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} -s ${_SPLITCON} -i ${DLLIST} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} --connect-timeout=600 --timeout=600 -m0 --header "Accept: */*"'

KERNEL=$(uname)

# Load config file.
for Prefix in /usr/local/etc /etc; do
CONFFILE=${Prefix}/apt-fast.conf
Expand Down Expand Up @@ -238,7 +240,12 @@ fi
_create_lock()
{
eval "exec $LCK_FD>\"$LCK_FILE.lock\""
flock -n $LCK_FD || { msg_already_running; exit 1; }

if [ $KERNEL = 'Linux' ]; then
flock -n $LCK_FD
else
chflags -v uchg,schg "$LCK_FILE.lock"
fi || { msg_already_running; exit 1; }

trap "cleanup_aptfast; exit_cleanup_state" EXIT
trap "cleanup_aptfast; exit 1" INT TERM
Expand All @@ -247,7 +254,11 @@ _create_lock()
# unlock and remove the lock file
_remove_lock()
{
flock -u "$LCK_FD" 2>/dev/null
if [ $KERNEL = 'Linux' ]; then
flock -u "$LCK_FD" 2>/dev/null
else
chflags nouchg,noschg "$LCK_FILE.lock"
fi
rm -f "$LCK_FILE.lock"
}

Expand Down

0 comments on commit 0c8bc90

Please sign in to comment.