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

Kodi - Open ports to allow smb/samba browsing #3503

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions host-bin/startkodi
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,14 @@ By default, it will log into the primary user on the first chroot found.

Options are directly passed to enter-chroot; run enter-chroot to list them."

# Forward ports needed to browse smb shares
MYIP=$(ip route get 1 | awk -F 'src ' '{ split($2,a," ");print a[1];exit}')
Copy link
Owner

Choose a reason for hiding this comment

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

Quote the output, and space out the awk commands. If it doesn't fit on one line, you can make the awk script span multiple lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My limited knowledge indicated 2 places that obviously needed spacing, did i miss anything else?

I think i added the quote properly...

Copy link
Owner

Choose a reason for hiding this comment

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

Yep, that looks better.


if test $MYIP; then
Copy link
Contributor

@divx118 divx118 Nov 12, 2017

Choose a reason for hiding this comment

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

if [ -n "$MYIP" ]; then should work. It also would be more consistent with the syntax elsewhere used in crouton scripts. Try to always quote strings.

iptables -I INPUT 1 -p udp \
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I overlooked this, but indentation is standard 4 spaces (no tabs) in the crouton scripts so it should look like

if [ -n "$MYIP" ]; then
    iptables -I INPUT 1 -p udp \
        --source "$MYIP"/255.255.255.0 \
        --dport 1025:65535 -j ACCEPT
fi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

--source $MYIP/255.255.255.0 \
Copy link
Contributor

Choose a reason for hiding this comment

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

"$MYIP"/255.255.255.0 \ quotes

--dport 1025:65535 -j ACCEPT
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

Max line length should be 80

Copy link
Collaborator

Choose a reason for hiding this comment

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

@divx118 method works for me, here's the output of each:

@zguithues -

chronos@localhost ~ $ ip -4 -o addr show dev wlan0| awk '{split($4,a,"/");print a[1]}'
192.168.1.225

@divx118 -

chronos@localhost ~ $ ip route get 1
1.0.0.0 via 192.168.1.1 dev wlan0 src 192.168.1.225 uid 1000 
    cache 
 
chronos@localhost ~ $ ip route get 1 | awk -F 'src ' '{ split($2,a," ");print a[1];exit}'
192.168.1.225

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, i got it working @divx118. I was missing the space between the 2 " in the split($2,a," ").

chronos@localhost / $ ip route get 1 | awk -F 'src ' '{ split($2,a," ");print a[1];exit}' 192.168.2.103

i'll update the patch. thanks!


exec sh -e "`dirname "\`readlink -f -- "$0"\`"`/enter-chroot" -t kodi "$@" "" \
exec croutonpowerd -i xinit /usr/bin/kodi --standalone