From 542f9b6905a7ad30a57b2a6cad0a90852479dbd1 Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Sun, 17 Oct 2021 18:31:17 -0700 Subject: [PATCH] Script for installing Netatalk (#336) * Script for installing Netatalk * Fix errors * Tweak labels * Improve script * Fix error * Fix error * Fix error * Fix errors * Fix errors * Add message * Clean up old config files * Cleanup * Fix errors * Cleanup * Avoid erroring out of script * Improve help text * Improve help text * Flesh out help text * Improve help text --- easyinstall.sh | 95 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 85 insertions(+), 10 deletions(-) diff --git a/easyinstall.sh b/easyinstall.sh index cc360f82..c08c1033 100755 --- a/easyinstall.sh +++ b/easyinstall.sh @@ -79,7 +79,7 @@ function installPackages() { # compile and install RaSCSI Service function installRaScsi() { - sudo systemctl stop rascsi + sudo systemctl stop rascsi || true if [ -f /etc/systemd/system/rascsi.service ]; then sudo cp /etc/systemd/system/rascsi.service /etc/systemd/system/rascsi.service.old @@ -125,7 +125,7 @@ function installRaScsiWebInterface() { sudo usermod -a -G pi www-data - sudo systemctl reload nginx + sudo systemctl reload nginx || true echo "Installing the rascsi-web.service configuration..." sudo cp -f "$BASE/src/web/service-infra/rascsi-web.service" /etc/systemd/system/rascsi-web.service @@ -154,7 +154,7 @@ function createImagesDir() { } function stopOldWebInterface() { - sudo systemctl stop rascsi-web + sudo systemctl stop rascsi-web || true APACHE_STATUS=$(sudo systemctl status apache2 &> /dev/null; echo $?) if [ "$APACHE_STATUS" -eq 0 ] ; then echo "Stopping old Apache2 RaSCSI Web..." @@ -338,8 +338,9 @@ function setupWiredNetworking() { echo "Modified /etc/network/interfaces.d/rascsi_bridge" echo "Configuration completed!" - echo "Please make sure you attach a DaynaPORT network adapter to the RaSCSI configuration." - echo "Either use the Web UI, or do this on the command line (assuming SCSI ID 6): \"rascsi -ID 6 -t scdp $LAN_INTERFACE\"" + echo "Please make sure you attach a DaynaPORT network adapter to your RaSCSI configuration." + echo "Either use the Web UI, or do this on the command line (assuming SCSI ID 6):" + echo "rasctl -i 6 -c attach -t scdp -f $LAN_INTERFACE" echo "" echo "We need to reboot your Pi" echo "Press Enter to reboot or CTRL-C to exit" @@ -412,8 +413,9 @@ function setupWirelessNetworking() { echo "Configuration completed!" echo "" - echo "Please make sure you attach a DaynaPORT network adapter to the RaSCSI configuration" - echo "Either use the Web UI, or do this on the command line (assuming SCSI ID 6): \"rascsi -ID 6 -t scdp $WLAN_INTERFACE:$ROUTER_IP/$CIDR\"" + echo "Please make sure you attach a DaynaPORT network adapter to your RaSCSI configuration" + echo "Either use the Web UI, or do this on the command line (assuming SCSI ID 6):" + echo "rasctl -i 6 -c attach -t scdp -f $WLAN_INTERFACE:$ROUTER_IP/$CIDR" echo "" echo "We need to reboot your Pi" echo "Press Enter to reboot or CTRL-C to exit" @@ -446,6 +448,73 @@ function reserveScsiIds() { sudo systemctl start rascsi } +function installNetatalk() { + NETATALK_VERSION="20200806" + AFP_SHARE_PATH="$HOME/afpshare" + + echo "Cleaning up existing Netatalk installation, if it exists..." + sudo /etc/init.d/netatalk stop || true + sudo rm -rf /etc/default/netatalk.conf /etc/netatalk || true + + if [ -f "$HOME/netatalk-classic-$NETATALK_VERSION" ]; then + echo "Deleting existing version of $HOME/netatalk-classic-$NETATALK_VERSION." + sudo rm -rf "$HOME/netatalk-classic-$NETATALK_VERSION" + fi + + echo "Downloading netatalk-classic-$NETATALK_VERSION to $HOME" + cd $HOME || exit 1 + wget "https://github.com/christopherkobayashi/netatalk-classic/archive/refs/tags/$NETATALK_VERSION.tar.gz" > ./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 + + ( sudo apt-get update && sudo apt-get install libssl-dev libdb-dev libcups2-dev autotools-dev automake libtool --assume-yes )