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

A2SERVER has moved files to /srv from /media #25

Open
knghtbrd opened this issue Apr 2, 2016 · 6 comments
Open

A2SERVER has moved files to /srv from /media #25

knghtbrd opened this issue Apr 2, 2016 · 6 comments

Comments

@knghtbrd
Copy link
Member

knghtbrd commented Apr 2, 2016

A change in A2SERVER between 1.2.5 and 1.5.0 is that your AppleTalk shares no longer live in /media. Now they're in /srv which is more Linuxically Standardistically correct.

A2CLOUD tries to do stuff with A2SERVER in a block presently at lines 540-571 of setup.txt. This needs to be updated. It could either be made to work with either path, or just be changed to use /srv exclusively.

@knghtbrd
Copy link
Member Author

Changed it to just use /srv. Potential for duplicate entries on upgrade exists I suspect if A2SERVER is upgraded after A2CLOUD? Maybe. Should we address that @IvanExpert?

@IvanExpert
Copy link
Contributor

It has logic to move everything from /media to seven on an upgrade, or so I think. If you changed any code we should retest.

On Apr 10, 2016, at 7:58 AM, Joseph Carter [email protected] wrote:

Changed it to just use /srv. Potential for duplicate entries on upgrade exists I suspect if A2SERVER is upgraded after A2CLOUD? Maybe. Should we address that @IvanExpert?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

@knghtbrd
Copy link
Member Author

knghtbrd commented Apr 11, 2016

What I changed was in A2CLOUD.

The relevant bit of code in A2SERVER is:

The relevant bit of code in A2SERVER is:

