summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO92
-rw-r--r--PKGBUILD530
-rwxr-xr-xautorebuild-dgrp.sh74
-rw-r--r--dgrp-install.sh44
-rw-r--r--dgrp-patch-signal_pending-kernel-4-11.patch39
-rwxr-xr-xdrpadmin435
6 files changed, 752 insertions, 462 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 22c9ca768c67..dc58bf05463e 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,38 +1,94 @@
# Generated by mksrcinfo v8
-# Thu Mar 17 20:33:42 UTC 2016
+# Thu Jul 6 01:37:47 UTC 2017
pkgbase = dgrp
- pkgdesc = tty driver for Digi RealPort Connect EtherLite Flex One CM PortServer IBM RAN
- pkgver = 1.9.36
+ pkgdesc = tty driver for Digi RealPort ConnectPort EtherLite Flex One CM PortServer TS IBM RAN serial console terminal servers
+ pkgver = 1.9.37
pkgrel = 1
- url = http://www.digi.com/
+ url = https://www.digi.com/
install = dgrp-install.sh
arch = i686
arch = x86_64
license = GPL
license = custom
- makedepends = linux-headers
- depends = openssl
+ depends = openssl-1.0
depends = grep
depends = awk
depends = systemd
- optdepends = tcl: Digi config manager in X
- optdepends = tk: Digi config manager in X
+ depends = procps-ng
+ depends = psmisc
+ depends = perl
+ depends = linux
+ depends = dkms
+ depends = linux-headers
+ optdepends = tk: Digi RealPort Manager GUI
+ optdepends = gksu: Digi RealPort Manager GUI
+ optdepends = java-runtime: Digi Device Discovery Tool GUI
+ optdepends = mbrowse: SNMP browser GUI
options = !docs
options = !emptydirs
backup = etc/dgrp.backing.store
- source = dgrp-1.9.36-81000137_X.tgz::http://ftp1.digi.com/support/driver/81000137_X.tgz
+ source = dgrp-1.9.37-beta.tgz::ftp://ftp1.digi.com/support/driver/RealPort%20Linux%20Beta%20Driver/dgrp-1.9-37_y1p.tgz.rpm
source = drpadmin
source = drpadmin.1
- source = autorebuild-dgrp.sh
- sha256sums = a6f39d6034960162a9df8cb979a76daa55559ceb9c4e24a68df74773374a78c0
- sha256sums = 1ab0ccdc361760ae078f9b69f603e99b40849cdf97ad69bb028ad6af27012634
+ source = addp_perl-1.0.tgz::https://github.com/severach/addp/archive/f92a6fd2050c9f32a5a11cac18cd9def78138530.tar.gz
+ source = ftp://ftp1.digi.com/support/utilities/AddpClient.zip
+ source = dgrp-patch-signal_pending-kernel-4-11.patch
+ source = http://ftp1.digi.com/support/utilities/40002014_a.mib
+ source = http://ftp1.digi.com/support/utilities/40002194_H.mib
+ source = http://ftp1.digi.com/support/utilities/40002195_P.mib
+ source = http://ftp1.digi.com/support/utilities/40002236_b.mib
+ source = http://ftp1.digi.com/support/utilities/40002237_c.mib
+ source = http://ftp1.digi.com/support/utilities/40002238_b.mib
+ source = http://ftp1.digi.com/support/utilities/40002239_B.mib
+ source = http://ftp1.digi.com/support/utilities/40002240_B.mib
+ source = http://ftp1.digi.com/support/utilities/40002257_B.mib
+ source = http://ftp1.digi.com/support/utilities/40002258_B.mib
+ source = http://ftp1.digi.com/support/utilities/40002335_B.mib
+ source = http://ftp1.digi.com/support/utilities/40002336_C.mib
+ source = http://ftp1.digi.com/support/utilities/40002337_D.mib
+ source = http://ftp1.digi.com/support/utilities/40002338_D.mib
+ source = http://ftp1.digi.com/support/utilities/40002339_D.mib
+ source = http://ftp1.digi.com/support/utilities/40002410_a.mib
+ source = http://ftp1.digi.com/support/utilities/40002411_a.mib
+ source = http://ftp1.digi.com/support/utilities/40002478_B.mib
+ source = http://ftp1.digi.com/support/utilities/40002479_F.mib
+ source = http://ftp1.digi.com/support/utilities/40002514_a.mib
+ source = http://ftp1.digi.com/support/utilities/40002515_a.mib
+ source = http://ftp1.digi.com/support/utilities/40002520_a.mib
+ source = http://ftp1.digi.com/support/utilities/40002709_C.mib
+ source = http://ftp1.digi.com/support/utilities/rfc1316.mib
+ source = http://ftp1.digi.com/support/utilities/rfc1317.mib
+ sha256sums = 05bcb03f9da28ef45a684d566c0d12694e7a2cb133a43d4c9ed2a71c84df3201
+ sha256sums = 42898b9d24262de27e9b1f3067d51d01373810b7c9e4991403a7f0a5dd7a26cf
sha256sums = 66f8b106a052b4807513ace92978e5e6347cef08eee39e4b4ae31c60284cc0a3
- sha256sums = 4d9ae1a36fe044f78c96358e13f8e0ed0dcd49ca056b67f3d6c7e5360408617e
+ sha256sums = 9d79df8617e2bb1042a4b7d34311e73dc4afcdfe4dfa66703455ff54512427f5
+ sha256sums = 00d7b452a4f16599f7162f512a05599614115554992b872fc5302b521ea04468
+ sha256sums = 83c90a2a9518fde5f500f336a181e86662b62065929bedd60fbd380dc2f4a9da
+ sha256sums = 4b54148008b02a2544d8b33f07c471a068b0973ac5402967af8bf73a28b6a8b6
+ sha256sums = a1833d877b07b0f424676241b3e1070e116d07965db3131a61a3b6ce0ff90063
+ sha256sums = 6fca5df11304d905f561a0c251419619960a8da8e724d36b34e9977e97f02528
+ sha256sums = 2dd7868acf66c14d67012a2263088b08d8f9320c64b64db94740fae54b485c78
+ sha256sums = 26159071b1b0df2af04d612e32ce72c8835f241c56b9fa2dadee53d9d127d0b7
+ sha256sums = f686011f7db06f0632f6460566da751a00fccd04bb1527b8a83239aad46d4de5
+ sha256sums = 50130240e3ce85759aa99b3a268568de6a97084eeb40a92ef0b4937333808d8a
+ sha256sums = f4a89790ad1413ecfc2b723a45fa0d0b93ae01cc433d930db4e689f82d0367fd
+ sha256sums = 3e2881ebf6866751a64e7cf948b85a3c2053f2d0a8799234c56b732cde17b853
+ sha256sums = c54576fad5ccedfd50cebc22a6dd45bd8c4deb875282f5c7d1a89a33426c1746
+ sha256sums = 08eecc0e5d8f9fffe0fcf3b9f47e56c81bd713964bd7aeb0f4b6a6de3e0f3592
+ sha256sums = 75ba60917769c2cc2324050b74a4e618f0904464ece15646045fd931001c47e4
+ sha256sums = 43e7f12bb32343254f472260fd26566e8aab58764ba3e73d500542e462f27ac5
+ sha256sums = 241ef4a96b4d34652bfc7a9ce0bab317129e0123f05c68713a45d88624ddd19b
+ sha256sums = 21b8d7c50cacc418611b909159ed6258dc13026e8e55034e86965227b8176509
+ sha256sums = 471f1342398c4fce86e1d437c4f6053be75ae3a99337613d39c05e4e3c80ede9
+ sha256sums = 06a81a5dfaa1c61944d1a12d2efc8129c0ee72f630817f844879bd17d6cb4d80
+ sha256sums = a3286df00ca3566361faf1f128752c56d046558277cd90025831f9840129e33f
+ sha256sums = 33b29ee72b590ecadd54e893317a279bb49a2dd4a189fd386491e1a67ef193a8
+ sha256sums = 4011005db626db67b50f13b6242db1fed0d11b0d89e56af7ae39f5719d7cd323
+ sha256sums = 679b081c31e5fc156ad9c55afc0bba9ec354f37e28eeeb453bcbd6b1cf68988e
+ sha256sums = 731e05fc551367faa6ad5dc317eedf305388ab12db196c0a1361a3d01bd35279
+ sha256sums = c471cafa43503a40d43b42acd8bc6ef49db29e55a74e0494c85f729ea45fe243
+ sha256sums = 5cac7ce2e6f043127f314b93694af021ae7820ffb5bf3de343da7a240d05e9c8
+ sha256sums = 8654496d83c083e457e8bb9bae2b1e71804d156a38c284d89872d0125eba947d
pkgname = dgrp
- depends = openssl
- depends = grep
- depends = awk
- depends = systemd
- depends = linux
diff --git a/PKGBUILD b/PKGBUILD
index ba2f05eaa21e..c6b76ad8748a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,11 +1,15 @@
-#!/bin/false
# Maintainer: Chris Severance aur.severach aATt spamgourmet dott com
-# Category: system
+# Todo: rewrite dgrp_cfg_node to be systemd compatible.
# Todo: add systemd getty support to drpadmin
-# Todo: Fix autorebuild for multiple users with sudo chown
-# Todo: Fix ttyaa-ttyaa text in drpadmin
+# Todo: Default user, group, and mode are in the backing store. These do not work. They are set by udev and apply to all ports.
# Digi bug: terminal freezes when viewing /proc/dgrp/mon
+# Digi bug: drpd terminates after the first tty open when launched from dgrp_cfg_node. It stays working when launched by systemd restart
+# Digi bug: occasional Can't open serial /dev/ttyaf00: Resource temporarily unavailable for PortServer TS (not II)
+# Digi bug: occasional dropped characters for PortServer II, PortServer TS, Digi One
+# Digi bug: Digi RealPort Manager (java) is unable to add new Realport because it uses the wrong options
+# Digi bug: mbrowse reports a few parsing errors in MIB
+# Digi bug: make compatible with OpenSSL 1.1
# Digi Realport driver for Arch Linux. See Digi release notes for supported products.
@@ -27,25 +31,24 @@
# The next section: ... Now onto the real install ...
# Edit PKGBUILD.local after the first run
-[ ! -s 'PKGBUILD.local' ] && cat > 'PKGBUILD.local' << EOF
+if [ ! -s 'PKGBUILD.local' ]; then
+ cat > 'PKGBUILD.local' << EOF
# Set the mode for all created devices.
-_opt_defaultmode="0600" # default: 0600
+_opt_defaultmode="0660" # default: 0600
+_opt_defaultgroup="uucp" # default: root
# If you need more granular control.
-# See http://www.digi.com/support/kbase/kbaseresultdetl?id=3048
+# See http://knowledge.digi.com/articles/Knowledge_Base_Article/HOW-TO-Preserve-device-permissions-settings-with-RealPort-in-Linux/
# Once set copy /etc/udev/rules.d/10-dgrp.rules to the PKGBUILD folder
# and it will be made into the package.
-_opt_LocktoKernel=1 # Default 1
-# 1=Automatic uninstall on every kernel upgrade. Use supplied AutoRebuild to reinstall on next login.
-# 0=Allow kernel upgrades without removing dgrp. Use supplied AutoRebuild to update on next login.
-
# Digi's product name is inconsistent. Here you can choose. RealPort seems the most popular.
_opt_RealPort='RealPort' # Can also be Realport
+
+_opt_DKMS=1 # This can be toggled between installs
EOF
+fi
source 'PKGBUILD.local'
-# Recommended build command: makepkg -sCcfi
-
# Since the kernel module isn't loaded until you have a device
# configured, these services are automatically enabled and started
# for immediate hardware support. They will be reenabled each time the
@@ -76,8 +79,11 @@ source 'PKGBUILD.local'
# It is adapted from Digi's RealPort "drpadmin" for Sun, HP UX, and SCO and has the same
# look and feel.
+# Show available Digi devices
+# addp.pl -Q
+
# For information about using dgrp_ditty.service to maintain your ditty settings
-# across reboots see http://www.digi.com/support/kbase/kbaseresultdetl?id=904
+# across reboots see http://knowledge.digi.com/articles/Knowledge_Base_Article/How-do-I-configure-my-ditty-rp-port-settings-to-stay-after-rebooting-when-using-RealPort-in-Linux/
# UnInstall cleanup:
# rm /etc/dgrp.backing.store* /usr/bin/dgrp/config/ditty.commands
@@ -86,83 +92,249 @@ source 'PKGBUILD.local'
set -u
pkgname='dgrp'
-pkgver='1.9.36'
+pkgver='1.9.37'
pkgrel='1'
-pkgdesc="tty driver for Digi ${_opt_RealPort} Connect EtherLite Flex One CM PortServer IBM RAN"
+pkgdesc="tty driver for Digi ${_opt_RealPort} ConnectPort EtherLite Flex One CM PortServer TS IBM RAN serial console terminal servers"
#_pkgdescshort="Digi ${_opt_RealPort} driver for Ethernet serial servers" # For when we used to generate the autorebuild from here
arch=('i686' 'x86_64')
-url='http://www.digi.com/'
+url='https://www.digi.com/'
license=('GPL' 'custom') # OpenSSL=Apache. Arch is always new enough to not need their version.
-depends=('openssl' 'grep' 'awk' 'systemd')
-optdepends=('tcl: Digi config manager in X' 'tk: Digi config manager in X')
-makedepends=('linux-headers')
+depends=('openssl-1.0' 'grep' 'awk' 'systemd' 'procps-ng' 'psmisc' 'perl')
+optdepends=(
+ {tk,gksu}': Digi RealPort Manager GUI'
+ 'java-runtime: Digi Device Discovery Tool GUI'
+ 'mbrowse: SNMP browser GUI'
+)
backup=('etc/dgrp.backing.store')
options=('!docs' '!emptydirs')
install="${pkgname}-install.sh"
-_verwatch=('http://www.digi.com/support/includes/drivers.aspx?pid=2240&osvid=218' 'Realport Driver for Linux ver\. \([0-9\.]\+\), tgz version' 't')
-source=("${pkgname}-${pkgver}-81000137_X.tgz::http://ftp1.digi.com/support/driver/81000137_X.tgz" 'drpadmin' 'drpadmin.1' "autorebuild-${pkgname}.sh")
-sha256sums=('a6f39d6034960162a9df8cb979a76daa55559ceb9c4e24a68df74773374a78c0'
- '1ab0ccdc361760ae078f9b69f603e99b40849cdf97ad69bb028ad6af27012634'
+_verwatch=('https://www.digi.com/support/includes/drivers.aspx?pid=1954&osvid=218' '<li>.*RealPort Driver for Linux ver\. \([0-9\.]\+\), tgz version.*' 'f')
+_mibs=(
+ '40002014_a.mib' # DIGI Connectware Manager Notifications
+ '40002194_H.mib' # Portserver TS MIB File
+ '40002195_P.mib' # Digi Structures of Management (SMI) MIB
+ '40002236_b.mib' # Digi MODBUS MIB
+ '40002237_c.mib' # Digi Power Supply MIB
+ '40002238_b.mib' # Digi Multi-Electrical Interface (MEI) MIB
+ '40002239_B.mib' # Digi Socket ID MIB File
+ '40002240_B.mib' # Portserver TS Port Buffering MIB File
+ '40002257_B.mib' # Digi IA MIB
+ '40002258_B.mib' # Digi UDP Serial MIB
+ '40002335_B.mib' # Portserver TS Secure Access MIB File
+ '40002336_C.mib' # Digi Power Management MIB File
+ '40002337_D.mib' # Digi Power Management Traps MIB
+ '40002338_D.mib' # Digi Keyword Notification MIB
+ '40002339_D.mib' # Digi Login Traps MIB
+ '40002410_a.mib' # DIGI Connect Device Info Management Information Base
+ '40002411_a.mib' # Digi Connect Serial Alarm Traps MIB
+ '40002478_B.mib' # Digi NFS TRAPS MIB
+ '40002479_F.mib' # CM Management Information Base
+ '40002514_a.mib' # Digi Connectware Manager Notifications MIB
+ '40002515_a.mib' # Digi Connect Device Identity MIB
+ '40002520_a.mib' # Digi Power Traps MIB
+ '40002709_C.mib' # Digi ConnectPort LTS MIB
+ 'rfc1316.mib' # Portserver II RFC1316-MIB Definitions
+ 'rfc1317.mib' # Portserver II RFC1317-MIB Definitions
+)
+# Let me know if these dnw (do not want) items are actually serial device servers and should be installed.
+_mibsdnw=(
+ '40002325_D.mib' # DIGI Wireless Lan Management Information Base
+ '40002370_C.mib' # DIGI Serial Traps Management Information Base
+ '40002436_B.mib' # DIGI Modem Test Traps Management Information Base
+ '40002477_B.mib' # Management Information Base
+ '40002519_F.mib' # Passport Management Information Base
+ '40002521_a.mib' # DIGI IPMI Notification Feature Management Information Base
+ '40002593_B.mib' # DIGI Connect Mobile Information Management Information Base
+ '40002594_a.mib' # DIGI Mobile Traps Management Information Base
+ '40002782_a.mib' # Passport Management Information Base
+ '40002846_A.mib' # DIGI Connect Mobile Status Management Information Base
+)
+_mibsrc='http://ftp1.digi.com/support/utilities/'
+_filever="${pkgver//\./-}"
+_filever="${_filever/-/.}"
+source=(
+ #"${pkgname}-${pkgver}-81000137_X.tgz::http://ftp1.digi.com/support/driver/81000137_X.tgz"
+ "${pkgname}-${pkgver}-beta.tgz::ftp://ftp1.digi.com/support/driver/RealPort%20Linux%20Beta%20Driver/dgrp-${_filever}_y1p.tgz.rpm"
+ 'drpadmin' 'drpadmin.1' # "autorebuild-${pkgname}.sh"
+ 'addp_perl-1.0.tgz::https://github.com/severach/addp/archive/f92a6fd2050c9f32a5a11cac18cd9def78138530.tar.gz'
+ 'ftp://ftp1.digi.com/support/utilities/AddpClient.zip'
+ 'dgrp-patch-signal_pending-kernel-4-11.patch'
+ "${_mibs[@]/#/${_mibsrc}}"
+)
+unset _mibsrc
+#source_i686=('http://ftp1.digi.com/support/utilities/40002890_A.tgz')
+#source_x86_64=('http://ftp1.digi.com/support/utilities/40002889_A.tgz') # compiled i686 therefore worthless
+# addp and sddp are incomplete. I replaced them with addp.pl
+sha256sums=('05bcb03f9da28ef45a684d566c0d12694e7a2cb133a43d4c9ed2a71c84df3201'
+ '42898b9d24262de27e9b1f3067d51d01373810b7c9e4991403a7f0a5dd7a26cf'
'66f8b106a052b4807513ace92978e5e6347cef08eee39e4b4ae31c60284cc0a3'
- '4d9ae1a36fe044f78c96358e13f8e0ed0dcd49ca056b67f3d6c7e5360408617e')
+ '9d79df8617e2bb1042a4b7d34311e73dc4afcdfe4dfa66703455ff54512427f5'
+ '00d7b452a4f16599f7162f512a05599614115554992b872fc5302b521ea04468'
+ '83c90a2a9518fde5f500f336a181e86662b62065929bedd60fbd380dc2f4a9da'
+ '4b54148008b02a2544d8b33f07c471a068b0973ac5402967af8bf73a28b6a8b6'
+ 'a1833d877b07b0f424676241b3e1070e116d07965db3131a61a3b6ce0ff90063'
+ '6fca5df11304d905f561a0c251419619960a8da8e724d36b34e9977e97f02528'
+ '2dd7868acf66c14d67012a2263088b08d8f9320c64b64db94740fae54b485c78'
+ '26159071b1b0df2af04d612e32ce72c8835f241c56b9fa2dadee53d9d127d0b7'
+ 'f686011f7db06f0632f6460566da751a00fccd04bb1527b8a83239aad46d4de5'
+ '50130240e3ce85759aa99b3a268568de6a97084eeb40a92ef0b4937333808d8a'
+ 'f4a89790ad1413ecfc2b723a45fa0d0b93ae01cc433d930db4e689f82d0367fd'
+ '3e2881ebf6866751a64e7cf948b85a3c2053f2d0a8799234c56b732cde17b853'
+ 'c54576fad5ccedfd50cebc22a6dd45bd8c4deb875282f5c7d1a89a33426c1746'
+ '08eecc0e5d8f9fffe0fcf3b9f47e56c81bd713964bd7aeb0f4b6a6de3e0f3592'
+ '75ba60917769c2cc2324050b74a4e618f0904464ece15646045fd931001c47e4'
+ '43e7f12bb32343254f472260fd26566e8aab58764ba3e73d500542e462f27ac5'
+ '241ef4a96b4d34652bfc7a9ce0bab317129e0123f05c68713a45d88624ddd19b'
+ '21b8d7c50cacc418611b909159ed6258dc13026e8e55034e86965227b8176509'
+ '471f1342398c4fce86e1d437c4f6053be75ae3a99337613d39c05e4e3c80ede9'
+ '06a81a5dfaa1c61944d1a12d2efc8129c0ee72f630817f844879bd17d6cb4d80'
+ 'a3286df00ca3566361faf1f128752c56d046558277cd90025831f9840129e33f'
+ '33b29ee72b590ecadd54e893317a279bb49a2dd4a189fd386491e1a67ef193a8'
+ '4011005db626db67b50f13b6242db1fed0d11b0d89e56af7ae39f5719d7cd323'
+ '679b081c31e5fc156ad9c55afc0bba9ec354f37e28eeeb453bcbd6b1cf68988e'
+ '731e05fc551367faa6ad5dc317eedf305388ab12db196c0a1361a3d01bd35279'
+ 'c471cafa43503a40d43b42acd8bc6ef49db29e55a74e0494c85f729ea45fe243'
+ '5cac7ce2e6f043127f314b93694af021ae7820ffb5bf3de343da7a240d05e9c8'
+ '8654496d83c083e457e8bb9bae2b1e71804d156a38c284d89872d0125eba947d')
+
+if [ "${_opt_DKMS}" -ne 0 ]; then
+ depends+=('linux' 'dkms' 'linux-headers')
+else
+ makedepends+=('linux-headers')
+fi
+
+# Check for updates and case errors to the 2 mib lists
+_fn_mibcheck() {
+ echo 'Checking for newer and misnamed MIB'
+ local line
+ local linea
+ local file='/tmp/PKGBUILD.mibs'
+ # Get list of files
+ while IFS='' read -r line || [[ -n "${line}" ]]; do
+ read -r -a linea <<<"${line}"
+ line="${linea[8]}" # filename
+ case "${line}" in
+ 4000*.mib)
+ echo "${line}" >> "${file}"
+ ;;
+ esac
+ done < <(curl -s 'ftp://ftp1.digi.com/support/utilities/') # curl is sorted and case insensitive because Digi runs WSFTP. We can't assume this will be always so.
+ # get list of latest files
+ local lineu linep lineup
+ lineup=''
+ linep=''
+ linea=()
+ while IFS='' read -r line || [[ -n "${line}" ]]; do
+ lineu="${line^^}"
+ if [ "${lineup%%_*}" != "${lineu%%_*}" ] && [ ! -z "${linep}" ]; then
+ linea+=("${linep}")
+ fi
+ lineup="${lineu}"
+ linep="${line}"
+ done < <(sort -f "${file}")
+ rm -f "${file}"
+ linea+=("${linep}")
+ # Check against _mibs
+ local found mib mibu
+ for line in "${linea[@]}"; do
+ lineu="${line^^}"
+ found=0
+ for mib in "${_mibs[@]}" "${_mibsdnw[@]}"; do
+ mibu="${mib^^}"
+ if [ "${lineu%%_*}" = "${mibu%%_*}" ]; then
+ if [ "${lineu}" != "${mibu}" ]; then
+ echo "${mib} has been updated to ${line}"
+ elif [ "${line}" != "${mib}" ]; then
+ echo "Case correction: ${mib} -> ${line}"
+ fi
+ found=1
+ break
+ fi
+ done
+ if [ "${found}" -eq 0 ]; then
+ echo "${line} is missing"
+ fi
+ done
+ return 1
+}
+#_fn_mibcheck
+# bash -c 'source PKGBUILD; _fn_mibcheck'
prepare() {
set -u
cd dgrp-*/
+
+ # diff -pNaru5 src.old/dgrp-1.9 src/dgrp-1.9 > 'dgrp-patch-signal_pending-kernel-4-11.patch'
+ patch -Nbup2 < '../dgrp-patch-signal_pending-kernel-4-11.patch'
+
rm -f daemon/openssl-*.tar.gz # I don't want their version to build if OpenSSL version detection fails in the future
+
# Standardize name of RealPort
- sed -i -e "s/RealPort/${_opt_RealPort}/gI" $(grep -lrF $'RealPort\nRealport' .)
+ sed -e "s/RealPort/${_opt_RealPort}/gI" -i $(grep -lrF $'RealPort\nRealport' .)
# grep -ri realport . | grep -vF $'RealPort\nRealport'
- sed -i -e '# Cosmetic fix for gcc v5' \
- -e 's:\(3.9\*|4.\*\))$:\1|5.*):g' \
- -e "# I can't find any other way to fix the modules dir" \
- -e 's:/lib/modules/:/usr&:g' \
- -e '# Kill a harmless mkdir error. They mkdir the folder then dont use it.' \
- -e 's@^\(\s\+\)\(mkdir -p /usr/lib/modules/${osrel}/misc\)$@\1: #\2@g' \
- 'configure'
+ sed -e '# Cosmetic fix for newer gcc compilers' \
+ -e 's:\(3.9\*|4.\*\))$:\1|5.*|6.*|7.*):g' \
+ -e "# I can't find any other way to fix the modules dir" \
+ -e 's:/lib/modules/:/usr&:g' \
+ -e '# Kill a harmless mkdir error. They mkdir the folder then dont use it.' \
+ -e 's@^\(\s\+\)\(mkdir -p /usr/lib/modules/${osrel}/misc\)$@\1: #\2@g' \
+ -i 'configure'
# Eradicate sbin before we even get started
- sed -i -e 's:/usr/sbin:/usr/bin:g' -e 's:/sbin/:/usr/bin/:g' 'configure' Makefile* */Makefile scripts/{preun,post}install
+ sed -e 's:/usr/sbin:/usr/bin:g' -e 's:/sbin/:/usr/bin/:g' -i 'configure' Makefile* */Makefile scripts/{preun,post}install
# Fix the installers. We do in PKBGUILD what we can and the just a little in install.
# cp -p 'scripts/postinstall' 'scripts/postinstall.Arch' # DEBUG for comparison
- sed -i -e '# Some security for root' \
- -e 's:^#!\s*/bin/sh$:&\nif [ "${EUID}" -ne 0 ]; then\n echo "Must be root!"\n exit 1\nfi:g' \
- -e '# Remove Install noise' \
- -e 's:^\(\s*\)\(echo "Running\):\1#\2:g' \
- -e '# Block the usage of chkconfig' \
- -e 's:/usr/bin/chkconfig:/usr/bin/true:g' \
- -e '# Remove noise for defunct chkconfig' \
- -e 's:^\(\s\+\)\(echo "Added\):\1#\2:g' \
- -e '# Automatically bring back pacsave file on reinstall' \
- -e 's:^if \[ -f /etc/dgrp:if [ -s "/etc/dgrp.backing.store.pacsave" -a ! -s "/etc/dgrp.backing.store" ]; then\n mv "/etc/dgrp.backing.store.pacsave" "/etc/dgrp.backing.store"\nfi\n&:g' \
- -e '# No need to upgrade and back up a blank file' \
- -e 's:-f \(/etc/dgrp.backing.store\):-s \1:g' \
- -e '# Why depend on /tmp when we can use the /etc folder which is where admin will be looking to fix their non working hardware' \
- -e 's:/tmp/dgrp/dgrp.backing.store:/etc/dgrp.backing.store:g' \
- -e '# The rest is done in package.' \
- -e 's:^echo "Checking:exit 0\n&:g' \
- -e '# Prepare the links for package to use them' \
- -e 's:^\(\s\+\)ln -s /usr/bin/\([^ ]\+\) \(.\+\)$:\1ln -sf "\2" "${_DESTDIR}\3":g' \
- -e "# All that's left is config conversion" \
- 'scripts/postinstall'
+ sed -e '# Some security for root' \
+ -e 's:^#!\s*/bin/sh$:&\nif [ "${EUID}" -ne 0 ]; then\n echo "Must be root!"\n exit 1\nfi:g' \
+ -e '# Remove Install noise' \
+ -e 's:^\(\s*\)\(echo "Running\):\1#\2:g' \
+ -e '# Block the usage of chkconfig' \
+ -e 's:/usr/bin/chkconfig:/usr/bin/true:g' \
+ -e '# Remove noise for defunct chkconfig' \
+ -e 's:^\(\s\+\)\(echo "Added\):\1#\2:g' \
+ -e '# Automatically bring back pacsave file on reinstall' \
+ -e 's:^if \[ -f /etc/dgrp:if [ -s "/etc/dgrp.backing.store.pacsave" -a ! -s "/etc/dgrp.backing.store" ]; then\n mv "/etc/dgrp.backing.store.pacsave" "/etc/dgrp.backing.store"\nfi\n&:g' \
+ -e '# No need to upgrade and back up a blank file' \
+ -e 's:-f \(/etc/dgrp.backing.store\):-s \1:g' \
+ -e '# Why depend on /tmp when we can use the /etc folder which is where admin will be looking to fix their non working hardware' \
+ -e 's:/tmp/dgrp/dgrp.backing.store:/etc/dgrp.backing.store:g' \
+ -e '# The rest is done in package.' \
+ -e 's:^echo "Checking:exit 0\n&:g' \
+ -e '# Prepare the links for package to use them' \
+ -e 's:^\(\s\+\)ln -s /usr/bin/\([^ ]\+\) \(.\+\)$:\1ln -sf "\2" "${_DESTDIR}\3":g' \
+ -e "# All that's left is config conversion" \
+ -i 'scripts/postinstall'
#cp -p 'scripts/preuninstall' 'scripts/preuninstall.Arch' # For comparison
- sed -i -e '# Some security for root' \
- -e 's:^#!\s*/bin/sh$:&\nif [ "${EUID}" -ne 0 ]; then\n echo "Must be root!"\n exit 1\nfi:g' \
- -e '# Remove UnInstall noise' \
- -e 's:^\(\s*\)\(echo "Running\):\1#\2:g' \
- -e '# Block the usage of chkconfig' \
- -e 's:/usr/bin/chkconfig:/usr/bin/true:g' \
- -e '# Remove more noise' \
- -e 's:^\(\s\+\)\(echo "Removed\):\1#\2:g' \
- -e '# No need to sleep. The daemons are shut down by systemd' \
- -e 's:^sleep :#&:g' \
- -e '# pacman handles the links and files' \
- -e 's;if \[ -L ;if ! : \&\& [ -L ;g' \
- -e 's;^\(\s*\)\(rm -f \);\1: #\2;g' \
- -e '# Fixing this file was almost useless. All it does after we disable everything is an rmmod' \
- 'scripts/preuninstall'
+ sed -e '# Some security for root' \
+ -e 's:^#!\s*/bin/sh$:&\nif [ "${EUID}" -ne 0 ]; then\n echo "Must be root!"\n exit 1\nfi:g' \
+ -e '# Remove UnInstall noise' \
+ -e 's:^\(\s*\)\(echo "Running\):\1#\2:g' \
+ -e '# Block the usage of chkconfig' \
+ -e 's:/usr/bin/chkconfig:/usr/bin/true:g' \
+ -e '# Remove more noise' \
+ -e 's:^\(\s\+\)\(echo "Removed\):\1#\2:g' \
+ -e '# No need to sleep. The daemons are shut down by systemd' \
+ -e 's:^sleep :#&:g' \
+ -e '# pacman handles the links and files' \
+ -e 's;if \[ -L ;if ! : \&\& [ -L ;g' \
+ -e 's;^\(\s*\)\(rm -f \);\1: #\2;g' \
+ -e '# Fixing this file was almost useless. All it does after we disable everything is an rmmod' \
+ -i 'scripts/preuninstall'
test ! -f 'scripts/postinstall.Arch' -a ! -f 'scripts/preuninstall.Arch'
- # this generate a harmless error as it tries to make a folder in /usr/lib/modules...
- ./configure -q --sbindir='/usr/bin' --prefix='/usr' --mandir='/usr/share/man' # the module and DESTDIR-RPM_BUILD_ROOT dirs seem unsettable so are handled elsewhere
+
+ # Change insmod to modprobe
+ sed -e 's:\${INSMOD}.*$:modprobe "${DGRP_DRIVER}" # &:g' -i 'config/dgrp_cfg_node'
+
+ # drpd makefile does not honor --with-ssl-dir. We convert the bogus folder to the one we need.
+ sed -e 's:/usr/local/ssl/include:/usr/include/openssl-1.0:g' \
+ -e 's:/usr/local/ssl/lib:/usr/lib/openssl-1.0:g' \
+ -i 'daemon/Makefile.in'
+
+ # this generates a harmless error as it tries to make a folder in /usr/lib/modules...
+ # --with-ssl-dir supplies to -I but mainly for configure. CFLAGS goes everywhere.
+ # --with-ssl-dir is supplied to -L too which is worthless. We amend with LDFLAGS.
+ CFLAGS="${CFLAGS} -I/usr/include/openssl-1.0" \
+ LDFLAGS="${LDFLAGS} -L/usr/lib/openssl-1.0" \
+ ./configure -q --sbindir='/usr/bin' --prefix='/usr' --mandir='/usr/share/man' --with-ssl-dir='/usr/include/openssl-1.0'
# Produce a "file_locations" that we can pull in here.
#if [ ! -f 'config/file_locations.Arch' ]; then
@@ -175,13 +347,26 @@ prepare() {
# Digi should patch this constant away since whatever it does will eventually not work.
# See https://lkml.org/lkml/2014/10/16/632 [PATCH -next 09/27] tty: Remove TTY_CLOSING - LKML.ORG
# See http://lkml.iu.edu/hypermail/linux/kernel/1411.0/03202.html [PATCH -next v2 09/26] tty: Remove TTY_CLOSING
- cat >> 'driver/build/include/dgrp_net_ops.h' << EOF
+ if [ "$(vercmp "${pkgver}" '1.9.36')" -le 0 ]; then
+ cat >> 'driver/build/include/dgrp_net_ops.h' << EOF
/* patched by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR */
-/* http://aur.archlinux.org/ */
+/* https://aur.archlinux.org/ */
#ifndef TTY_CLOSING
#define TTY_CLOSING (7)
#endif
EOF
+ fi
+
+ # Fix some warnings
+ echo 'int next_baud(int dir);' >> 'dinc/dinc.h'
+ sed -e 's:^exeunt(int code).*:int &:g' -i 'dgipserv/dgipserv.c'
+ sed -e 's:^getcode(dest, src):int &:g' \
+ -e 's:^stprint(str, len):int &:g' \
+ -e 's:^#include <termio\.h>$:&\n#include <term.h>:g' \
+ -i 'ditty/ditty.c'
+ #sed -e 's:^CFLAGS = .*:& -Wno-unused-but-set-variable:g' -i 'ditty/Makefile'
+ sed -e 's:static raw_mdm;:static int raw_mdm;:g' -i 'dinc/dinc_hw.c'
+ sed -e 's:^CPPFLAGS = .*:& -Wno-unused-but-set-variable:g' -i 'Makefile'
set +u
}
@@ -189,46 +374,55 @@ build() {
set -u
cd dgrp-*/
#. 'config/file_locations.Arch'
- make all -s # -j $(nproc) # This package doesn't support threaded make and it's too small to fix
+ make -s all -j1 # This package doesn't support threaded make and it's too small to fix
set +u
}
+# Copy this line into the .install file
_daemons=('daemon' 'ditty')
package() {
set -u
- cd dgrp-*/
- #. 'config/file_locations.Arch'
-
- # I don't want Linux version info showing on AUR web. After a few months 'linux<0.0.0' makes it look like an out of date package.
- local _kernelversionsmall="$(pacman -Q linux)" # this differs from uname -r. pacman: 4.0, uname: 4.0.0
- _kernelversionsmall="${_kernelversionsmall#* }"
- _kernelversionsmall="${_kernelversionsmall%-*}"
- eval 'conf''licts=("linux>${_kernelversionsmall}" "linux<${_kernelversionsmall}")' # prevent the makepkg bash simulator from getting this line!
- if [ "${_opt_LocktoKernel}" -ne 0 ]; then
+ if [ "${_opt_DKMS}" -eq 0 ]; then
+ # I don't want Linux version info showing on AUR web. After a few months 'linux<0.0.0' makes it look like an out of date package.
+ local _kernelversionsmall="$(uname -r)"
+ _kernelversionsmall="${_kernelversionsmall%%-*}"
+ _kernelversionsmall="${_kernelversionsmall%\.0}" # trim 4.0.0 -> 4.0, 4.1.0 -> 4.1
+ # prevent the mksrcinfo bash emulator from getting these vars!
+ eval 'conf''licts=("linux>${_kernelversionsmall}" "linux<${_kernelversionsmall}")'
eval 'dep''ends+=("linux=${_kernelversionsmall}")'
- else
- depends+=('linux') # Prevent installation into Docker
fi
- make -s RPM_BUILD_ROOT="${pkgdir}" install
+ cd dgrp-*/
+ #. 'config/file_locations.Arch'
+
+ make -s -j1 RPM_BUILD_ROOT="${pkgdir}" install
install -m644 'dinc/dinc.1' -t "${pkgdir}/usr/share/man/man1/" # They bypass the Makefile that does this
chmod 644 "${pkgdir}/usr/bin/dgrp/config"/{dgrp.gif,file_locations}
chmod 744 "${pkgdir}/usr/bin/"{dgelreset,dgipserv}
# Create the links, customized for us by prepare above
- _DESTDIR="${pkgdir}" sh -eu <(grep 'ln -sf ' 'scripts/postinstall')
- #rmdir "${pkgdir}/usr/share/doc" # The Arch PKGBUILD does this for us
+ grep 'ln -sf ' 'scripts/postinstall' |\
+ _DESTDIR="${pkgdir}" \
+ sh -e -u -s --
+ #rmdir "${pkgdir}/usr/share/doc" # makepkg does this for us
+
+ # Install MIB
+ local _mib
+ for _mib in "${srcdir}"/*.mib; do
+ install -Dpm0644 "${_mib}" "${pkgdir}/usr/share/snmp/mibs/digi-serial-server-${_mib##*/}.txt"
+ done
# Prepend our message on the udev rules file
install -dm755 "${pkgdir}/etc/udev/rules.d/"
touch "${pkgdir}/${backup[0]}" # postinstall handles the pacsave file automatically
chmod 644 "${pkgdir}/${backup[0]}"
+ sed -e 's:^KERNEL=="cu_dgrp:#&:g' -i "${pkgdir}/tmp/dgrp/10-dgrp.rules" # Recommended by Digi
cat > "${pkgdir}/etc/udev/rules.d/10-dgrp.rules" << EOF
# Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR
-# http://aur.archlinux.org/
+# https://aur.archlinux.org/
-# Generated: `date +"%F %T"`
-# From PKGBUILD in folder: `pwd`
+# Generated: $(date +"%F %T")
+# From PKGBUILD in folder: $(pwd)
# Warning: If you modify this file you should copy it into the folder with the
# PKGBUILD or you might lose the customizations on the next install.
@@ -238,16 +432,16 @@ package() {
# then set the option in the PKGBUILD. If you need more granular control
# see these customization instructions:
-# http://www.digi.com/support/kbase/kbaseresultdetl?id=3048
+# http://knowledge.digi.com/articles/Knowledge_Base_Article/HOW-TO-Preserve-device-permissions-settings-with-RealPort-in-Linux/
# Then copy this file into the folder with PKGBUILD.
$(cat "${pkgdir}/tmp/dgrp/10-dgrp.rules")
EOF
rm -f "${pkgdir}/tmp/dgrp/10-dgrp.rules"
- rmdir "${pkgdir}/tmp/dgrp" "${pkgdir}/tmp" # errors out if other files ever show up in /tmp/dgrp
+ rmdir "${pkgdir}/tmp/dgrp" "${pkgdir}/tmp" # crashes if other files ever show up in /tmp/dgrp
if [ ! -z "${_opt_defaultmode:-}" ]; then
- sed -i -e 's:^\(KERNEL=="tty_dgrp\)\(.*\)$:\1\2, MODE="'"${_opt_defaultmode}"'":g' "${pkgdir}/etc/udev/rules.d/10-dgrp.rules"
+ sed -e 's:^\(KERNEL=="tty_dgrp\)\(.*\)$:\1\2, MODE="'"${_opt_defaultmode}"'", GROUP="'"${_opt_defaultgroup}"'":g' -i "${pkgdir}/etc/udev/rules.d/10-dgrp.rules"
fi
if [ -s "${srcdir}/../10-dgrp.rules" ]; then
cp "${srcdir}/../10-dgrp.rules" "${pkgdir}/etc/udev/rules.d/10-dgrp.rules" # no cp -p in case this file has any wrong user:group
@@ -259,12 +453,12 @@ EOF
rmdir "${pkgdir}/etc/init.d"
# systemd integration.
- install -dm755 "${pkgdir}/usr/lib/systemd/system/"
+ #install -dm755 "${pkgdir}/usr/lib/systemd/system/"
local _daemon
for _daemon in "${_daemons[@]}"; do
- cat > "${pkgdir}/usr/lib/systemd/system/dgrp_${_daemon}.service" << EOF
+ install -Dm644 <(cat << EOF
# Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR
-# http://aur.archlinux.org/
+# https://aur.archlinux.org/
[Unit]
Description="Digi ${_opt_RealPort} ${_daemon}"
After=network.target
@@ -278,90 +472,86 @@ ExecReload=/usr/bin/dgrp/daemon/dgrp_${_daemon} reload
[Install]
WantedBy=multi-user.target
EOF
- chmod 644 "${pkgdir}/usr/lib/systemd/system/dgrp_${_daemon}.service"
+ ) "${pkgdir}/usr/lib/systemd/system/dgrp_${_daemon}.service"
+ #chmod 644 "${pkgdir}/usr/lib/systemd/system/dgrp_${_daemon}.service"
done
# Install my custom drpadmin with man page.
install -Dm755 "${srcdir}/drpadmin" -t "${pkgdir}/usr/bin/"
- sed -i -e 's/^#distro=:::$/distro="Arch Linux"/g' \
- -e "s/RealPort/${_opt_RealPort}/gI" "${pkgdir}/usr/bin/drpadmin"
+ sed -e 's/^#distro=:::$/g_distro="Arch Linux"/g' \
+ -e "s/RealPort/${_opt_RealPort}/gI" -i "${pkgdir}/usr/bin/drpadmin"
install -Dm444 "${srcdir}/drpadmin.1" -t "${pkgdir}/usr/share/man/man1/"
# Standardize name of RealPort in man pages
- sed -i -e "s/RealPort/${_opt_RealPort}/gI" "${pkgdir}/usr/share/man/man8/"*.8 "${pkgdir}/usr/share/man/man1/"*.1
- set +u
-}
-
-# We generate this file because we have no other way to have adjustable content
-_geninstall() {
-# produce the Install script so it doesn't need to be downloaded separately
-# I'm wondering why there isn't a function for this.
-cat > "${install}" << EOF
-# Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR
-# http://aur.archlinux.org/
-
-pre_install() {
- set -u
- # Ensure that config files don't get lost on reinstall, chiefly from the digi make install to package upgrade
- # post_install code will rename it back
- if [ -s '/etc/dgrp.backing.store' -a ! -s '/etc/dgrp.backing.store.pacsave' ]; then
- mv '/etc/dgrp.backing.store' '/etc/dgrp.backing.store.pacsave'
- fi
- set +u
-}
-
-post_upgrade() {
- set -u
- mandb -q
- /usr/bin/dgrp/config/postinstall # this used to run depmod -a
- depmod -a
- # rmdir '/tmp/dgrp' # postinstall forgets to remove this. Useful on /tmp folders that are not mounted tmpfs
- systemctl daemon-reload
- # Digi's postinstall automatically loads the daemons so we might as well too
- for _daemon in ${_daemons[@]}; do
- systemctl enable "dgrp_\${_daemon}.service"
- systemctl start "dgrp_\${_daemon}.service"
- done
- #echo "${_opt_RealPort} (dgrp) startup scripts updated or installed"
- set +u
-}
+ sed -e "s/RealPort/${_opt_RealPort}/gI" -i "${pkgdir}/usr/share/man/man8/"*.8 "${pkgdir}/usr/share/man/man1/"*.1
+
+ # Desktop file for config tool
+ install -Dm644 <(cat << EOF
+[Desktop Entry]
+Name=Digi RealPort Manager
+GenericName=Device Server Manager
+Comment=Manage tty connections to Digi serial device servers
+Exec=gksudo -k -u root dgrp_gui
+Terminal=false
+Type=Application
+#Icon=
+Categories=Application;Utility;
+MimeType=application/x-executable
+EOF
+ ) "${pkgdir}/usr/share/applications/dgrp_cfg.desktop"
-post_install() {
- post_upgrade
-}
+ # addp tui and gui utilities
+ #install -Dpm755 "${srcdir}/addp" -t "${pkgdir}/usr/bin/"
+ install -Dpm755 "${srcdir}"/addp-*/'/addp.pl' "${pkgdir}/usr/bin/"
+ install -Dpm644 "${srcdir}/AddpClient.jar" -t "${pkgdir}/usr/bin/dgrp/"
-pre_upgrade() {
- set -u
- for _daemon in ${_daemons}; do
- systemctl stop "dgrp_\${_daemon}.service"
- systemctl disable "dgrp_\${_daemon}.service"
- done
- /usr/bin/dgrp/config/preuninstall
- set +u
-}
+ # Desktop file for config tool
+ install -Dm644 <(cat << EOF
+# Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR
+# https://aur.archlinux.org/
+
+[Desktop Entry]
+Name=Digi Device Discovery Tool
+GenericName=Device Server Manager
+Comment=Manage Digi serial device servers
+Exec=java -jar /usr/bin/dgrp/AddpClient.jar
+Terminal=false
+Type=Application
+#Icon=
+Categories=Application;Utility;
+MimeType=application/x-executable
+EOF
+ ) "${pkgdir}/usr/share/applications/AddpClient.desktop"
-pre_remove() {
- pre_upgrade
- set -u
- . '/usr/bin/dgrp/config/file_locations'
- if [ -f "\${DGRP_STORE}.old" ]; then
- echo "To clean fully you may want to remove your config backup: \${DGRP_STORE}.old"
- fi
- if [ -f "\${DGRP_STORE}.pacsave" ]; then
- echo "To clean fully you may want to remove your config backup: \${DGRP_STORE}.pacsave"
+ # DKMS
+ if [ "${_opt_DKMS}" -ne 0 ]; then
+ rm -rf "${pkgdir}/usr/lib/modules/"
+ local _dkms="${pkgdir}/usr/src/${pkgname}-${pkgver}"
+ install -Dm644 <(cat << EOF
+# Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR
+# https://aur.archlinux.org/
+
+PACKAGE_NAME="${pkgname}"
+PACKAGE_VERSION="${pkgver}"
+AUTOINSTALL="yes"
+
+BUILT_MODULE_NAME[0]="dgrp"
+BUILT_MODULE_LOCATION[0]="driver/build"
+# Using all processors doesn't compile this tiny module any faster.
+MAKE[0]="make -j1 -C 'driver/build'"
+CLEAN[0]="make -j1 -C 'driver/build' clean"
+# Placing the DKMS generated module in a different location than the standard install prevents conflicts when PKGBUILD _opt_DKMS is toggled
+DEST_MODULE_LOCATION[0]="/kernel/drivers/misc"
+EOF
+ ) "${_dkms}/dkms.conf"
+ install -dm755 "${_dkms}/driver/build/"
+ cp -pr 'driver/build/' "${_dkms}/driver/"
+ cp -pr 'commoninc/' "${_dkms}/"
+ install -pm644 'Makefile.inc' -t "${_dkms}/"
+ sed -e 's:/usr/lib/modules/[^/]\+/:/usr/lib/modules/$(KERNELRELEASE)/:g' \
+ -i "${_dkms}/driver/build/Makefile"
+ make -C "${_dkms}/driver/build/" clean
fi
set +u
}
-post_remove() {
- set -u
- mandb -q
- systemctl daemon-reload
- #echo "${_opt_RealPort} (dgrp) startup scripts removed"
- set +u
-}
-# Automatically generated by ${pkgname}-${pkgver} PKGBUILD from Arch Linux AUR
-EOF
-chmod 644 "${install}" # "
-}
-_geninstall
set +u
diff --git a/autorebuild-dgrp.sh b/autorebuild-dgrp.sh
deleted file mode 100755
index 60b9c4316776..000000000000
--- a/autorebuild-dgrp.sh
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/bash
-
-# Part of the dgrp-1.9.35 PKGBUILD from Arch Linux AUR
-# http://aur.archlinux.org/
-
-# If you remove this script your package will not auto rebuild
-# and your hardware will stop working after the next kernel upgrade.
-
-# Purpose: Automatically build and install this package on the next login
-# after pacman removes it on kernel upgrade.
-# Every package that needs to be autorebuilt should have a shell script
-# like this one. All you need is a PKGBUILD and a sense file to tell
-# when the package is missing.
-
-# This shell script can be easily adapted to any PKGBUILD. As an alternative
-# you can look into "DKMS" Dynamic Kernel Module Support.
-
-# To launch, add this to any user's profile or the system profile.
-# The preferred user is the one most likely to log on after an upgrade.
-# sudo must be installed and configured. Each user expected to rebuild packages
-# must be added to the wheel group (usermod -G).
-
-# for install_group in `groups`; do
-# if [ "${install_group}" = 'wheel' ]; then
-# find ~/build -maxdepth 2 -type f -perm /400 -name 'autorebuild-*.sh' -exec sh '{}' ';'
-# break
-# fi
-# done
-
-# This presumes you have neatly placed all your packages into ~build.
-
-# (Note: the multi user aspect has yet to be tested)
-
-# For multiple users you can use a standard folder set to be world writable.
-
-sensefile="/usr/lib/modules/$(uname -r)/misc/dgrp.ko"
-rebuildtitle='Digi RealPort driver for Ethernet serial servers'
-set -e
-set -u
-
-if [ ! -s "${sensefile}" ]; then
- if [ "${EUID}" -ne 0 ]; then
- cd "$(dirname "$0")" # compatible with cron and find
- #prevumask=$(umask); umask 000
- makepkg -sCcfi || sleep 5
- #umask ${prevumask}
- ## Allow other users to build without permissions interference
- ## This would be a security problem in most environments
- ## chmod 777 files with any x bit set
- #find . -type f ! "(" -perm 666 -o -perm 777 ")" -a -perm /111 -exec chmod 777 '{}' ';'
- ## chmod 666 files without any x bit set
- #find . -type f ! "(" -perm 666 -o -perm 777 ")" -a "!" -perm /111 -exec chmod 666 '{}' ';'
- ## chmod 777 files with any x bit set
- #find . -type d ! -perm 777 -exec chmod 777 '{}' ';'
- else
- # su user -c "$*" # this might work if you need the root user to rebuild.
- echo "$(tput clear)"
- echo "Important. A recent kernel upgrade has diabled your"
- echo ""
- echo "${rebuildtitle}"
- echo "Status: Disabled!"
- echo ""
- echo "It is easy to rebuild and enable but not by a root user."
- echo "You must log in as a non root user with sudo access (wheel group) and"
- echo ""
- echo "run: $0"
- echo ""
- echo "if it doesn't start automatically."
- echo "Press Enter"
- read autorebuild
- fi
-else
- echo "${rebuildtitle} already installed"
-fi
diff --git a/dgrp-install.sh b/dgrp-install.sh
index c82211d78a6e..3710099a0e86 100644
--- a/dgrp-install.sh
+++ b/dgrp-install.sh
@@ -1,11 +1,10 @@
-# Automatically generated by dgrp-1.9.36 PKGBUILD from Arch Linux AUR
-# http://aur.archlinux.org/
+_daemons=('daemon' 'ditty')
pre_install() {
set -u
- # Ensure that config files don't get lost on reinstall, chiefly from the digi make install to package upgrade
+ # Ensure that config files don't get lost on reinstall, chiefly from the Digi make install to package upgrade
# post_install code will rename it back
- if [ -s '/etc/dgrp.backing.store' -a ! -s '/etc/dgrp.backing.store.pacsave' ]; then
+ if [ -s '/etc/dgrp.backing.store' ] && [ ! -s '/etc/dgrp.backing.store.pacsave' ]; then
mv '/etc/dgrp.backing.store' '/etc/dgrp.backing.store.pacsave'
fi
set +u
@@ -13,17 +12,21 @@ pre_install() {
post_upgrade() {
set -u
- mandb -q
- /usr/bin/dgrp/config/postinstall # this used to run depmod -a
- depmod -a
+ #mandb -q
# rmdir '/tmp/dgrp' # postinstall forgets to remove this. Useful on /tmp folders that are not mounted tmpfs
systemctl daemon-reload
+ #udevadm control --reload # Seems to work without this
# Digi's postinstall automatically loads the daemons so we might as well too
- for _daemon in daemon ditty; do
- systemctl enable "dgrp_${_daemon}.service"
- systemctl start "dgrp_${_daemon}.service"
- done
- #echo "RealPort (dgrp) startup scripts updated or installed"
+ if [ ! -d /usr/src/dgrp-*/ ]; then # detect DKMS
+ /usr/bin/dgrp/config/postinstall # this used to run depmod -a
+ depmod -a
+ local _daemon
+ for _daemon in "${_daemons[@]}"; do
+ systemctl enable "dgrp_${_daemon}.service"
+ systemctl start "dgrp_${_daemon}.service"
+ done
+ #echo "RealPort (dgrp) startup scripts updated or installed"
+ fi
set +u
}
@@ -33,11 +36,14 @@ post_install() {
pre_upgrade() {
set -u
- for _daemon in daemon; do
- systemctl stop "dgrp_${_daemon}.service"
- systemctl disable "dgrp_${_daemon}.service"
- done
- /usr/bin/dgrp/config/preuninstall
+ if [ ! -d /usr/src/dgrp-*/ ]; then
+ local _daemon
+ for _daemon in "${_daemons[@]}"; do
+ systemctl stop "dgrp_${_daemon}.service"
+ systemctl disable "dgrp_${_daemon}.service"
+ done
+ /usr/bin/dgrp/config/preuninstall
+ fi
set +u
}
@@ -56,9 +62,9 @@ pre_remove() {
post_remove() {
set -u
- mandb -q
+ #mandb -q
systemctl daemon-reload
+ #udevadm control --reload # Seems to work without this
#echo "RealPort (dgrp) startup scripts removed"
set +u
}
-# Automatically generated by dgrp-1.9.36 PKGBUILD from Arch Linux AUR
diff --git a/dgrp-patch-signal_pending-kernel-4-11.patch b/dgrp-patch-signal_pending-kernel-4-11.patch
new file mode 100644
index 000000000000..6a8e04553599
--- /dev/null
+++ b/dgrp-patch-signal_pending-kernel-4-11.patch
@@ -0,0 +1,39 @@
+diff -pNaru5 src.old/dgrp-1.9/driver/2.6.27/dgrp_common.c src/dgrp-1.9/driver/2.6.27/dgrp_common.c
+--- src.old/dgrp-1.9/driver/2.6.27/dgrp_common.c 2016-11-09 22:47:19.000000000 -0500
++++ src/dgrp-1.9/driver/2.6.27/dgrp_common.c 2017-07-04 03:25:02.157171810 -0400
+@@ -52,11 +52,15 @@
+ #include <linux/errno.h>
+ #include <linux/tty.h>
+
+ #include "dgrp_common.h"
+ #include "dgrp_tty.h"
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++#include <linux/sched/signal.h>
++#else
+ #include <linux/sched.h> /* For in_egroup_p() */
++#endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+ #include <linux/slab.h> /* For in_egroup_p() */
+ #endif
+
+
+diff -pNaru5 src.old/dgrp-1.9/driver/2.6.27/dgrp_tty.c src/dgrp-1.9/driver/2.6.27/dgrp_tty.c
+--- src.old/dgrp-1.9/driver/2.6.27/dgrp_tty.c 2016-11-09 22:47:20.000000000 -0500
++++ src/dgrp-1.9/driver/2.6.27/dgrp_tty.c 2017-07-04 03:25:26.950917569 -0400
+@@ -53,12 +53,15 @@
+
+ #include "linux_ver_fix.h"
+
+ #include <linux/tty.h>
+ #include <linux/tty_flip.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++#include <linux/sched/signal.h>
++#else
+ #include <linux/sched.h>
+-#include <linux/sched.h>
++#endif
+
+ #include <linux/serial.h>
+ #include <linux/termios.h>
+ #include <linux/delay.h>
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
diff --git a/drpadmin b/drpadmin
index 07c1b09e4297..22c0aaef0516 100755
--- a/drpadmin
+++ b/drpadmin
@@ -4,47 +4,49 @@
# tty devices, and configuration files on servers not running xWindows.
# From drpadmin written by Digi for SCO, HP UX, and Solaris
-. /usr/bin/dgrp/config/file_locations
-if [ "$DGRP_STORE" = "" ]; then
+set -u
+
+. '/usr/bin/dgrp/config/file_locations'
+if [ -z "${DGRP_STORE}" ]; then
echo "$0: Can't find backing store from file locations."
exit 2
fi
-ttyname=tty # driver prefix
-procdir=`dirname "$DGRP_PROCCONFIG"`
-distro="Linux" # Originally made for Arch Linux
-# Installers can use sed -i to change this next line to the appropriate distro name
-#distro=:::
+g_ttyname='tty' # driver prefix
+g_procdir="$(dirname "${DGRP_PROCCONFIG}")"
+g_distro='Linux' # Originally made for Arch Linux
+# Packagers can use sed -i to change these next lines to the appropriate distro name
+#g_distro=:::
+# return 0 if the the device id $1 is acceptable for use
check_devid() {
- case $1 in
- [a-o,q-z]|[a-z][a-z]);;
- p)printf "**** p cannot be used. p is reserved for psuedo devices!"
- return 1
- ;;
- *)printf "**** Please enter 1 or 2 alpha characters"
- return 1
- ;;
+ case "$1" in
+ [a-o,q-z]|[a-z][a-z]) return 0;;
+ p)printf '**** p cannot be used. p is reserved for psuedo devices!';;
+ *)printf '**** Please enter 1 or 2 alpha characters';;
esac
- return 0
+ return 1
}
+# return 0 if the kernel is running. We try to start it if possible.
check_kernel() {
- if [ ! -d "$procdir" ]; then
- modprobe dgrp
+ if [ "${EUID}" -eq 0 ] && [ ! -d "${g_procdir}" ]; then
+ modprobe 'dgrp'
fi
- if [ -d "$procdir" ]; then
- lines=`wc -l "$DGRP_PROCCONFIG" | cut -d " " -f 1`
- if [ "$lines" -eq 0 ]; then
- echo "The kernel module is loaded but no devices are active"
+ if [ -d "${g_procdir}" ]; then
+ local lines
+ lines="$(wc -l "${DGRP_PROCCONFIG}" | cut -d ' ' -f 1)"
+ if [ "${lines}" -eq 0 ]; then
# this is not possible because the config file is removed and the kernel module is unloaded when the last device is uninit
+ echo 'The kernel module is loaded but no devices are active'
fi
else
- echo "The kernel module is not loaded"
- if [ -s "$DGRP_STORE" ]; then
- echo "A configuration exists but will not be active until the kernel module is loaded"
+ echo 'The kernel module is not loaded'
+ if [ -s "${DGRP_STORE}" ]; then
+ echo 'A configuration exists but will not be active until the kernel module is loaded'
else
- echo "Add any device to load the kernel module"
+ echo ' systemctl start dgrp_daemon.service'
+ echo 'to load the kernel module'
fi
return 1
fi
@@ -55,110 +57,168 @@ check_kernel() {
# add a PortServer entry
#
add_ps() {
+ local node val ndev devid secureopt wan ans
check_kernel
- while true; do
- printf "\nEnter the host name or IP address: "
+
+ local line linea available ttyused ipused
+ declare -A ttyused
+ declare -A ipused
+ while IFS='' read -r line || [[ -n "${line}" ]]; do
+ read -ra linea <<<"${line}"
+ case "${linea[0]:-}" in
+ [a-z]|[a-z][a-z])
+ ttyused[${linea[0]}]='used'
+ ipused[${linea[1]}]='used'
+ ;;
+ esac
+ done < "${DGRP_STORE}"
+
+ declare -A available
+ while IFS='' read -r line || [[ -n "${line}" ]]; do
+ printf '%s\n' "${line}"
+ read -ra linea <<<"${line}"
+ case "${linea[0]}" in
+ '*'*);;
+ '0.0.0.0');;
+ [0-9]*'.'[0-9]*'.'[0-9]*'.'[0-9]*)available[${linea[0]}]="${line}";; # crude IP detection
+ esac
+ done < <(addp.pl -Q --backing-store "${DGRP_STORE}" --timeout=1 --query-short --limit-query=10 | sort)
+ unset line linea
+
+ echo 'Answer 0 for any prompt to stop'
+ while :; do
+ printf '\nEnter the host name or IP address: '
read node
- if [ "$node" = "" -o "$node" = "0" ]; then
+ if [ -z "${node}" ]; then
+ echo 'Enter 0 to abort'
+ continue
+ fi
+ if [ "${node}" = '0' ]; then
return
fi
+ if [ ! -z "${ipused[${node}]:-}" ]; then
+ echo "${node} is already configured"
+ continue
+ fi
+
+ ping -n -w4 -c3 "${node}"
- ping -c 4 "$node"
+ ndev=''
+ secureopt=''
+ if [ ! -z "${available[${node}]:-}" ]; then
+ local linea
+ read -ra linea <<<"${available[${node}]}"
+ ndev="${linea[1]}"
+ if [ "${linea[2]}" = 'N' ]; then
+ secureopt='never'
+ fi
+ unset linea
+ fi
- while true; do
- printf "Enter the number of ports: "
- read ndev
- if [ "$ndev" = "" -o "$ndev" = "0" ]; then
+ while :; do
+ if [ -z "${ndev}" ]; then
+ printf "Enter the number of ports: "
+ else
+ printf "Enter the number of ports [${ndev}]: "
+ fi
+ read val
+ if [ ! -z "${val}" ]; then
+ ndev="${val}"
+ fi
+ if [ -z "${ndev}" ]; then
+ echo 'Enter 0 to abort'
+ continue
+ fi
+ if [ "${ndev}" = '0' ]; then
return
fi
- if [ "$ndev" -ge 1 -a "$ndev" -le 64 ]; then
+ if [ "${ndev}" -ge 1 ] && [ "${ndev}" -le 64 ]; then
break
fi
- printf "\n**** Please enter a number from 1 to 64\n\n"
+ printf '\n**** Please enter a number from 1 to 64\n\n'
done
- while true; do
- printf "Enter the tty device ID (1 or 2 lower case alpha characters) : "
+ while :; do
+ printf 'Enter the tty device ID (1 or 2 lower case alpha characters) : '
read devid
- if [ "$devid" = "" -o "$devid" = "0" ]; then
+ if [ -z "${devid}" ]; then
+ echo 'Enter 0 to abort'
+ continue
+ fi
+ if [ "${devid}" = '0' ]; then
return
fi
- check_devid $devid
- if [ $? -ne 0 ]; then
+ if ! check_devid "${devid}"; then
+ continue
+ fi
+ if [ ! -z "${ttyused[${devid}]:-}" ]; then
+ echo "${devid} is already used, try another"
continue
fi
+ break
+ done
- while true; do
- printf "\n\nWould you like this RealPort session to be encrypted?\n\n"
- printf "NOTE: Not all RealPort products support encrypted RealPort sessions.\n"
+ if [ -z "${secureopt}" ]; then
+ while :; do
+ printf '\n\nWould you like this RealPort session to be encrypted?\n\n'
+ printf 'NOTE: Not all RealPort products support encrypted RealPort sessions.\n'
printf "Please check your RealPort product's firmware release notes\n"
- printf "or product literature before selecting \"always\".\n"
- printf "If in doubt, select \"never\".\n\n"
- printf "(always/never) : (never): "
+ printf 'or product literature before selecting "always".\n'
+ printf 'If in doubt, select "never".\n\n'
+ printf '(always/never) : (never): '
- read secure
- if [ -z "$secure" ]; then
- secure="never"
+ read secureopt
+ secureopt="${secureopt,,}"
+ if [ -z "${secureopt}" ]; then
+ secureopt='never'
fi
-
- case $secure in
- [aA])
- secure="always"
- secureopt="always"
- ;;
- always)
- secureopt="always"
- ;;
- [nN])
- secure="never"
- secureopt="never"
- ;;
- never)
- secureopt="never"
- ;;
- *)
- printf "\nPlease answer (a)lways or (n)ever.\n" >&2
- ;;
- esac
-
- if [ ! -z "$secureopt" ]; then
- break
+ if [ -z "${secureopt}" ] || [ "${secureopt}" = '0' ]; then
+ return
fi
- done
-
- while true; do
- printf "\nIf the network connection between your Server system\n"
- printf "and the remote device includes a WAN link slower than 1 MBit,\n"
- printf "see the drpd manual page and enter the WAN speed here : "
- read wan
- if [ -z "$wan" ]; then
+ if [ "${secureopt}" = 'never' ] || [ "${secureopt}" = 'always' ]; then
break
fi
- printf "\n**** "
- #expr "$s" : '.*:\(.*\)'
+ printf '\nPlease answer always or never.\n'
done
+ fi
- printf "\nThe following device will be configured,\n"
- printf "$node\t$ndev\t$ttyname$devid$start-$ttyname$devid$p\t\tsecure ($secureopt)\t$wan\n"
- printf "\nIs this correct (y to add or x to abort) ? "
- read ans
- if [ -z "$ans" ]; then
- printf "\nEmpty response, not configuring this device.\n"
+ while :; do
+ printf '\nIf the network connection between your Server system\n'
+ printf 'and the remote device includes a WAN link slower than 1 MBit,\n'
+ printf 'see the drpd manual page and enter the WAN speed here : '
+ read wan
+ if [ "${wan}" = '0' ]; then
return
fi
- if [ $ans = 'x' ]; then
- printf "\nx pressed, not configuring this device.\n"
- return
- fi
- if [ $ans = 'y' ]; then
- if [ "$wan" != "" ]; then
- $wan = "-s $wan"
- fi
- echo "$DGRP_CFG" -v -e $secureopt $wan init $devid $node $ndev
- "$DGRP_CFG" -v -e $secureopt $wan init $devid $node $ndev
- return
+ if [ -z "${wan}" ] || [[ "${wan}" =~ [0-9]+ ]]; then
+ break
fi
+ printf '\nPlease enter a numeric answer or blank for none\n'
done
+
+ printf '\nThe following device will be configured,\n'
+ printf "${node}\t${ndev}\t${g_ttyname}${devid}\t\tsecure (${secureopt})\t${wan}\n"
+ printf '\nIs this correct (y to add, 0 to abort, n to start again) ? '
+ read ans
+ if [ -z "${ans}" ]; then
+ printf '\nEmpty response, not configuring this device.\n'
+ return
+ fi
+ if [ "${ans}" = 'x' ] || [ "${ans}" = '0' ]; then
+ printf '\nx pressed, not configuring this device.\n'
+ return
+ fi
+ if [ "${ans}" = 'y' ]; then
+ if [ ! -z "${wan}" ]; then
+ wan="-s ${wan}"
+ fi
+ # -m mode and -g group id don't work any more. It's all done with /etc/udev/rules.d/10-dgrp.rules
+ echo "$DGRP_CFG" -v -e "${secureopt}" ${wan} init "${devid}" "${node}" "${ndev}"
+ if "$DGRP_CFG" -v -e "${secureopt}" ${wan} init "${devid}" "${node}" "${ndev}"; then
+ systemctl restart 'dgrp_daemon.service' # can be removed when dgrp gets systemd compatible
+ fi
+ return
+ fi
done
}
@@ -166,19 +226,20 @@ add_ps() {
# delete a PortServer device
#
delete_ps() {
- check_kernel
- if [ $? -ne 0 ]; then
+ if ! check_kernel; then
return
fi
show_ps
- printf "\nEnter the 2 letter id of the device to delete: "
+ printf '\nEnter the 2 letter id of the device to delete: '
+ local devid
read devid
- check_devid $devid
- if [ $? -ne 0 ]; then
+ if ! check_devid "${devid}"; then
return
fi
- echo "$DGRP_CFG" -v uninit "$devid"
- "$DGRP_CFG" -v uninit "$devid"
+ echo "$DGRP_CFG" -v uninit "${devid}"
+ if "$DGRP_CFG" -v uninit "${devid}"; then
+ systemctl restart 'dgrp_daemon.service' # can be removed when dgrp gets systemd compatible
+ fi
}
#
@@ -189,145 +250,157 @@ delete_ps() {
# $3 = word to display like "reset" or "move"
# $4 = word to display like "" or "new"
resetmove_ps() {
- check_kernel
- if [ $? -ne 0 ]; then
+ if ! check_kernel; then
return
fi
show_ps
printf "\nWarning: $2 a device will disconnect all active connections!\n"
printf "Enter the 1 or 2 letter device to $3: "
+ local devid
read devid
- check_devid $devid
- if [ $? -ne 0 ]; then
+ if ! check_devid "${devid}"; then
return
fi
- node=`grep "^$devid[^0-9]" "$DGRP_STORE" | cut -d " " -f 2`
- if [ "$node" = "" ]; then
- printf "Device $devid not found"
+ local node
+ node="$(grep "^${devid}[^0-9]" "${DGRP_STORE}" | cut -d ' ' -f 2)"
+ if [ -z "${node}" ]; then
+ printf "Device ${devid} not found"
+ return
fi
- if [ "$1" -eq 1 ]; then
+ if [ "$1" -eq 1 ]; then # move
printf "\nEnter the $4 host name or IP address: "
read node
- if [ "$node" = "" -o "$node" = "0" ]; then
+ if [ -z "${node}" ] || [ "${node}" = "0" ]; then
return
fi
- echo ping -w 4 -c 4 "$node"
- ping -w 4 -c 4 "$node"
+ echo ping -w 4 -c 4 "${node}"
+ ping -w 4 -c 4 "${node}"
+ fi
+ echo "$DGRP_CFG" -v stop "${devid}"
+ "$DGRP_CFG" -v stop "${devid}"
+ echo "$DGRP_CFG" -v start "${devid}" "${node}"
+ if "$DGRP_CFG" -v start "${devid}" "${node}"; then
+ systemctl restart 'dgrp_daemon.service' # can be removed when dgrp gets systemd compatible
fi
- echo "$DGRP_CFG" -v stop "$devid"
- "$DGRP_CFG" -v stop "$devid"
- echo "$DGRP_CFG" -v start "$devid" "$node"
- "$DGRP_CFG" -v start "$devid" "$node"
}
show_ps() {
check_kernel
- if [ -s "$DGRP_STORE" ]; then
- lines=`wc -l "$DGRP_STORE" | cut -d " " -f 1`
+ local lines
+ if [ -s "${DGRP_STORE}" ]; then
+ lines="$(wc -l "${DGRP_STORE}" | cut -d ' ' -f 1)"
else
lines=0
fi
- if [ "$lines" -eq 0 ]; then
- echo ""
- echo "No devices are configured."
- elif [ "$lines" -lt 20 ]; then
- echo `grep PortCount "$DGRP_STORE" | cut -d " " -f3-`
- grep "^[a-z]" "$DGRP_STORE"
+ if [ "${lines}" -eq 0 ]; then
+ printf '\nNo devices are configured.\n'
+ elif [ "${lines}" -lt 20 ]; then
+ echo "$(grep 'PortCount' "${DGRP_STORE}" | cut -d ' ' -f3-)"
+ grep "^[a-z]" "${DGRP_STORE}"
else
- less "$DGRP_STORE"
+ less -S "${DGRP_STORE}"
fi
}
show_info() {
- check_kernel
- if [ $? -eq 0 ]; then
- if [ "$lines" -lt 20 ]; then
- cat "$DGRP_PROCCONFIG"
+ if check_kernel; then
+ if [ "$(wc -l "${DGRP_PROCCONFIG}" | cut -d ' ' -f 1)" -lt 20 ]; then
+ cat "${DGRP_PROCCONFIG}"
else
- less "$DGRP_PROCCONFIG"
+ less "${DGRP_PROCCONFIG}"
fi
fi
}
show_node() {
- check_kernel
- if [ $? -eq 0 ]; then
- if [ "`wc -l "$procdir/nodeinfo" | cut -d " " -f 1`" -lt 20 ]; then
- cat "$procdir/nodeinfo"
+ if check_kernel; then
+ if [ "$(wc -l "${g_procdir}/nodeinfo" | cut -d ' ' -f 1)" -lt 20 ]; then
+ cat "${g_procdir}/nodeinfo"
else
- less "$procdir/nodeinfo"
+ less "${g_procdir}/nodeinfo"
fi
fi
}
show_version() {
- check_kernel
- if [ $? -eq 0 ]; then
- if [ "`wc -l "$procdir/info" | cut -d " " -f 1`" -lt 20 ]; then
- cat "$procdir/info"
- elif [ "$lines < 20" ]; then
- less "$procdir/info"
+ if check_kernel; then
+ if [ "$(wc -l "${g_procdir}/info" | cut -d ' ' -f 1)" -lt 20 ]; then
+ cat "${g_procdir}/info"
+ else
+ less "${g_procdir}/info"
fi
fi
}
# main body
-echo ""
+echo ''
-if [ "$EUID" -ne 0 ]; then
- printf "\nDigi Realport Current Configuration:\n"
+if [ "${EUID}" -ne 0 ]; then
+ printf '\nDigi Realport Current Configuration:\n'
show_ps
else
- echo "Digi Realport Configuration Menu for $distro"
- echo ""
- echo "Add - add a new device configuration (init)"
- echo "Delete - delete a device configuration (uninit)"
- echo "Reset - reset a single device by stopping and starting it"
- echo "Move - change IP address for a device without losing configuration"
- echo "Show - display set configuration $DGRP_STORE"
- echo "Kernel - display active configuration $DGRP_PROCCONFIG"
- echo "Node - display active nodes $procdir/nodeinfo"
- echo "Version - display kernel version and debugging info $procdir/info"
+ echo "Digi Realport Configuration Menu for ${g_distro}"
+ echo ''
+ echo 'Add - add a new device configuration (init)'
+ echo 'Delete - delete a device configuration (uninit)'
+ echo 'Reset - reset a single device by stopping and starting it'
+ #echo 'Move - change IP address for a device without losing configuration'
+ echo "Show - display set configuration ${DGRP_STORE}"
+ echo "Kernel - display active configuration ${DGRP_PROCCONFIG}"
+ echo "Node - display active nodes ${g_procdir}/nodeinfo"
+ echo "Version - display kernel version and debugging info ${g_procdir}/info"
+ echo ''
fi
check_kernel
-if [ -d "$procdir" ]; then
- echo ""
- echo "Kernel Status: Running"
- lines=`grep "^[^#].*" "$procdir/config" | wc -l | cut -d " " -f 1`
- if [ "$lines" -eq 0 ]; then
- echo "Device Count : $lines"
- echo "systemctl start dgrp_daemon.service"
- systemctl start dgrp_daemon.service
- echo "systemctl start dgrp_ditty.service"
- systemctl start dgrp_ditty.service
- lines=`grep "^[^#].*" "$procdir/config" | wc -l | cut -d " " -f 1`
+echo "Service at boot: $(systemctl is-enabled 'dgrp_daemon.service')"
+echo "Service status: $(systemctl is-active 'dgrp_daemon.service')"
+
+if [ -d "${g_procdir}" ]; then
+ echo 'Kernel status: running'
+ lines="$(grep "^[^#].*" "${g_procdir}/config" | wc -l | cut -d ' ' -f 1)"
+ if [ "${lines}" -eq 0 ]; then
+ if [ "${EUID}" -eq 0 ]; then
+ echo "Device count : ${lines}"
+ echo 'systemctl start dgrp_daemon.service'
+ systemctl start 'dgrp_daemon.service'
+ echo 'systemctl start dgrp_ditty.service'
+ systemctl start 'dgrp_ditty.service'
+ lines="$(grep "^[^#].*" "${g_procdir}/config" | wc -l | cut -d ' ' -f 1)"
+ fi
+ elif ! pgrep -c 'drpd' > /dev/null; then
+ echo 'Daemon status: NOT RUNNING'
+ echo 'to fix:'
+ echo ' systemctl restart dgrp_daemon.service'
+ else
+ echo 'Daemon status: running'
fi
- echo "Device Count : $lines"
+ echo "Device Count : ${lines}"
+ unset lines
else
- echo ""
- echo "Kernel status: NOT RUNNING"
+ echo ''
+ echo 'Kernel status: NOT RUNNING'
fi
-if [ "$EUID" -ne 0 ]; then
+if [ "${EUID}" -ne 0 ]; then
printf "\nMust be root to use $0\n"
exit 2
fi
-while true; do
- printf "\nOp: (a)dd (d)elete (r)eset (s)how (k)ernel (n)ode (v)ersion (q)uit:"
+while :; do
+ printf '\nOp: (a)dd (d)elete (r)eset (s)how (k)ernel (n)ode (v)ersion (q)uit:'
read opt
- case $opt in
+ case "${opt,,}" in
'a') add_ps ;;
'd') delete_ps;;
- 'r') resetmove_ps 0 "Resetting" "reset" "";;
- #'m') resetmove_ps 1 "Moving" "move" "new";; # Doesn't work according to the instructions
+ 'r') resetmove_ps 0 'Resetting' 'reset' '';;
+ #'m') resetmove_ps 1 'Moving' 'move' 'new';; # Doesn't work according to the instructions
's') show_ps;;
'k') show_info;;
'n') show_node;;
'v') show_version;;
- 'q') echo "man `basename $DGRP_CFG` for advanced configuration options"; exit 0;;
+ 'q') echo "man $(basename "${DGRP_CFG}") for advanced configuration options"; exit 0;;
esac
done