]> git.proxmox.com Git - pve-manager.git/commitdiff
depend on systemd, add service files
authorDietmar Maurer <dietmar@proxmox.com>
Sat, 28 Feb 2015 11:42:20 +0000 (12:42 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Sat, 28 Feb 2015 11:42:20 +0000 (12:42 +0100)
14 files changed:
bin/init.d/Makefile
bin/init.d/pve-manager
bin/init.d/pve-manager.service [new file with mode: 0644]
bin/init.d/pvebanner.service [new file with mode: 0644]
bin/init.d/pvedaemon.service [new file with mode: 0644]
bin/init.d/pvenetcommit.service [new file with mode: 0644]
bin/init.d/pveproxy.service [new file with mode: 0644]
bin/init.d/pvestatd.service [new file with mode: 0644]
bin/init.d/spiceproxy.service [new file with mode: 0644]
debian/conffiles
debian/control.in
debian/postinst
debian/postrm
defines.mk

index bfb8139d7d3e39fc199fbb009167c80ab6b7edd7..1e66e25e67fe14e5bf9998b0a508ae694aae7daa 100644 (file)
@@ -7,14 +7,24 @@ SCRIPTS =             \
        pvedaemon       \
        pveproxy        \
        spiceproxy      \
-       pvebanner       \
-       pvestatd        \
-       pvenetcommit
+       pvestatd
+
+
+SERVICES=                      \
+       pvebanner.service       \
+       pvenetcommit.service    \
+       pvestatd.service        \
+       pve-manager.service     \
+       pvedaemon.service       \
+       pveproxy.service        \
+       spiceproxy.service 
 
 .PHONY: install 
 install: ${SCRIPTS}
        install -d ${INITDBINDIR}
        install -m 0755 ${SCRIPTS} ${INITDBINDIR}
+       install -d ${SERVICEDIR}
+       install -m 0644 ${SERVICES} ${SERVICEDIR}
 
 .PHONY: distclean
 distclean: clean
index a8b0e647897217b594a8ef78a1ce55e4c742e13f..89cab4a84ca61202cb4d46f2e64fe44c74477921 100755 (executable)
@@ -2,8 +2,8 @@
 
 ### BEGIN INIT INFO
 # Provides:        pve-manager
-# Required-Start:  $remote_fs pveproxy qemu-server +vz pvestatd
-# Required-Stop:   $remote_fs pveproxy qemu-server +vz pvestatd
+# Required-Start:  $remote_fs pveproxy qemu-server pvestatd
+# Required-Stop:   $remote_fs pveproxy qemu-server pvestatd
 # Default-Start:   2 3 4 5
 # Default-Stop:    0 1 6
 # Short-Description: PVE VM Manager
diff --git a/bin/init.d/pve-manager.service b/bin/init.d/pve-manager.service
new file mode 100644 (file)
index 0000000..334ca24
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description=PVE VM Manager
+ConditionPathExists=/usr/bin/pvesh
+Wants=pveproxy.service
+After=pveproxy.service
+
+[Service]
+ExecStart=/etc/init.d/pve-manager start
+ExecStop=/etc/init.d/pve-manager stop
+Type=forking
+
+[Install]
+WantedBy=multi-user.target
diff --git a/bin/init.d/pvebanner.service b/bin/init.d/pvebanner.service
new file mode 100644 (file)
index 0000000..d3d8087
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description=Proxmox VE Login Banner
+ConditionPathExists=/usr/bin/pvebanner
+Wants=console-getty.service
+Before=console-getty.service
+
+[Service]
+ExecStart=/usr/bin/pvebanner
+Type=oneshot
+RemainAfterExit=yes
+
+[Install]
+WantedBy=getty.target
diff --git a/bin/init.d/pvedaemon.service b/bin/init.d/pvedaemon.service
new file mode 100644 (file)
index 0000000..4a43ac6
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description=PVE API Daemon
+ConditionPathExists=/usr/bin/pvedaemon
+Requires=pve-cluster.service
+After=pve-cluster.service
+
+[Service]
+ExecStart=/etc/init.d/pvedaemon start
+ExecStop=/etc/init.d/pvedaemon stop
+Type=forking
+
+[Install]
+WantedBy=multi-user.target
diff --git a/bin/init.d/pvenetcommit.service b/bin/init.d/pvenetcommit.service
new file mode 100644 (file)
index 0000000..6b89240
--- /dev/null
@@ -0,0 +1,12 @@
+[Unit]
+Description=Commit Proxmox VE network changes
+
+[Service]
+ExecStartPre=-/bin/rm -f /etc/openvswitch/conf.db
+ExecStartPre=-/bin/mv /etc/network/interfaces.new /etc/network/interfaces
+ExecStart=/bin/true
+Type=oneshot
+RemainAfterExit=yes
+
+[Install]
+WantedBy=networking.service
diff --git a/bin/init.d/pveproxy.service b/bin/init.d/pveproxy.service
new file mode 100644 (file)
index 0000000..9d9a668
--- /dev/null
@@ -0,0 +1,15 @@
+[Unit]
+Description=PVE API Proxy Server
+ConditionPathExists=/usr/bin/pveproxy
+Requires=pve-cluster.service
+Wants=pvedaemon.service
+After=pve-cluster.service
+After=pvedaemon.service
+
+[Service]
+ExecStart=/etc/init.d/pveproxy start
+ExecStop=/etc/init.d/pveproxy stop
+Type=forking
+
+[Install]
+WantedBy=multi-user.target
diff --git a/bin/init.d/pvestatd.service b/bin/init.d/pvestatd.service
new file mode 100644 (file)
index 0000000..4fc354c
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description=PVE Status Daemon
+ConditionPathExists=/usr/bin/pvestatd
+Requires=pve-cluster.service
+After=pve-cluster.service
+
+[Service]
+ExecStart=/etc/init.d/pvestatd start
+ExecStop=/etc/init.d/pvestatd stop
+Type=forking
+
+[Install]
+WantedBy=multi-user.target
diff --git a/bin/init.d/spiceproxy.service b/bin/init.d/spiceproxy.service
new file mode 100644 (file)
index 0000000..4764dcf
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description= PVE SPICE Proxy Server
+ConditionPathExists=/usr/bin/spiceproxy
+Wants=pveproxy.service
+After=pveproxy.service
+
+[Service]
+ExecStart=/etc/init.d/spiceproxy start
+ExecStop=/etc/init.d/spiceproxy stop
+Type=forking
+
+[Install]
+WantedBy=multi-user.target
index 43953c37ab69f150e49f87f762859609235f50ad..895abdfe06fc6c8eec08c9bfe7c6f14553af56d3 100644 (file)
@@ -2,8 +2,6 @@
 /etc/init.d/pvedaemon
 /etc/init.d/pveproxy
 /etc/init.d/spiceproxy
-/etc/init.d/pvebanner
-/etc/init.d/pvenetcommit
 /etc/init.d/pvestatd
 /etc/cron.daily/pve
 /etc/vz/vznet.conf
index 462d64fea23b6dba347b093aaa47202435adc83e..64cc2058ee800a7700d88d9b8506eb74b5390005 100644 (file)
@@ -3,7 +3,7 @@ Version: @VERSION@-@PACKAGERELEASE@
 Section: admin
 Priority: optional
 Architecture: amd64
-Depends: perl (>= 5.10.0-19), libtimedate-perl, libauthen-pam-perl, libintl-perl, rsync, libjson-perl, liblockfile-simple-perl, vncterm, qemu-server (>= 1.1-1), libwww-perl (>= 6.04-1), libnet-http-perl (>= 6.06-1), libhttp-daemon-perl, wget, libnet-dns-perl, vlan, ifenslave-2.6 (>= 1.1.0-10), liblinux-inotify2-perl, debconf (>= 0.5) | debconf-2.0, netcat-traditional, pve-cluster (>= 1.0-29), libpve-common-perl, libpve-storage-perl, libterm-readline-gnu-perl, libpve-access-control (>= 3.0-2), libio-socket-ssl-perl, libfilesys-df-perl, libfile-readbackwards-perl, libfile-sync-perl, redhat-cluster-pve, resource-agents-pve, fence-agents-pve, cstream, postfix | mail-transport-agent, libxml-parser-perl, lzop, dtach, libanyevent-perl, liburi-perl, logrotate, libanyevent-http-perl, apt-transport-https, libapt-pkg-perl, libcrypt-ssleay-perl, liblwp-protocol-https-perl, spiceterm, libuuid-perl, hdparm, gdisk, librados2-perl, pve-firewall, novnc-pve, libev-perl
+Depends: perl (>= 5.10.0-19), libtimedate-perl, libauthen-pam-perl, libintl-perl, rsync, libjson-perl, liblockfile-simple-perl, vncterm, qemu-server (>= 1.1-1), libwww-perl (>= 6.04-1), libnet-http-perl (>= 6.06-1), libhttp-daemon-perl, wget, libnet-dns-perl, vlan, ifenslave-2.6 (>= 1.1.0-10), liblinux-inotify2-perl, debconf (>= 0.5) | debconf-2.0, netcat-traditional, pve-cluster (>= 1.0-29), libpve-common-perl, libpve-storage-perl, libterm-readline-gnu-perl, libpve-access-control (>= 3.0-2), libio-socket-ssl-perl, libfilesys-df-perl, libfile-readbackwards-perl, libfile-sync-perl, cstream, postfix | mail-transport-agent, libxml-parser-perl, lzop, dtach, libanyevent-perl, liburi-perl, logrotate, libanyevent-http-perl, apt-transport-https, libapt-pkg-perl, libcrypt-ssleay-perl, liblwp-protocol-https-perl, spiceterm, libuuid-perl, hdparm, gdisk, librados2-perl, pve-firewall, novnc-pve, libev-perl, systemd
 Conflicts: netcat-openbsd, vzdump
 Replaces: vzdump
 Provides: vzdump
index af587c739aa7d839506417ffd5de4f1ef9ad5271..65a2b644ebf91ba7a4863fcf38af0f761eaef85b 100755 (executable)
@@ -24,11 +24,12 @@ case "$1" in
     # test if /etc/pve is mounted; else simple exit to avoid
     # error during updates
     test -f /etc/pve/local/pve-ssl.pem || exit 0;
-
-    test -e /proxmox_install_mode || invoke-rc.d pvedaemon restart
-    test -e /proxmox_install_mode || invoke-rc.d pvestatd restart    
-    test -e /proxmox_install_mode || invoke-rc.d pveproxy restart
-    test -e /proxmox_install_mode || invoke-rc.d spiceproxy restart
+    test -e /proxmox_install_mode && exit 0;
+    
+    deb-systemd-invoke restart pvedaemon.service 
+    deb-systemd-invoke restart pvestatd.service    
+    deb-systemd-invoke restart pveproxy.service
+    deb-systemd-invoke restart spiceproxy.service
 
     exit 0;;
 
@@ -57,23 +58,37 @@ case "$1" in
     fi
 
     # disable fancy init messages (bad with bootlogd)
-    test -f /etc/lsb-base-logging.sh || echo "FANCYTTY=0" >/etc/lsb-base-logging.sh 
-
-    update-rc.d pvedaemon defaults 21 79 >/dev/null
-    update-rc.d pveproxy defaults 21 79 >/dev/null
-    update-rc.d spiceproxy defaults 21 79 >/dev/null
-    update-rc.d pvestatd defaults 21 79 >/dev/null
-    update-rc.d pvebanner start 99 2 3 4 5 . >/dev/null
-    update-rc.d pvenetcommit start 15 S . >/dev/null
-    update-rc.d pve-manager defaults 25 75 >/dev/null
-
-    test -e /proxmox_install_mode || invoke-rc.d pvedaemon restart
-    test -e /proxmox_install_mode || invoke-rc.d pveproxy restart
-    test -e /proxmox_install_mode || invoke-rc.d spiceproxy restart
-    test -e /proxmox_install_mode || invoke-rc.d pvestatd restart
+    test -f /etc/lsb-base-logging.sh || echo "FANCYTTY=0" >/etc/lsb-base-logging.sh
+
+
+    systemctl --system daemon-reload >/dev/null || true
+
+    # same as dh_systemd_enable (code copied)
+
+    for service in pvedaemon pveproxy spiceproxy pvestatd pvebanner pvenetcommit pve-manager; do
+       deb-systemd-helper unmask $service.service >/dev/null || true
+
+       # was-enabled defaults to true, so new installations run enable.
+       if deb-systemd-helper --quiet was-enabled $service.service; then
+           # Enables the unit on first installation, creates new
+           # symlinks on upgrades if the unit file has changed.
+           deb-systemd-helper enable $service.service >/dev/null || true
+       else
+           # Update the statefile to add new symlinks (if any), which need to be
+           # cleaned up on purge. Also remove old symlinks.
+           deb-systemd-helper update-state $service.service >/dev/null || true
+       fi
+    done
+
+    if test ! -e /proxmox_install_mode; then
+
+       for service in pvedaemon pveproxy spiceproxy pvestatd; do
+           deb-systemd-invoke restart $service
+       done
+    fi
     
     # rewrite banner
-    test -e /proxmox_install_mode || pvebanner || /bin/true
+    test -e /proxmox_install_mode || pvebanner || true
 
     #a2ensite pve.conf >/dev/null 2>&1
 
index f5b9f764cbac95da88d1a63241e67db9c826bf91..0925abcc01ea1a59dd30940d89cdfb1f5021cb43 100755 (executable)
@@ -3,17 +3,40 @@
 # Abort if any command returns an error value
 set -e
 
-if [ "$1" = purge ]; then
-    update-rc.d pvedaemon remove >/dev/null 2>&1
-    update-rc.d pveproxy remove >/dev/null 2>&1
-    update-rc.d spiceproxy remove >/dev/null 2>&1
-    update-rc.d pvestatd remove >/dev/null 2>&1
-    update-rc.d pvebanner remove >/dev/null 2>&1
-    update-rc.d pvenetcommit remove >/dev/null 2>&1
-    update-rc.d pve-manager remove >/dev/null 2>&1
+case "$1" in
+    purge)
+       rm -rf /var/log/pveproxy
+       rm -rf /var/lib/pve-manager
+    ;;
+
+    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# same as dh_systemd_enable (code copied)
+systemctl --system daemon-reload >/dev/null || true
 
