mirror of
https://github.com/akuker/RASCSI.git
synced 2024-05-31 13:41:30 +00:00
Use Netatalk 2.x v220101 (#631)
* Use Netatalk 2.x v220101 * Correct removal of existing copy * Add missing libavahi-client-dev * Improve cleanup of previous Netatalk installation * Print out systemd status after starting the services * Add CUPS installation
This commit is contained in:
parent
2a47924a74
commit
7c1020a40b
|
@ -640,51 +640,66 @@ function setupWirelessNetworking() {
|
||||||
|
|
||||||
# Downloads, compiles, and installs Netatalk (AppleShare server)
|
# Downloads, compiles, and installs Netatalk (AppleShare server)
|
||||||
function installNetatalk() {
|
function installNetatalk() {
|
||||||
NETATALK_VERSION="20200806"
|
NETATALK_VERSION="2-220101"
|
||||||
AFP_SHARE_PATH="$HOME/afpshare"
|
AFP_SHARE_PATH="$HOME/afpshare"
|
||||||
|
SYSCONFDIR="/etc"
|
||||||
|
|
||||||
echo "Cleaning up existing Netatalk installation, if it exists..."
|
sudo systemctl stop atalkd afpd || true
|
||||||
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
|
if [ -f /etc/init.d/netatalk ]; then
|
||||||
echo "Deleting existing version of $HOME/netatalk-classic-$NETATALK_VERSION."
|
echo ""
|
||||||
sudo rm -rf "$HOME/netatalk-classic-$NETATALK_VERSION"
|
echo "WARNING: An old version of Netatalk was detected. It is recommended to back up you configuration files and shared files before proceeding. Press CTRL-C to exit, or any other key to proceed."
|
||||||
|
read
|
||||||
|
sudo /etc/init.d/netatalk stop || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Downloading netatalk-classic-$NETATALK_VERSION to $HOME"
|
if [ -f /var/log/afpd.log ]; then
|
||||||
|
echo "Removing /var/log/afpd.log created by an old version of Netatalk..."
|
||||||
|
sudo rm /var/log/afpd.log
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ `grep -c netatalk /etc/rc.local` -eq 1 ]]; then
|
||||||
|
sudo sed -i "/netatalk/d" /etc/rc.local
|
||||||
|
echo "Removed Netatalk from /etc/rc.local -- use systemctl to control Netatalk from now on."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "$HOME/Netatalk-2.x-netatalk-$NETATALK_VERSION" ]; then
|
||||||
|
echo "Deleting existing copy of $HOME/Netatalk-2.x-netatalk-$NETATALK_VERSION."
|
||||||
|
sudo rm -rf "$HOME/Netatalk-2.x-netatalk-$NETATALK_VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Downloading netatalk-$NETATALK_VERSION to $HOME"
|
||||||
cd $HOME || exit 1
|
cd $HOME || exit 1
|
||||||
wget -O "$NETATALK_VERSION.tar.gz" "https://github.com/christopherkobayashi/netatalk-classic/archive/refs/tags/$NETATALK_VERSION.tar.gz" </dev/null
|
wget -O "netatalk-$NETATALK_VERSION.tar.gz" "https://github.com/rdmark/Netatalk-2.x/archive/refs/tags/netatalk-$NETATALK_VERSION.tar.gz" </dev/null
|
||||||
tar -xzvf $NETATALK_VERSION.tar.gz
|
tar -xzvf netatalk-$NETATALK_VERSION.tar.gz
|
||||||
|
|
||||||
cd "netatalk-classic-$NETATALK_VERSION" || exit 1
|
cd "Netatalk-2.x-netatalk-$NETATALK_VERSION" || exit 1
|
||||||
sed -i /^~/d ./config/AppleVolumes.default.tmpl
|
sed -i /^~/d ./config/AppleVolumes.default.tmpl
|
||||||
echo "$AFP_SHARE_PATH \"Pi File Server\" adouble:v1 volcharset:ASCII" >> ./config/AppleVolumes.default.tmpl
|
echo "$AFP_SHARE_PATH \"Pi File Server\"" >> ./config/AppleVolumes.default.tmpl
|
||||||
|
|
||||||
echo "ATALKD_RUN=yes" >> ./config/netatalk.conf
|
echo "- -transall -uamlist uams_guest.so,uams_clrtxt.so,uams_dhx2.so -nosavepassword -noicon\"" >> ./config/afpd.conf.tmpl
|
||||||
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
|
echo "cupsautoadd:op=root:" >> ./config/papd.conf
|
||||||
|
|
||||||
( sudo apt-get update && sudo apt-get install libssl-dev libdb-dev libcups2-dev autotools-dev automake libtool --assume-yes ) </dev/null
|
( sudo apt-get update && sudo apt-get install libssl-dev libdb-dev libcups2-dev cups libavahi-client-dev autotools-dev automake libtool libgcrypt20-dev --assume-yes ) </dev/null
|
||||||
|
|
||||||
echo "Compiling and installing Netatalk..."
|
echo "Compiling and installing Netatalk..."
|
||||||
./bootstrap
|
./bootstrap </dev/null
|
||||||
./configure --enable-debian --enable-cups --sysconfdir=/etc --with-uams-path=/usr/lib/netatalk
|
./configure --enable-systemd --enable-ddp --enable-cups --enable-timelord --enable-zeroconf --disable-quota --enable-overwrite --sysconfdir="$SYSCONFDIR" --with-uams-path=/usr/lib/netatalk </dev/null
|
||||||
( make && sudo make install ) </dev/null
|
|
||||||
|
echo "Compiling with ${CORES:-1} simultaneous cores..."
|
||||||
|
( make all -j "${CORES:-1}" && sudo make install ) </dev/null
|
||||||
|
|
||||||
if [ -d "$AFP_SHARE_PATH" ]; then
|
if [ -d "$AFP_SHARE_PATH" ]; then
|
||||||
echo "The $AFP_SHARE_PATH directory already exists."
|
echo "Will use the existing $AFP_SHARE_PATH directory for file sharing."
|
||||||
else
|
else
|
||||||
echo "The $AFP_SHARE_PATH directory does not exist; creating..."
|
echo "The $AFP_SHARE_PATH directory does not exist; creating..."
|
||||||
mkdir -p "$AFP_SHARE_PATH"
|
mkdir -p "$AFP_SHARE_PATH"
|
||||||
chmod -R 2775 "$AFP_SHARE_PATH"
|
chmod -R 2775 "$AFP_SHARE_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ `grep -c netatalk /etc/rc.local` -eq 0 ]]; then
|
echo "Starting Netatalk services. This may take a minute..."
|
||||||
sudo sed -i "/^exit 0/i sudo /etc/init.d/netatalk start" /etc/rc.local
|
sudo systemctl start atalkd afpd papd timelord
|
||||||
echo "Modified /etc/rc.local"
|
systemctl status afpd atalkd papd timelord
|
||||||
fi
|
|
||||||
|
|
||||||
sudo /etc/init.d/netatalk start
|
|
||||||
|
|
||||||
if [[ `lsmod | grep -c appletalk` -eq 0 ]]; then
|
if [[ `lsmod | grep -c appletalk` -eq 0 ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -694,14 +709,24 @@ function installNetatalk() {
|
||||||
echo "See wiki for information on how to compile support for AppleTalk into your Linux kernel."
|
echo "See wiki for information on how to compile support for AppleTalk into your Linux kernel."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
sudo usermod -a -G lpadmin $USER
|
||||||
|
sudo cupsctl --remote-admin WebInterface=yes
|
||||||
|
if [[ `sudo grep "PreserveJobHistory No" /etc/cups/cupsd.conf` -eq 0 ]]; then
|
||||||
|
sudo sed -i "/MaxLogSize/a PreserveJobHistory No" /etc/cups/cupsd.conf
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Netatalk is now installed and configured to run on system boot."
|
echo "Netatalk daemons are now installed and enabled as systemd services."
|
||||||
echo "To start or stop the File Server manually, do:"
|
echo "Log in to the server using the current username ("$USER") and password."
|
||||||
echo "sudo /etc/init.d/netatalk start"
|
|
||||||
echo "sudo /etc/init.d/netatalk stop"
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Make sure that the user running Netatalk has a password of 8 chars or less. You may execute the 'passwd' command to change the password of the current user."
|
echo "IMPORTANT: "$USER" needs to have a password of 8 chars or less."
|
||||||
echo "For more information on configuring Netatalk and accessing AppleShare from your vintage Macs, see wiki:"
|
echo "Do you want to change your password now? [y/N]"
|
||||||
|
read -r REPLY
|
||||||
|
if [ "$REPLY" == "y" ] || [ "$REPLY" == "Y" ]; then
|
||||||
|
passwd
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
echo "For more information on how to use the various Netatalk features, see the wiki:"
|
||||||
echo "https://github.com/akuker/RASCSI/wiki/AFP-File-Sharing"
|
echo "https://github.com/akuker/RASCSI/wiki/AFP-File-Sharing"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
@ -982,12 +1007,14 @@ function runChoice() {
|
||||||
8)
|
8)
|
||||||
echo "Installing AppleShare File Server"
|
echo "Installing AppleShare File Server"
|
||||||
echo "This script will make the following changes to your system:"
|
echo "This script will make the following changes to your system:"
|
||||||
|
echo "- Install the CUPS printing system and configure its web interface"
|
||||||
|
echo "- Modify user groups and permissions"
|
||||||
echo "- Install additional packages with apt-get"
|
echo "- Install additional packages with apt-get"
|
||||||
|
echo "- Add and modify systemd services"
|
||||||
echo "- Create directories and change permissions"
|
echo "- Create directories and change permissions"
|
||||||
echo "- Install binaries to /usr/local/sbin"
|
echo "- Install binaries to /usr/local/sbin"
|
||||||
echo "- Install manpages to /usr/local/share/man/"
|
echo "- Install manpages to /usr/local/share/man/"
|
||||||
echo "- Install configuration files to /etc"
|
echo "- Install configuration files to /etc"
|
||||||
echo "- Modify /etc/rc.local to start Netatalk daemons on system startup"
|
|
||||||
echo ""
|
echo ""
|
||||||
sudoCheck
|
sudoCheck
|
||||||
installNetatalk
|
installNetatalk
|
||||||
|
|
Loading…
Reference in New Issue
Block a user