summaryrefslogtreecommitdiffstats
path: root/debian/setup-instance
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 02:04:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 02:04:07 +0000
commit1221c736f9a90756d47ea6d28320b6b83602dd2a (patch)
treeb453ba7b1393205258c9b098a773b4330984672f /debian/setup-instance
parentAdding upstream version 2.4.38. (diff)
downloadapache2-1221c736f9a90756d47ea6d28320b6b83602dd2a.tar.xz
apache2-1221c736f9a90756d47ea6d28320b6b83602dd2a.zip
Adding debian version 2.4.38-3+deb10u8.debian/2.4.38-3+deb10u8
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/setup-instance')
-rw-r--r--debian/setup-instance61
1 files changed, 61 insertions, 0 deletions
diff --git a/debian/setup-instance b/debian/setup-instance
new file mode 100644
index 0000000..b202457
--- /dev/null
+++ b/debian/setup-instance
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+set -eu
+
+if [ $# != 1 ] ; then
+ echo usage: $0 '<suffix>'
+ exit 1
+fi
+
+is_systemd () {
+ case "$(readlink -f /proc/1/exe || true)" in
+ *systemd*)
+ return 0
+ ;;
+ *)
+ return 1
+ ;;
+ esac
+}
+
+# the SUFFIX must not contain spaces or shell meta characters
+SUFFIX=$1
+
+if [ -e /etc/apache2-$SUFFIX ] ; then
+ echo ERROR: /etc/apache2-$SUFFIX already exists
+ exit 2
+fi
+
+echo Setting up /etc/apache2-$SUFFIX ...
+cp -a /etc/apache2 /etc/apache2-$SUFFIX
+
+if is_systemd ; then
+ echo "systemd is in use, no init script installed"
+ echo "use the 'apache2@$SUFFIX.service' service to control your new instance"
+ echo "sample commands:"
+ echo "systemctl start apache2@$SUFFIX.service"
+ echo "systemctl enable apache2@$SUFFIX.service"
+else
+ echo "Setting up /etc/init.d/apache2-$SUFFIX ..."
+ cp /usr/share/doc/apache2/examples/secondary-init-script /etc/init.d/apache2-$SUFFIX
+ # adjust service name (this prevents us from using a simple symlink)
+ perl -p -i -e s,XXX,$SUFFIX, /etc/init.d/apache2-$SUFFIX
+ chmod 755 /etc/init.d/apache2-$SUFFIX
+fi
+
+echo -n Setting up symlinks:
+for a in a2enmod a2dismod a2ensite a2dissite a2enconf a2disconf apache2ctl ; do
+ echo -n " $a-$SUFFIX"
+ ln -s /usr/sbin/$a /usr/local/sbin/$a-$SUFFIX
+done
+echo
+
+echo Setting up /etc/logrotate.d/apache2-$SUFFIX and /var/log/apache2-$SUFFIX ...
+cp -a /etc/logrotate.d/apache2 /etc/logrotate.d/apache2-$SUFFIX
+perl -p -i -e s,apache2,apache2-$SUFFIX,g /etc/logrotate.d/apache2-$SUFFIX
+mkdir /var/log/apache2-$SUFFIX
+chmod 750 /var/log/apache2-$SUFFIX
+chown root:adm /var/log/apache2-$SUFFIX
+
+echo "Setting up /etc/default/apache-htcacheclean-$SUFFIX"
+cp -a /etc/default/apache-htcacheclean /etc/default/apache-htcacheclean-$SUFFIX