Skip to content

Commit f54167c

Browse files
committed
Fix libsagui dependency handling for manual installs
1 parent 1507344 commit f54167c

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

build-deb.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ validate_binary() {
8383
fi
8484
}
8585

86+
normalize_maintainer_scripts() {
87+
local script
88+
for script in "${STAGING_DIR}/DEBIAN/postinst" "${STAGING_DIR}/DEBIAN/postrm"; do
89+
if [ -f "${script}" ]; then
90+
sed -i 's/\r$//' "${script}"
91+
fi
92+
done
93+
}
94+
8695
# ---------------------------------------------------------------------------
8796
# Main
8897
# ---------------------------------------------------------------------------
@@ -99,6 +108,7 @@ mkdir -p "${BUILD_DIR}"
99108

100109
# Copy staging from sources in /tmp — here chmod works correctly
101110
cp -r "${SCRIPT_DIR}/debian" "${STAGING_DIR}"
111+
normalize_maintainer_scripts
102112

103113
# Include db_schema.sql — used by postinst to initialize the database
104114
mkdir -p "${STAGING_DIR}/usr/share/${PACKAGE_NAME}"

debian/DEBIAN/control

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ Priority: optional
33
Maintainer: Renat Suleymanov <mail@Renat.Su>
44
Architecture: amd64
55
Section: utils
6-
Depends: dash, libc6 (>= 2.2.5), libsagui2 | libsagui
6+
Depends: dash, libc6 (>= 2.2.5)
7+
Recommends: libsagui2 | libsagui
78
Origin: https://github.com/al-Muhandis/AdminHelper
89
Description: Telegram admin helper
910
Telegram bot service for groups' moderation

debian/DEBIAN/postinst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ mysql_available() {
1515
command -v mysql &>/dev/null && mysqladmin ping --silent 2>/dev/null
1616
}
1717

18+
libsagui_available() {
19+
command -v ldconfig &>/dev/null && ldconfig -p 2>/dev/null | grep -q 'libsagui\.so'
20+
}
21+
1822
# Read current value from JSON (return empty string if null or missing)
1923
json_get() {
2024
jq -r "$1 // empty" "${CONFIG_FILE}" 2>/dev/null || true
@@ -97,6 +101,12 @@ case "$1" in
97101
fi
98102
done
99103

104+
if ! libsagui_available; then
105+
echo "ERROR: libsagui shared library was not found in dynamic linker cache." >&2
106+
echo " Install libsagui (package or from source) and run: sudo ldconfig" >&2
107+
exit 1
108+
fi
109+
100110
if [ ! -f "${CONFIG_FILE}" ]; then
101111
echo "ERROR: config file not found: ${CONFIG_FILE}" >&2
102112
echo " Place tgadmin.json into /etc/tgadmin/ before installing." >&2

0 commit comments

Comments
 (0)