diff --git a/easyinstall.sh b/easyinstall.sh index b7957a7c..ff58685e 100755 --- a/easyinstall.sh +++ b/easyinstall.sh @@ -46,7 +46,8 @@ logo=""" echo -e $logo } -BASE="$HOME/RASCSI" +USER=$(whoami) +BASE=$(dirname "$(readlink -f "${0}")") VIRTUAL_DRIVER_PATH="$HOME/images" CFG_PATH="$HOME/.config/rascsi" WEBINSTDIR="$BASE/src/web" @@ -58,20 +59,6 @@ GIT_REMOTE=${GIT_REMOTE:-origin} set -e -function initialChecks() { - currentUser=$(whoami) - if [ "pi" != "$currentUser" ]; then - echo "You must use 'pi' user (current: $currentUser)" - exit 1 - fi - - if [ ! -d "$BASE" ]; then - echo "You must checkout RASCSI repo into $BASE" - echo "$ git clone git@github.com:akuker/RASCSI.git" - exit 2 - fi -} - # install all dependency packages for RaSCSI Service function installPackages() { sudo apt-get update && sudo apt-get install git libspdlog-dev libpcap-dev genisoimage python3 python3-venv nginx libpcap-dev protobuf-compiler bridge-utils python3-dev libev-dev libevdev2 -y > ./config/AppleVolumes.default.tmpl + echo "$AFP_SHARE_PATH \"Pi File Server\" adouble:v1 volcharset:ASCII" >> ./config/AppleVolumes.default.tmpl echo "ATALKD_RUN=yes" >> ./config/netatalk.conf echo "\"RaSCSI-Pi\" -transall -uamlist uams_guest.so,uams_clrtxt.so,uams_dhx.so -defaultvol /etc/netatalk/AppleVolumes.default -systemvol /etc/netatalk/AppleVolumes.system -nosavepassword -nouservol -guestname \"nobody\" -setuplog \"default log_maxdebug /var/log/afpd.log\"" >> ./config/afpd.conf.tmpl @@ -749,7 +741,6 @@ while [ "$1" != "" ]; do done showRaSCSILogo -initialChecks if [ -z "${RUN_CHOICE}" ]; then # RUN_CHOICE is unset, show menu showMenu diff --git a/src/web/settings.py b/src/web/settings.py index 404220e3..bedc21a6 100644 --- a/src/web/settings.py +++ b/src/web/settings.py @@ -4,12 +4,11 @@ Constant definitions used by other modules from os import getenv, getcwd -# TODO: Make HOME_DIR portable when running rascsi-web -# as a service, since the HOME env variable doesn't get set then. -HOME_DIR = getenv("HOME", "/home/pi") +WEB_DIR = getcwd() +# There may be a more elegant way to get the HOME dir of the user that installed RaSCSI +HOME_DIR = "/".join(WEB_DIR.split("/")[0:3]) CFG_DIR = f"{HOME_DIR}/.config/rascsi/" AFP_DIR = f"{HOME_DIR}/afpshare" -WEB_DIR = getcwd() MAX_FILE_SIZE = getenv("MAX_FILE_SIZE", str(1024 * 1024 * 1024 * 4)) # 4gb