From a61e03de09266af48dc402d231d5f68509a63587 Mon Sep 17 00:00:00 2001 From: devel Date: Sat, 5 Dec 2020 17:57:35 -0800 Subject: [PATCH] Release samba-3.6.25-2 * Adds winbindd to symlinked binaries * Fix deb install to run ldconfig to updated lib cache * Fix deb removal to run ldconfig before starting old daemon --- samba-3.6.25/README | 6 ++++-- samba-3.6.25/SAMBA36/SAMBA36.xml | 2 +- samba-3.6.25/SAMBA36/SAMBA36_AVAILABLE.xml | 4 ++-- samba-3.6.25/SAMBA36/SAMBA36_CURRENT.xml | 4 ++-- samba-3.6.25/SAMBA36/addons.conf | 2 +- samba-3.6.25/SAMBA36/running.sh | 1 + samba-3.6.25/SAMBA36/start.sh | 2 ++ samba-3.6.25/SAMBA36/stop.sh | 1 + samba-3.6.25/samba36-addon/DEBIAN/control | 2 +- samba-3.6.25/samba36-addon/DEBIAN/postinst | 21 ++++++++++++++------- samba-3.6.25/samba36-addon/DEBIAN/postrm | 16 ++++++++++++++++ samba-3.6.25/samba36-addon/DEBIAN/prerm | 12 +++++++++--- 12 files changed, 54 insertions(+), 19 deletions(-) create mode 100755 samba-3.6.25/samba36-addon/DEBIAN/postrm diff --git a/samba-3.6.25/README b/samba-3.6.25/README index abb5941..1988b0b 100644 --- a/samba-3.6.25/README +++ b/samba-3.6.25/README @@ -19,8 +19,8 @@ results), and then supplied to the build in a config.cache file. The configure parameters were chosen to provide as much of a "drop-in" replacement for the existing Samba server as possible, so that the existing Frontview config files could be used. -As configured, only the smbd/nmbd binaries need to be replaced. All -other libraries and dependencies are located under /usr/local. +As configured, only the smbd/nmbd/winbindd binaries need to be replaced. +All other libraries and dependencies are located under /usr/local. The full configuration used for the Samba compilation are located in ../scripts/mods/samba3.mod and built with ../scripts/build @@ -30,8 +30,10 @@ then just replace the original binaries in /usr/sbin (as root): mv /usr/sbin/smbd /usr/sbin/smbd.orig mv /usr/sbin/nmbd /usr/sbin/nmbd.orig +mv /usr/sbin/winbind /usr/sbin/winbindd.orig ln -s /usr/local/sbin/smbd /usr/sbin/smbd ln -s /usr/local/sbin/nmbd /usr/sbin/nmbd +ln -s /usr/local/sbin/winbindd /usr/sbin/winbindd and then restart the server: diff --git a/samba-3.6.25/SAMBA36/SAMBA36.xml b/samba-3.6.25/SAMBA36/SAMBA36.xml index 5351ac1..6faccb8 100644 --- a/samba-3.6.25/SAMBA36/SAMBA36.xml +++ b/samba-3.6.25/SAMBA36/SAMBA36.xml @@ -2,7 +2,7 @@ SAMBA36 Samba 36 - 3.6.25-1 + 3.6.25-2 https://github.com/sshambar/readynas-arm/ Scott Shambarger SAMBA36_HANDLER.pl diff --git a/samba-3.6.25/SAMBA36/SAMBA36_AVAILABLE.xml b/samba-3.6.25/SAMBA36/SAMBA36_AVAILABLE.xml index 4c7ffa0..50daa03 100644 --- a/samba-3.6.25/SAMBA36/SAMBA36_AVAILABLE.xml +++ b/samba-3.6.25/SAMBA36/SAMBA36_AVAILABLE.xml @@ -1,7 +1,7 @@ SAMBA36 Samba 36 - 3.6.25-1 + 3.6.25-2 Scott Shambarger @@ -9,7 +9,7 @@ https://github.com/sshambar/readynas-arm/ - https://github.com/sshambar/readynas-arm/releases/download/Samba36-3.6.25-1/Samba36_3.6.25-1.bin + https://github.com/sshambar/readynas-arm/releases/download/Samba36-3.6.25-2/Samba36_3.6.25-2.bin https://github.com/sshambar/readynas-arm/releases/download/samba-addon/SAMBA36.jpg 5.3.1 diff --git a/samba-3.6.25/SAMBA36/SAMBA36_CURRENT.xml b/samba-3.6.25/SAMBA36/SAMBA36_CURRENT.xml index 0f7365e..dedd648 100644 --- a/samba-3.6.25/SAMBA36/SAMBA36_CURRENT.xml +++ b/samba-3.6.25/SAMBA36/SAMBA36_CURRENT.xml @@ -1,7 +1,7 @@ - 3.6.25-1 - https://github.com/sshambar/readynas-arm/releases/download/Samba36-3.6.25-1/Samba36_3.6.25-1.bin + 3.6.25-2 + https://github.com/sshambar/readynas-arm/releases/download/Samba36-3.6.25-2/Samba36_3.6.25-2.bin diff --git a/samba-3.6.25/SAMBA36/addons.conf b/samba-3.6.25/SAMBA36/addons.conf index 63adb6f..9259265 100644 --- a/samba-3.6.25/SAMBA36/addons.conf +++ b/samba-3.6.25/SAMBA36/addons.conf @@ -1 +1 @@ -SAMBA36!!Samba 36!!3.6.25-1!!/etc/frontview/addons/bin/SAMBA36/start.sh!!/etc/frontview/addons/bin/SAMBA36/stop.sh!!Other!!current_url==https://github.com/sshambar/readynas-arm/releases/download/samba-addon/SAMBA36_CURRENT.xml::detail_url==https://github.com/sshambar/readynas-arm/ +SAMBA36!!Samba 36!!3.6.25-2!!/etc/frontview/addons/bin/SAMBA36/start.sh!!/etc/frontview/addons/bin/SAMBA36/stop.sh!!Other!!current_url==https://github.com/sshambar/readynas-arm/releases/download/samba-addon/SAMBA36_CURRENT.xml::detail_url==https://github.com/sshambar/readynas-arm/ diff --git a/samba-3.6.25/SAMBA36/running.sh b/samba-3.6.25/SAMBA36/running.sh index 25476f0..8389703 100755 --- a/samba-3.6.25/SAMBA36/running.sh +++ b/samba-3.6.25/SAMBA36/running.sh @@ -15,6 +15,7 @@ check_symlink() { check_symlink /usr/local/sbin/smbd /usr/sbin/smbd check_symlink /usr/local/sbin/nmbd /usr/sbin/nmbd +check_symlink /usr/local/sbin/winbindd /usr/sbin/winbindd [ -z "$HAS_SYMLINK" ] && exit 1 diff --git a/samba-3.6.25/SAMBA36/start.sh b/samba-3.6.25/SAMBA36/start.sh index 2be7a6d..70a7e9d 100755 --- a/samba-3.6.25/SAMBA36/start.sh +++ b/samba-3.6.25/SAMBA36/start.sh @@ -30,9 +30,11 @@ set_symlink() { backup_file /usr/sbin/smbd backup_file /usr/sbin/nmbd +backup_file /usr/sbin/winbindd set_symlink /usr/local/sbin/smbd /usr/sbin/smbd set_symlink /usr/local/sbin/nmbd /usr/sbin/nmbd +set_symlink /usr/local/sbin/winbindd /usr/sbin/winbindd SMB2=$(grep "^${SERVICE}_SMB2=" /etc/default/services | sed "s/^${SERVICE}_SMB2=//") [ -z "$SMB2" ] && SMB2=1 || : diff --git a/samba-3.6.25/SAMBA36/stop.sh b/samba-3.6.25/SAMBA36/stop.sh index 513a006..2c76025 100755 --- a/samba-3.6.25/SAMBA36/stop.sh +++ b/samba-3.6.25/SAMBA36/stop.sh @@ -30,6 +30,7 @@ if ! [ "$ENABLED" = 1 ]; then remove_symlink /usr/local/sbin/smbd /usr/sbin/smbd remove_symlink /usr/local/sbin/nmbd /usr/sbin/nmbd + remove_symlink /usr/local/sbin/winbindd /usr/sbin/winbindd if grep -qs "^include = $SAMBA_ADDON_HOME/${SERVICE}.conf" $SAMBA_ADDON_HOME/addons.conf; then sed -i "/^include = ${SAMBA_ADDON_HOME//\//\/}\/${SERVICE}.conf/d" $SAMBA_ADDON_HOME/addons.conf diff --git a/samba-3.6.25/samba36-addon/DEBIAN/control b/samba-3.6.25/samba36-addon/DEBIAN/control index cba8b17..d11d4fb 100644 --- a/samba-3.6.25/samba36-addon/DEBIAN/control +++ b/samba-3.6.25/samba36-addon/DEBIAN/control @@ -3,7 +3,7 @@ Priority: extra Section: checkinstall Maintainer: Scott Shambarger Architecture: armel -Version: 3.6.25-1 +Version: 3.6.25-2 Depends: samba-common Description: Alternative Samba Suite for ReadyNAS Provides an alternative Samba Suite installed in /usr/local that diff --git a/samba-3.6.25/samba36-addon/DEBIAN/postinst b/samba-3.6.25/samba36-addon/DEBIAN/postinst index 0b705ee..dc43eeb 100755 --- a/samba-3.6.25/samba36-addon/DEBIAN/postinst +++ b/samba-3.6.25/samba36-addon/DEBIAN/postinst @@ -9,22 +9,29 @@ backup_file() { [ -f $file -a ! -f ${file}.orig ] && cp -a $file ${file}.orig || : } +symlink_bin() { + file=$1 + rm -f "/usr/sbin/$file" + ln -s "/usr/local/sbin/$file" "/usr/sbin/$file" +} + backup_file /usr/sbin/smbd backup_file /usr/sbin/nmbd +backup_file /usr/sbin/winbindd # DISABLE_ACTIVATION skips symlink/restart on install if [ -z "$DISABLE_ACTIVATION" ]; then - # create symlink to new smbd - rm -f /usr/sbin/smbd - ln -s /usr/local/sbin/smbd /usr/sbin/smbd - - # create symlink to new nmbd - rm -f /usr/sbin/nmbd - ln -s /usr/local/sbin/nmbd /usr/sbin/nmbd + # create symlink to new binaries + symlink_bin smbd + symlink_bin nmbd + symlink_bin winbindd # restart server if running /etc/init.d/samba status &>/dev/null && /etc/init.d/samba restart || : fi +# rebuild ld.so.cache (ignore errors) +/sbin/ldconfig || : + exit 0 diff --git a/samba-3.6.25/samba36-addon/DEBIAN/postrm b/samba-3.6.25/samba36-addon/DEBIAN/postrm new file mode 100755 index 0000000..03b3c08 --- /dev/null +++ b/samba-3.6.25/samba36-addon/DEBIAN/postrm @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +[ "$1" = remove ] || exit 0 + +# update ld.so.cache (so old libraries are removed) +/sbin/ldconfig || : + +if [ -f /tmp/samba36-addon.start ]; then + /etc/init.d/samba start || : +fi + +rm -f /tmp/samba36-addon.start + +exit 0 diff --git a/samba-3.6.25/samba36-addon/DEBIAN/prerm b/samba-3.6.25/samba36-addon/DEBIAN/prerm index d57e5a3..6a6ec3f 100755 --- a/samba-3.6.25/samba36-addon/DEBIAN/prerm +++ b/samba-3.6.25/samba36-addon/DEBIAN/prerm @@ -21,11 +21,17 @@ remove_symlink() { remove_symlink /usr/local/sbin/smbd /usr/sbin/smbd remove_symlink /usr/local/sbin/nmbd /usr/sbin/nmbd +remove_symlink /usr/local/sbin/winbindd /usr/sbin/winbindd -# restart if changes +# stop daemon if changes if [ -n "$RESTART" ]; then - [ -n "$STOP" ] && ACTION=stop || ACTION=restart - /etc/init.d/samba status &>/dev/null && /etc/init.d/samba $ACTION || : + if /etc/init.d/samba status &>/dev/null; then + /etc/init.d/samba stop || : + # flag postrm to start samba if old binaries were restored + [ -n "$STOP" ] && rm -f /tmp/samba36-addon.start || touch /tmp/samba36-addon.start + else + rm -f /tmp/samba36-addon.start + fi fi exit 0