-    if [ -e /usr/share/debconf/confmodule ]; then
-       . /usr/share/debconf/confmodule
-       db_purge
-    fi
+PVESERVICES="pvedaemon pveproxy spiceproxy pvestatd pvebanner pvenetcommit pve-manager"
+if [ "$1" = "remove" ]; then
+    for service in ${PVESERVICES}; do
+       echo "REMOVETEST $service";
+       if [ -x "/usr/bin/deb-systemd-helper" ]; then
+           deb-systemd-helper mask $service.service >/dev/null
+       fi
+    done
+fi
+
+if [ "$1" = purge ]; then
+    for service in ${PVESERVICES}; do
+       echo "PURGETEST $service";
+       if [ -x "/usr/bin/deb-systemd-helper" ]; then
+           deb-systemd-helper purge $service.service >/dev/null
+           deb-systemd-helper unmask $service.service >/dev/null
+       fi
+    done
 fi
index 021ec3eaee868ac1fb41afdac51b1399cff19aad..21624c21cfc4eec5df34da1a799c05b5956a489e 100644 (file)
@@ -9,6 +9,7 @@ PERLLIBDIR=${DESTDIR}/usr/share/perl5
 MAN1DIR=${DESTDIR}/usr/share/man/man1
 CRONDAILYDIR=${DESTDIR}/etc/cron.daily
 INITDBINDIR=${DESTDIR}/etc/init.d
+SERVICEDIR=${DESTDIR}/lib/systemd/system
 HARADIR=${DESTDIR}/usr/share/cluster
 DOCDIR=${DESTDIR}/usr/share/doc/${PACKAGE}
 PODDIR=${DESTDIR}/usr/share/doc/${PACKAGE}/pod