Skip to content

Commit 316d5e2

Browse files
authored
phreaknet.sh: more openSUSE compatibility patches (#70)
* Update phreaknet.sh Added a check for openSUSE Leap in the package manager detector section. * install: Add kernel header detection for openSUSE openSUSE uses a different path format for kernel headers that was not checked for by install_kernel_headers(), resulting in an error. This commit adds detection for these paths. * install: Add missing kernel package for zypper In openSUSE, one of the "kernel-*-devel" packages is required to build kernel modules, otherwise PhreakScript fails to find the kernel build directory. This commit adds the "default" version (a safe assumption, given it's for the standard kernel) of this package to the list of kernel module-related packages that zypper is told to install. * install: Check for build directory on openSUSE openSUSE does not place kernel build directories in /usr/lib/linux-kbuild-*. This commit adds a check for /usr/src/linux-*, where it is located, in case the first path doesn't exist. * install: add a missing newline to the previously-added build directory code I forgot a newline in the "no build directory found" message, so I added one. * install: zypper: added autoconf Because autoconf wasn't installed, the DAHDI tools installation failed, so I added it to the list of packages. * install: add two more zypper packages, add message for zypper users on unsupported modules. After installing libtool and automake, DAHDI finally built sucessfully, so I added them to the prereqs. I also discovered that openSUSE disables the loading of "unsupported" (i.e. external, not signed by SUSE) kernel modules, so I added a message that displays on zypper-based systems that have installed DAHDI that tells the user how to enable loading them, otherwise DAHDI won't work.
1 parent 0e6f5b6 commit 316d5e2

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

phreaknet.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ install_prereq() {
10761076
fi
10771077
fi
10781078
elif [ "$PAC_MAN" = "zypper" ]; then
1079-
PREREQ_PACKAGES="$PREREQ_PACKAGES git-core make patch gawk subversion bzip2 gcc-c++"
1079+
PREREQ_PACKAGES="$PREREQ_PACKAGES git-core make patch gawk autoconf automake libtool subversion bzip2 gcc-c++"
10801080
if [ "$CHAN_DAHDI" = "1" ]; then
10811081
PREREQ_PACKAGES="$PREREQ_PACKAGES newt-devel dwarves"
10821082
fi
@@ -2006,7 +2006,8 @@ install_kernel_headers() {
20062006
echog "kernel-devel is matched with kernel. Package provides $KERNEL_DEVEL_VERSION, and running kernel is $kernel_ver"
20072007
fi
20082008
elif [ "$PAC_MAN" = "zypper" ]; then
2009-
install_package "kmod kernel-source"
2009+
# There are multiple kernel-*-devel packages in the openSUSE repos. The default one should be a safe assumption.
2010+
install_package "kmod kernel-source kernel-devel kernel-default-devel"
20102011
elif [ "$PAC_MAN" = "pacman" ]; then
20112012
install_package "kmod linux-headers"
20122013
elif [ "$PAC_MAN" = "apk" ]; then
@@ -2046,7 +2047,8 @@ install_kernel_headers() {
20462047
# Check that the kernel sources are really present
20472048
# /usr/src/linux-headers-* on Debian
20482049
# /usr/src/kernels on Rocky Linux
2049-
numkernheaders=$( ls /usr/src/linux-headers-* /usr/src/kernels/* 2>/dev/null | wc -w )
2050+
# /usr/src/linux-* on openSUSE
2051+
numkernheaders=$( ls /usr/src/linux-headers-* /usr/src/kernels/* /usr/src/linux-* 2>/dev/null | wc -w )
20502052
if [ "$numkernheaders" = "0" ]; then
20512053
echoerr "Kernel headers do not appear to be installed... compilation will likely fail"
20522054
sleep 2
@@ -2214,6 +2216,13 @@ install_dahdi() {
22142216
KERNEL_MM=$( uname -r | cut -d'.' -f1-2 )
22152217
printf "Kernel major.minor version is %s\n" "$KERNEL_MM"
22162218
KBUILD_DIR="/usr/lib/linux-kbuild-${KERNEL_MM}"
2219+
# Check if this directory exists, otherwise try looking in /usr/src
2220+
# This is for openSUSE compatibility
2221+
if [ ! -d "$KBUILD_DIR" ]; then
2222+
KERNEL_VER=$( uname -r | cut -d'-' -f1-2)
2223+
printf "No build directory found in /usr/lib, checking /usr/src for ${KERNEL_VER}...\n"
2224+
KBUILD_DIR="/usr/src/linux-${KERNEL_VER}"
2225+
fi
22172226
if [ -d "$KBUILD_DIR" ]; then
22182227
MODFINAL_FILE="${KBUILD_DIR}/scripts/Makefile.modfinal"
22192228
if [ -f "$MODFINAL_FILE" ]; then
@@ -4214,6 +4223,10 @@ elif [ "$cmd" = "install" ]; then
42144223
if [ "$CHAN_DAHDI" = "1" ]; then
42154224
echog "Note that DAHDI was installed and requires a reboot (or hotswap of kernel modules, e.g. phreaknet restart) before it can be used."
42164225
echog "Note that you will need to manually configure /etc/dahdi/system.conf appropriately for your spans."
4226+
if [ "$PAC_MAN" = "zypper" ]; then
4227+
echog "Additionally, since you appear to be using openSUSE/SUSE Linux Enterprise, you will need to enable the loading of unsupported kernel modules."
4228+
echog "See https://support.scc.suse.com/s/kb/Enable-loading-of-unsupported-kernel-modules for details on how to do this."
4229+
fi
42174230
fi
42184231
if [ "$FREEPBX_GUI" = "1" ]; then
42194232
printf "%s\n" "Installation of FreePBX GUI will begin in 5 seconds..."

0 commit comments

Comments
 (0)