Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FreeBSD compatibility and FreeBSD services support #18

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Limych
Copy link

@Limych Limych commented Feb 14, 2021

No description provided.

@AndrewMarchukov
Copy link
Owner

nice work
i have some doubts about how it can work now on non FreeBSD systems, needs checks

echo "URL for ${base_url}"
echo "Adding trackers for $torrent_name..."
for tracker in $(cat $trackerslist) ; do
echo -n "${tracker}..."
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echo -n doesn't work on bin/sh, maybe printf '%s\n' can fix it

Copy link
Author

@Limych Limych Feb 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very strange. Are you sure this code doesn't work?

Test 1:

user:~$ sh
$ uname -sv
Linux #49-Ubuntu SMP Fri Feb 5 03:01:28 UTC 2021
$ echo -n "test..."
test...$ 

Test 2:

root@server:~ # sh
# uname -sv
FreeBSD FreeBSD 12.2-RELEASE-p3 7851f4a452d(HEAD) TRUENAS
# echo -n "test..."
test...# 

dater="$(date "+%Y-%m-%d %H:%M")"

if [ ! -f "/tmp/TTAA.$id.lock" ]; then
if [ "$add_date_t" = "$dater" -o "$add_date_t" = "$dateo" ]; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regress changes
should be if [[ "( "$(add_date_t)" == "$(dater)" || "$(add_date_t)" == "$(dateo)" )" ]]; then or something like that

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no built-in command [[ in sh. There is a command [, which has a slightly different syntax. I just translated the logic of the command [[ into the syntax of the command [.

What you wrote is exactly the condition that is specified.

ids="$(${trans} --list | grep -vE 'Seeding|Stopped|Finished|[[:space:]]100%[[:space:]]' | grep '^ ' | awk '{ print $1 }' | grep -vE 'ID')"
for id in $ids ; do
add_date="$(${trans} --torrent "$id" --info| grep '^ Date added: ' |cut -c 21-)"
if [ $(uname) = "FreeBSD" ]; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"$(uname)" just in case, prevent word splitting

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

# Conflicts:
#	tracker-add-auto.sh
@Limych
Copy link
Author

Limych commented Sep 16, 2021

PR updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants