a2server/scripts/a2server-1-storage.txt
T. Joseph Carter 530b8d57f5 Clean the main scripts a bit
Ivan writes pretty dense scripts in some ways, but not others.  Mostly
he likes to collapse statements to a single line and using && and || in
place of if constructs.  Reduces file size and theoretically speeds
execution, but it makes community development tougher and the speed
gains are questionable.

I've begun removing multiple successive writes to a single file such as
those using tee as a means to write files as root.  Clean up enough of
those and you will have a noticable performance impact, although again
there's no evidence there are enough of them here to see one.

Removed a few dead/commented code blocks and restructured a couple of
conditionals to make the no-action condition the else case.

Finally, bumped the version.  This isn't all that'll go into 1.5.1 but
it's a start.
2016-10-27 00:55:16 -07:00

26 lines
865 B
Bash
Executable File

#! /bin/bash
# vim: set tabstop=4 shiftwidth=4 noexpandtab filetype=sh:
# --- Setting up the share volume
# 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
if [[ -f /etc/samba/smbd.conf ]]; then
sudo sed -i 's|/media/A2SHARED|/srv/A2SERVER|g' /etc/samba/smbd.conf
fi
fi
if [[ ! -d /srv/A2SERVER ]]; then
echo "A2SERVER: Preparing the shared files volume..."
sudo mkdir -p /srv/A2SERVER
sudo chown $USER:$USER /srv/A2SERVER
else
echo "A2SERVER: Shared volume is already prepared for use."
fi