```bash
# 1.3.0: move /media/A2SHARED (pre-1.3.0) to /srv/A2SERVER
if [[ -d /media/A2SHARED ]]; then
    echo "A2SERVER: Moving /media/A2SHARED to /srv/A2SERVER..."
    sudo /etc/init.d/netatalk stop &> /dev/null
    sudo /etc/init.d/samba stop &> /dev/null
    [[ ! -d /srv ]] && sudo mkdir -p /srv
    sudo mv /media/A2SHARED /srv/A2SERVER
    sudo sed -i 's|/media/A2SHARED|/srv/A2SERVER|g' /usr/local/etc/netatalk/AppleVolumes.default
    [[ -f /etc/samba/smbd.conf ]] && sudo sed -i 's|/media/A2SHARED|/srv/A2SERVER|g' /etc/samba/smbd.conf

fi

...that should handle the upgrade case for A2CLOUD which installed
a line in AppleVolumes.default for A2CLOUD's disk image directory.

I've updated A2CLOUD's setup.txt to install the line in question into
/srv rather than /media:

    ### A2CLOUD: Enable netatalk sharing for A2CLOUD if it's installed
    ###      FIXME: This has changed in A2SERVER, fix it here
    if hash afpd 2>/dev/null; then # A2SERVER/netatalk installed
        if [[ ! -d /srv/A2SERVER/ADTDISKS || ! $(grep ADTDISKS /usr/local/etc/netatalk/AppleVolumes.default) ]]; then
            echo "A2CLOUD: Setting up /usr/local/adtpro/disks for Apple file sharing..."
            if [[ ! -d /srv/A2SERVER/ADTDISKS ]]; then
                ln -s /usr/local/adtpro/disks /srv/A2SERVER/ADTDISKS 2>/dev/null
            fi
            if [[ ! $(grep ADTDISKS /usr/local/etc/netatalk/AppleVolumes.default) ]]; then
                sudo sed -i 's@^# End of File@/srv/A2SERVER/ADTDISKS ADTDISKS ea:ad\n\n# End of File@' /usr/local/etc/netatalk/AppleVolumes.default
            fi
            sudo /etc/init.d/netatalk restart
        else
            echo "A2CLOUD: /usr/local/adtpro/disks is already set up for Apple file sharing."
        fi

        ### A2CLOUD: Enable samba sharing for A2CLOUD, if A2SERVER installed it
        if grep -q A2SHARED /etc/samba/smb.conf 2>/dev/null; then
            # SMB already enabled by A2SERVER
            if grep -q ADTDISKS /etc/samba/smb.conf 2>/dev/null; then
                echo "A2CLOUD: /usr/local/adtpro/disks is already set up for Windows file sharing."
            else
                echo "A2CLOUD: Setting up /usr/local/adtpro/disks for Windows file sharing..."
                echo "[ADTDISKS]" | sudo tee -a /etc/samba/smb.conf >/dev/null
                echo "    path = /srv/A2SERVER/ADTDISKS" | sudo tee -a /etc/samba/smb.conf >/dev/null
                echo "    browsable = yes" | sudo tee -a /etc/samba/smb.conf >/dev/null
                echo "    guest ok = yes" | sudo tee -a /etc/samba/smb.conf >/dev/null
                echo "    read only = no" | sudo tee -a /etc/samba/smb.conf >/dev/null
                echo "    create mask = 0666" | sudo tee -a /etc/samba/smb.conf >/dev/null
                echo "    force user = $(whoami)" | sudo tee -a /etc/samba/smb.conf >/dev/null
            fi
        else
            echo "A2CLOUD: Windows file sharing not in use."
        fi
    fi

I don't actually attempt to upgrade either in A2CLOUD, assuming that
A2SERVER was upgraded first. However if A2CLOUD is updated before
A2SERVER, it might cause problems.

...I do now see a problem with A2SERVER however. It appears that
A2SERVER's Samba does not upgrade from /media to /srv in 1.3+.

Joseph

On Sun, Apr 10, 2016 at 05:48:09AM -0700, IvanExpert wrote:

It has logic to move everything from /media to seven on an upgrade, or so I think. If you changed any code we should retest.

On Apr 10, 2016, at 7:58 AM, Joseph Carter [email protected] wrote:

Changed it to just use /srv. Potential for duplicate entries on upgrade exists I suspect if A2SERVER is upgraded after A2CLOUD? Maybe. Should we address that @IvanExpert?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#25 (comment)

@IvanExpert
Copy link
Contributor

I don't actually attempt to upgrade either in A2CLOUD, assuming that
A2SERVER was upgraded first. However if A2CLOUD is updated before
A2SERVER, it might cause problems.

Yeah, assuming that A2SERVER is upgraded first probably isn't a safe. Maybe correct behavior would be to test for existence of A2SERVER, and if present, refuse to update until A2SERVER is updated, or warn that it needs to be in order for ADTDISKS needs to be shared at the end of the install. Otherwise, doesn't matter, as ADTDISKS isn't shared if A2SERVER is absent.

...I do now see a problem with A2SERVER however. It appears that
A2SERVER's Samba does not upgrade from /media to /srv in 1.3+.

Oops, then. I'll have a look at that.

@knghtbrd
Copy link
Member Author

On Mon, Apr 11, 2016 at 01:31:11AM -0700, IvanExpert wrote:

I don't actually attempt to upgrade either in A2CLOUD, assuming that
A2SERVER was upgraded first. However if A2CLOUD is updated before
A2SERVER, it might cause problems.

Yeah, assuming that A2SERVER is upgraded first probably isn't a safe. Maybe correct behavior would be to test for existence of A2SERVER, and if present, refuse to update until A2SERVER is updated, or warn that it needs to be in order for ADTDISKS needs to be shared at the end of the install. Otherwise, doesn't matter, as ADTDISKS isn't shared if A2SERVER is absent.

We could just bail writing anything if ADTDISKS is in either
location. If it's not there, we'll write it in /srv regardless of
what the rest of A2SERVER is using. If it is there, we'll assume
A2SERVER will have moved it on upgrade.

If A2SERVER's upgrade can handle that, it's what I'll go with.

...I do now see a problem with A2SERVER however. It appears that
A2SERVER's Samba does not upgrade from /media to /srv in 1.3+.

Oops, then. I'll have a look at that.

If you can make sure it handles the above case when moving files,
the A2CLOUD side should be easy enough.

Joseph

@knghtbrd
Copy link
Member Author

@IvanExpert Did you address this issue (or find out that it didn't need addressing) in A2SERVER? I'd like to dispatch this issue if a reasonable thing is done with samba upgrades. If you don't recall fixing it though, I'll need to look into it for 1.5.1.

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

No branches or pull requests

2 participants