mirror of
https://github.com/RasppleII/a2server.git
synced 2025-01-08 19:37:58 +00:00
on Debian, provides AppleTalk without IPDDP to enable MacIPgw
This commit is contained in:
parent
343bde59fa
commit
c2bb79860a
@ -40,7 +40,7 @@ else
|
||||
|
||||
# stop Netatalk and samba if running (during upgrade)
|
||||
if [[ $(ps --no-headers -C afpd) ]]; then
|
||||
sudo /etc/init.d/netatalk stop
|
||||
sudo /etc/init.d/netatalk stop &> /dev/null
|
||||
sudo /etc/init.d/samba stop &> /dev/null
|
||||
fi
|
||||
|
||||
@ -223,7 +223,7 @@ sudo sed -i 's/bin\/sh/bin\/bash/' /etc/init.d/netatalk
|
||||
sudo sed -i 's/#ATALKD_RUN=no/ATALKD_RUN=yes/' /etc/default/netatalk
|
||||
sudo sed -i 's/#ATALK_BGROUND=no/ATALK_BGROUND=yes/' /etc/default/netatalk
|
||||
if [[ ! $(grep 'kernelRelease' /etc/init.d/netatalk) ]]; then
|
||||
sudo sed -i 's@\(\tif \[ x\"$ATALKD_RUN\)@\n\t# check for valid AppleTalk kernel module\n\t[[ $ATALKD_RUN == "yes" ]] \&\& { kernelRelease=$(uname -r); kernelMajorRelease=$(cut -d "." -f 1 <<< $kernelRelease); kernelMinorRelease=$(cut -d "." -f 2 <<< $kernelRelease | sed '"'"'s/\\(^[0-9]*\\)[^0-9].*$/\\1/'"'"'); kernelPatchRelease=$(cut -d "." -f 3- <<< $kernelRelease | sed '"'"'s/\\(^[0-9]*\\)[^0-9].*$/\\1/'"'"'); [[ ( $kernelMajorRelease -eq 3 \&\& $kernelMinorRelease -ge 12 \&\& $kernelMinorRelease -le 15 ) \&\& ( ! ( -f /usr/bin/raspi-config \&\& $kernelMinorRelease -eq 12 \&\& $kernelPatchRelease -ge 25 ) ) \&\& ( ( ! -f /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko ) || $(sha1sum /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko | cut -f 1 -d " ") != "ecb239fc084c36de93f6926e7749b80f6024f269" ) ]] \&\& { ATALKD_RUN=no; echo "[AppleTalk networking is not available.]" 1>\&2; } }\n\n\1@' /etc/init.d/netatalk
|
||||
sudo sed -i 's@\(\tif \[ x\"$ATALKD_RUN\)@\n\t# check for valid AppleTalk kernel module\n\t[[ $ATALKD_RUN == "yes" ]] \&\& { kernelRelease=$(uname -r); kernelMajor=$(cut -d "." -f 1 <<< $kernelRelease); kernelMinor=$(cut -d "." -f 2 <<< $kernelRelease | sed '"'"'s/\\(^[0-9]*\\)[^0-9].*$/\\1/'"'"'); kernelPatch=$(cut -d "." -f 3- <<< $kernelRelease | sed '"'"'s/\\(^[0-9]*\\)[^0-9].*$/\\1/'"'"'); [[ ( $kernelMajor -eq 3 \&\& $kernelMinor -ge 12 \&\& $kernelMinor -le 15 ) \&\& ( ! ( -f /usr/bin/raspi-config \&\& $kernelMinor -eq 12 \&\& $kernelPatch -ge 25 ) ) \&\& ( ( ! -f /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko ) || $(sha1sum /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko | cut -f 1 -d " ") != "ecb239fc084c36de93f6926e7749b80f6024f269" ) ]] \&\& { ATALKD_RUN=no; echo "[AppleTalk networking is not available.]" 1>\&2; } }\n\n\1@' /etc/init.d/netatalk
|
||||
fi
|
||||
|
||||
# enable MacIPgw support after launching atalkd
|
||||
@ -455,14 +455,15 @@ fi
|
||||
|
||||
# get Kernel release (e.g. 3.6.11+) and version (e.g. #557)
|
||||
kernelRelease=$(uname -r)
|
||||
kernelMajorRelease=$(cut -d '.' -f 1 <<< $kernelRelease)
|
||||
kernelMinorRelease=$(cut -d '.' -f 2 <<< $kernelRelease | sed 's/\(^[0-9]*\)[^0-9].*$/\1/')
|
||||
kernelPatchRelease=$(cut -d '.' -f 3- <<< $kernelRelease | sed 's/\(^[0-9]*\)[^0-9].*$/\1/')
|
||||
kernelMajor=$(cut -d '.' -f 1 <<< $kernelRelease)
|
||||
kernelMinor=$(cut -d '.' -f 2 <<< $kernelRelease | sed 's/\(^[0-9]*\)[^0-9].*$/\1/')
|
||||
kernelPatch=$(cut -d '.' -f 3- <<< $kernelRelease | sed 's/\(^[0-9]*\)[^0-9].*$/\1/')
|
||||
kernelMajorMinor=$(cut -d '.' -f 1-2 <<< $kernelRelease)
|
||||
|
||||
# if on kernel 3.12 through 3.15, check if we need to delete AppleTalk module to prevent kernel panics
|
||||
if [[ $kernelMajorRelease -eq 3 && $kernelMinorRelease -ge 12 && $kernelMinorRelease -le 15 ]]; then
|
||||
if [[ $kernelMajor -eq 3 && $kernelMinor -ge 12 && $kernelMinor -le 15 ]]; then
|
||||
# if not RPi, or RPi without ivanx-fixed AppleTalk module, delete the module
|
||||
if [[ ! ( $isRpi && $kernelMinorRelease -eq 12 && $kernelPatchRelease -ge 25 ) ]]; then
|
||||
if [[ ! ( $isRpi && $kernelMinor -eq 12 && $kernelPatch -ge 25 ) ]]; then
|
||||
if [[ -f /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko ]]; then
|
||||
if [[ $(sha1sum /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko | cut -f 1 -d ' ') != "ecb239fc084c36de93f6926e7749b80f6024f269" ]]; then
|
||||
# stop Netatalk
|
||||
@ -481,6 +482,96 @@ if [[ $kernelMajorRelease -eq 3 && $kernelMinorRelease -ge 12 && $kernelMinorRel
|
||||
fi
|
||||
fi
|
||||
|
||||
# if IPDDP module exists (e.g. Debian, but not Raspbian),
|
||||
# AppleTalk kernel module can't work with MacIP
|
||||
if [[ -f "/lib/modules/$kernelRelease/kernel/drivers/net/appletalk/ipddp.ko" ]]; then
|
||||
sudo /etc/init.d/netatalk stop &> /dev/null
|
||||
sudo rmmod ipddp 2> /dev/null
|
||||
sudo rmmod appletalk 2> /dev/null
|
||||
echo "A2SERVER: Attempting to replace AppleTalk kernel module for MacIP use..."
|
||||
|
||||
sudo mv /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko /tmp
|
||||
|
||||
if [[ $isDebian_x86 ]]; then
|
||||
echo "A2SERVER: Attempting to fetch AppleTalk kernel module for Debian x86..."
|
||||
wget -qO /tmp/appletalk.tgz http://appleii.ivanx.com/a2server/files/appletalk-$kernelRelease-debian_x86.tgz
|
||||
if [[ $? -eq 0 ]]; then
|
||||
# if we found a prebuilt one on a2server site, install it and load it
|
||||
sudo tar Pxf /tmp/appletalk.tgz
|
||||
sudo depmod
|
||||
sudo modprobe appletalk
|
||||
if [[ $(lsmod | grep appletalk) ]]; then
|
||||
# if it loaded, restart netatalk
|
||||
sudo sed -i "s/ATALKD_RUN=no/ATALKD_RUN=yes/" /etc/default/netatalk; sudo /etc/init.d/netatalk restart &> /dev/null
|
||||
else
|
||||
# if we didn't load it successfully, remove it
|
||||
sudo rm /lib/modules/$kernelRelease/kernel/net/appletalk/appletalk.ko 2> /dev/null
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! lsmod | grep -q appletalk; then
|
||||
# we don't have a prebuilt AppleTalk module, try to build from source
|
||||
if [[ ! -f /tmp/a2server-packageReposUpdated ]]; then
|
||||
# prepare for installing packages
|
||||
sudo apt-get -y update
|
||||
touch /tmp/a2server-packageReposUpdated
|
||||
fi
|
||||
|
||||
# kernel module compile adapted from from: http://askubuntu.com/a/338403/288003
|
||||
for i in 1; do
|
||||
echo "A2SERVER: Attempting to build AppleTalk kernel module..."
|
||||
[[ -f /boot/config-$kernelRelease ]] || break
|
||||
sudo apt-get -y install linux-headers-$kernelRelease linux-source-$kernelMajorMinor || break
|
||||
sudo apt-get -y install build-essential
|
||||
cd /usr/src
|
||||
kernelSrc=$(find linux-source-${kernelMajorMinor}*)
|
||||
if [[ ${kernelSrc##*.} == "xz" ]]; then
|
||||
xzcat $kernelSrc | sudo tar x
|
||||
elif [[ ${kernelSrc##*.} == "bz2" ]]; then
|
||||
sudo tar jxf $kernelSrc
|
||||
elif [[ ${kernelSrc##*.} == "gz" || ${kernelSrc##*.} == "tgz" ]]; then
|
||||
sudo tar zxf $kernelSrc
|
||||
fi
|
||||
cd linux-source-$kernelMajorMinor
|
||||
sudo make mrproper
|
||||
sudo cp ../linux-headers-$kernelRelease/Module.symvers .
|
||||
yes '' | sudo make oldconfig
|
||||
sudo sed -i 's:^.*IPDDP.*$:# CONFIG_IPDDP is not set:gI' .config # disable IPDDP in kernel config
|
||||
sudo sed -i '$!N; /^\(# CONFIG_IPDDP is not set\)\n\1$/!P; D' .config # delete repeated entries
|
||||
sudo make prepare
|
||||
sudo make modules_prepare
|
||||
sudo make SUBDIRS=scripts/mod
|
||||
sudo make SUBDIRS=net/appletalk modules
|
||||
sudo cp net/appletalk/appletalk.ko /lib/modules/$kernelRelease/kernel/net/appletalk
|
||||
sudo depmod
|
||||
sudo modprobe appletalk
|
||||
sudo rm -r /lib/modules/$kernelRelease/kernel/drivers/net/appletalk/ipddp.ko
|
||||
sudo rmdir /lib/modules/$kernelRelease/kernel/drivers/net/appletalk 2> /dev/null
|
||||
|
||||
# clean up
|
||||
cd
|
||||
sudo rm /usr/src/$kernelSrc
|
||||
sudo rm -r /usr/src/linux-source-$kernelMajorMinor
|
||||
sudo apt-get -y purge linux-source-$kernelMajorMinor
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $(lsmod | grep appletalk) ]]; then
|
||||
# if it loaded, make permanent and restart netatalk
|
||||
sudo rm /lib/modules/$kernelRelease/kernel/drivers/net/appletalk/ipddp.ko 2> /dev/null
|
||||
sudo sed -i 's:^.*IPDDP.*$:# CONFIG_IPDDP is not set:gI' /boot/config-$kernelRelease
|
||||
sudo sed -i '$!N; /^\(# CONFIG_IPDDP is not set\)\n\1$/!P; D' /boot/config-$kernelRelease
|
||||
sudo sed -i "s/ATALKD_RUN=no/ATALKD_RUN=yes/" /etc/default/netatalk; sudo /etc/init.d/netatalk restart &> /dev/null
|
||||
else
|
||||
# if we didn't load it successfully, put back the one that was there
|
||||
echo "A2SERVER: Unable to replace AppleTalk module, replacing original."
|
||||
sudo mv /tmp/appletalk.ko /lib/modules/$kernelRelease/kernel/net/appletalk 2> /dev/null
|
||||
sudo depmod
|
||||
touch /tmp/noMacIP # to notify at end of install
|
||||
fi
|
||||
fi
|
||||
|
||||
# --- Start Netatalk (if not running)
|
||||
|
||||
bground=
|
||||
|
@ -43,7 +43,7 @@ alias netatalk-wifi='sudo sed -i 's/^eth0/wlan0/' /usr/local/etc/netatalk/atalkd
|
||||
|
||||
|
||||
alias appletalk-off='sudo sed -i "s/ATALKD_RUN=yes/ATALKD_RUN=no/" /etc/default/netatalk; sudo killall macipgw > /dev/null; /etc/init.d/netatalk restart'
|
||||
alias appletalk-on='sudo sed -i "s/ATALKD_RUN=no/ATALKD_RUN=yes/" /etc/default/netatalk; sudo /etc/init.d/netatalk restart; sudo macip-start'
|
||||
alias appletalk-on='sudo sed -i "s/ATALKD_RUN=no/ATALKD_RUN=yes/" /etc/default/netatalk; sudo /etc/init.d/netatalk restart'
|
||||
|
||||
|
||||
NETATALK="/usr/local/etc/netatalk"
|
||||
|
@ -9,7 +9,7 @@
|
||||
# to download and execute, type:
|
||||
# wget appleii.ivanx.com/a2server/setup; source setup
|
||||
|
||||
a2serverVersion="128d2"
|
||||
a2serverVersion="128d3"
|
||||
|
||||
# Ensure URL we'll use ends in a /
|
||||
case "$A2SERVER_SCRIPT_URL" in
|
||||
@ -266,9 +266,18 @@ if (( $doSetup )); then
|
||||
echo "by typing 'appletalk-on'."
|
||||
echo
|
||||
fi
|
||||
|
||||
if [[ -f /tmp/noMacIP ]]; then
|
||||
echo
|
||||
echo "MacIP connections may be unavailable. If you know how, try"
|
||||
echo "recompiling the AppleTalk kernel module with IPDDP options disabled."
|
||||
echo
|
||||
rm /tmp/noMacIP
|
||||
fi
|
||||
|
||||
if [[ -f /tmp/singleUser ]]; then
|
||||
if [[ ! $autoAnswerYes ]]; then
|
||||
echo
|
||||
echo "Your Raspberry Pi was started in single-user mode in order to"
|
||||
echo -n "fix a problem. You should restart to operate normally. Restart now? "
|
||||
read
|
||||
@ -279,6 +288,7 @@ if (( $doSetup )); then
|
||||
echo "A2SERVER: Preparing to restart..."
|
||||
while :; do sleep 60; done
|
||||
fi
|
||||
rm /tmp/singleUser
|
||||
echo
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user