chootka / subnodes

Subnodes is an open source project that configures your Raspberry Pi as a wireless AP, Node.js server, and BATMAN ADV mesh point.
Other
205 stars 39 forks source link

Support all home dir usernames #15

Closed sleepdefic1t closed 6 years ago

sleepdefic1t commented 7 years ago

This update adds support for all home-directory usernames.


Issue

Missing directory errors

Cause

Default packages point to /home/pi/...

If username is other than pi;
install.sh, uninstall.sh, & /scripts/subnodes_ap.sh will throw missing directory errors.

Expected result

Install, run, and be uninstalled with no directory errors.

Reproduction

Have username other than pi

cd subnodes sudo bash install.sh || sudo ./install.sh

Suggested Fix

replace:
cd /home/pi/subnodes/

with:
cd "$(dirname $(readlink -f $0))"

/subnodes/install.sh#L152

#

replace:

with:

/subnodes/uninstall.sh#L76
/subnodes/uninstall.sh#L77

#

replace:
DAEMON_PATH="/home/pi/subnodes"

with:
DAEMON_PATH="$(dirname "$(pwd)")"

/subnodes/scripts/subnodes_ap.sh#L19

#

Results after Suggested Fix

No missing directory errors. subnodes installs as expected.


chootka commented 6 years ago

Thank you!