Skip to content

Commit

Permalink
deb cleanup (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Coutadeur committed Jan 31, 2024
1 parent 6b0b6b9 commit 9676519
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 19 deletions.
6 changes: 6 additions & 0 deletions src/install/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
lsc (2.2.0-1) unstable; urgency=low

* Update to 2.2.0

-- Clement Oudot (LTB-project) <[email protected]> Tue, 24 Aug 2021 12:00:00 +0100

lsc (2.1.6-1) unstable; urgency=low

* Update to 2.1.6
Expand Down
7 changes: 6 additions & 1 deletion src/install/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ Vcs-Browser: https://github.com/lsc-project/lsc

Package: lsc
Architecture: all
Depends: ${misc:Depends}
Depends: cron, ${misc:Depends}
Description: LDAP Synchronization Connector
LSC offers a powerful transformation engine, based on a scripting language,
to easily manipulate data on the fly. Various identity management functions
are included for directory-specific compatibility - most notably Active Directory
(changing passwords, account status, last logon, etc ...). LSC is an open source
project written in Java, available under the BSD license.

Package: nagios-plugins-lsc
Architecture: all
Depends: ${perl:Depends}
Description: Nagios plugins to check lsc
4 changes: 0 additions & 4 deletions src/install/debian/lsc.install
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@
bin/lsc usr/bin
bin/lsc-agent usr/bin
bin/hsqldb usr/bin
## config
etc/logback.xml etc/lsc
## lib
lib/* usr/lib/lsc
## sample
sample/* usr/share/doc/lsc
## systemd
etc/default/lsc-sync etc/default
etc/default/lsc-async etc/default
## nagios
bin/check_lsc* var/lib/lsc/nagios

4 changes: 4 additions & 0 deletions src/install/debian/lsc.manpages
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
doc/man/man1/lsc.1
doc/man/man1/lsc-agent.1
doc/man/man5/lsc.properties.5
doc/man/man5/lsc.xml.5
27 changes: 14 additions & 13 deletions src/install/debian/lsc.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,26 @@ lsc_logdir=/var/log/lsc
lsc_user=lsc
lsc_group=lsc

getent group ${lsc_group} > /dev/null 2>&1 || groupadd --system ${lsc_group}
getent passwd ${lsc_user} > /dev/null 2>&1 || useradd --system --gid ${lsc_group} --home-dir /etc/lsc ${lsc_user}

# Always do this
chown -R ${lsc_user}:${lsc_group} ${lsc_logdir}
chown ${lsc_user}:${lsc_group} /var/lib/lsc

# Reconfigure files
## logback
sed -i "s:/tmp/lsc/log:${lsc_logdir}:" /etc/lsc/logback.xml
sed -i "s:/tmp/lsc/log:${lsc_logdir}:" \
/etc/lsc/logback.xml
## bin
sed -i 's:^CFG_DIR.*:CFG_DIR="/etc/lsc":' /usr/bin/lsc /usr/bin/lsc-agent /usr/bin/hsqldb
sed -i 's:^LIB_DIR.*:LIB_DIR="/usr/lib/lsc":' /usr/bin/lsc /usr/bin/lsc-agent /usr/bin/hsqldb
sed -i "s:^LOG_DIR.*:LOG_DIR=\"${lsc_logdir}\":" /usr/bin/lsc /usr/bin/lsc-agent /usr/bin/hsqldb
sed -i 's:^VAR_DIR.*:VAR_DIR="/var/lsc":' /usr/bin/hsqldb

# Copy sample configuration for a fresh install
[ -f /etc/lsc/lsc.xml ] || cp /usr/share/doc/lsc/lsc.xml-sample /etc/lsc/lsc.xml
[ -f /etc/lsc/sql-map-config.xml ] || cp /usr/share/doc/lsc/sql-map-config.xml-sample /etc/lsc/sql-map-config.xml
[ -f /etc/lsc/sql-map-config.d/InetOrgPerson.xml ] || cp /usr/share/doc/lsc/InetOrgPerson.xml-sample /etc/lsc/sql-map-config.d/InetOrgPerson.xml
sed -i \
-e 's:^CFG_DIR.*:CFG_DIR="/etc/lsc":' \
-e 's:^LIB_DIR.*:LIB_DIR="/usr/lib/lsc":' \
-e "s:^LOG_DIR.*:LOG_DIR=\"${lsc_logdir}\":" \
/usr/bin/lsc \
/usr/bin/lsc-agent \
/usr/bin/hsqldb
sed -i \
-e 's:^VAR_DIR.*:VAR_DIR="/var/lib/lsc":' \
-e 's:^HSQLDB_PIDFILE.*:HSQLDB_PIDFILE="/run/hsqldb.pid":' \
/usr/bin/hsqldb

#DEBHELPER#

Expand Down
9 changes: 9 additions & 0 deletions src/install/debian/lsc.preinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

lsc_logdir=/var/log/lsc
lsc_user=lsc
lsc_group=lsc

getent group ${lsc_group} > /dev/null 2>&1 || groupadd --system ${lsc_group}
getent passwd ${lsc_user} > /dev/null 2>&1 || useradd --system --gid ${lsc_group} --home-dir /var/lib/lsc --shell "/sbin/nologin" --comment "LDAP Synchronization Connector user" ${lsc_user}

2 changes: 2 additions & 0 deletions src/install/debian/nagios-plugins-lsc.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## nagios
bin/check_lsc* usr/lib/nagios/plugins
15 changes: 14 additions & 1 deletion src/install/debian/rules
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
override_dh_compress:

override_dh_testdir:
## systemd
# systemd
cp -f lib/systemd/system/lsc-async.service debian/
cp -f lib/systemd/system/[email protected] debian/
cp -f lib/systemd/system/lsc-sync.service debian/
Expand All @@ -25,3 +25,16 @@ override_dh_installsystemd:
dh_installsystemd --no-start --no-enable --no-stop-on-upgrade --name=lsc-sync
dh_installsystemd --no-start --no-enable --no-stop-on-upgrade --name=lsc-sync@
dh_installsystemd --name=lsc-sync.timer


override_dh_install:
dh_install
# Copy configuration files
mkdir -p `pwd`/debian/lsc/var/lib/lsc
mkdir -p `pwd`/debian/lsc/etc/lsc/sql-map-config.d
cp -a etc/logback.xml `pwd`/debian/lsc/etc/lsc/logback.xml
cp -a etc/lsc.xml-sample `pwd`/debian/lsc/etc/lsc/lsc.xml
cp -a etc/sql-map-config.xml-sample `pwd`/debian/lsc/etc/lsc/sql-map-config.xml
cp -a etc/sql-map-config.d/InetOrgPerson.xml-sample `pwd`/debian/lsc/etc/lsc/sql-map-config.d/InetOrgPerson.xml
# Remove useless windows .bat files
find debian/lsc -type f -name '*.bat' -delete

0 comments on commit 9676519

Please sign in to comment.