From 2b9bed2e987abd8ce4feb1c738f9f8b99152c84a Mon Sep 17 00:00:00 2001 From: santic-zombie Date: Sun, 3 Jul 2022 11:40:01 +0300 Subject: [PATCH] Init commit --- APKBUILD | 105 ++++++++++++++++++++++++++++++++++++++ opennebula | 46 +++++++++++++++++ opennebula-flow | 36 +++++++++++++ opennebula-gate | 36 +++++++++++++ opennebula-hem | 36 +++++++++++++ opennebula-novnc | 28 ++++++++++ opennebula-scheduler | 36 +++++++++++++ opennebula-ssh-agent | 46 +++++++++++++++++ opennebula-sunstone | 30 +++++++++++ opennebula.install | 35 +++++++++++++ opennebula.logrotate | 43 ++++++++++++++++ opennebula.post-deinstall | 4 ++ opennebula.post-install | 13 +++++ opennebula.post-upgrade | 5 ++ opennebula.pre-deinstall | 4 ++ opennebula.pre-install | 4 ++ svn.patch | 20 ++++++++ 17 files changed, 527 insertions(+) create mode 100644 APKBUILD create mode 100644 opennebula create mode 100644 opennebula-flow create mode 100644 opennebula-gate create mode 100644 opennebula-hem create mode 100644 opennebula-novnc create mode 100644 opennebula-scheduler create mode 100644 opennebula-ssh-agent create mode 100644 opennebula-sunstone create mode 100644 opennebula.install create mode 100644 opennebula.logrotate create mode 100644 opennebula.post-deinstall create mode 100644 opennebula.post-install create mode 100644 opennebula.post-upgrade create mode 100644 opennebula.pre-deinstall create mode 100644 opennebula.pre-install create mode 100644 svn.patch diff --git a/APKBUILD b/APKBUILD new file mode 100644 index 0000000..1362cf0 --- /dev/null +++ b/APKBUILD @@ -0,0 +1,105 @@ +# Contributor: Santic +# Maintainer: Santic +pkgname=opennebula +pkgver=6.2.2 +pkgrel=1 +pkgdesc="OpenNebula Server and Scheduler (Community Edition)" +url="https://opennebula.io/" +arch="x86_64" +license="Apache" +depends="libvncserver + gnutls + libnsl + alpine-sdk + linux-headers + npm + ronn + mariadb-server-utils + mariadb-client + libxml2 + xmlrpc-c + g++ + ruby-nokogiri + ruby-rexml + ruby-xmlrpc + ruby-bundler + ruby-pg + ruby-augeas + libpg_query" +makedepends="bash + python2 + libvncserver-dev + gnutls-dev + libnsl-dev + openssl-dev + sqlite-dev + czmq-dev + mariadb-dev + ruby-dev + libxml2-dev + xmlrpc-c-dev + scons + make + augeas-dev + curl-dev + libpq-dev" +install="${pkgname}.pre-install + ${pkgname}.post-install + ${pkgname}.post-upgrade + ${pkgname}.pre-deinstall + ${pkgname}.post-deinstall" +source="https://github.com/OpenNebula/one/archive/release-${pkgver}.tar.gz + svn.patch + opennebula + opennebula-scheduler + opennebula-novnc + opennebula-sunstone + opennebula-hem + opennebula-flow + opennebula-gate + opennebula-ssh-agent + opennebula.logrotate + " +builddir="$srcdir/" + +prepare() { + cd "one-release-${pkgver}" + patch -p0 < "${srcdir}/svn.patch" + npm config set python python2.7 + npm install bower grunt -g +} + +build() { + cd "one-release-${pkgver}" + CXXFLAGS="--std=c++14" scons -j2 new_xmlrpc=yes mysql=yes sqlite=yes sunstone=yes systemd=no +} + +package() { + cd "one-release-${pkgver}" + + install -D -m644 "${srcdir}/opennebula" "${pkgdir}/etc/init.d/opennebula" + install -D -m644 "${srcdir}/opennebula-scheduler" "${pkgdir}/etc/init.d/opennebula-scheduler" + install -D -m644 "${srcdir}/opennebula-novnc" "${pkgdir}/etc/init.d/opennebula-novnc" + install -D -m644 "${srcdir}/opennebula-sunstone" "${pkgdir}/etc/init.d/opennebula-sunstone" + install -D -m644 "${srcdir}/opennebula-hem" "${pkgdir}/etc/init.d/opennebula-hem" + install -D -m644 "${srcdir}/opennebula-flow" "${pkgdir}/etc/init.d/opennebula-flow" + install -D -m644 "${srcdir}/opennebula-gate" "${pkgdir}/etc/init.d/opennebula-gate" + install -D -m644 "${srcdir}/opennebula-ssh-agent" "${pkgdir}/etc/init.d/opennebula-ssh-agent" + install -D -m644 "${srcdir}/opennebula.logrotate" "${pkgdir}/etc/logrotate.d/opennebula.logrotate" + + DESTDIR="${pkgdir}" ./install.sh -u oneadmin -g cloud +} + +sha512sums=" +292a1a3a823d4ec3e6cdec59b0f9fbf81125d0541bc8a2e234343f59fc9c4e7f2f2f1cd14463211a8c750bb902021dc1389a47927ad491a1cee2fa064307e813 release-6.2.2.tar.gz +1e2c5da5c2ab49ab355550568985cc538d591198343ec468277d0bb5106275fb4cf7e2acdc26868c79803313a4aec935568370b723bce3384c7e056f26fa9066 svn.patch +121d43da2299a8f347dfff2124253617d2d4f175bafe5f14687a58e72ada60f08fbdcba1b5dbdc48434c226a6f75b46eb2e9203f8549733d1393ca348f5a00ff opennebula +c3d85c11a1e6f9ae05a45378ba398ac68ee2a8b961f0f24e394bbdf92c83c8fcc64c5619819afc1b2e563607e99bd6402744fba396bd3c6c4f48c0a8b09f897e opennebula-scheduler +6c5127d4b515777bba83236623066f300f0f8a6086a19848b72edb9cdb74fd906595d02b971de91d67585e79d8d419e5a66d3cc69c55d898561c4a5f74a303d3 opennebula-novnc +99510f519200d16b65c6fef50cfbc6f88950453759b8e2eab3e729bc8329fbb605dbe7fa6c11febccac6ded0cd1328aef9d1137028a0083e0a9de0a51d357dfc opennebula-sunstone +17a0d28b60301c59fc4a6fbeaf759c5d075981b000ef93f67e151f16c0ec339de3e0b4b6ead1ca33903428394abdea40eac907a419f136ba7a1b6fa8965e1422 opennebula-hem +1ac94e85f3ebe43e51d87a75560d7d7aa48f291326d7b049381329435a7ed575fbfd1dbf23ff9c055bbb900994aa61885a2b7efb7c3e92c21d1d203b8d047231 opennebula-flow +fdb1eeacb5767cae78829295551a0e924e31d6b47f899fb341652607b8efe5b630c0233835e940f5d8577632d223ab46a87eee2ebce36a1b43077aa561ac47e3 opennebula-gate +121d43da2299a8f347dfff2124253617d2d4f175bafe5f14687a58e72ada60f08fbdcba1b5dbdc48434c226a6f75b46eb2e9203f8549733d1393ca348f5a00ff opennebula-ssh-agent +a6c33276b527e8aafd39815688dbdf8dbfaa4e1ab5b708e44b48c6b358bba2dd4c2225a7e4647b438a2396ed6fd159a3421fe2798f0f954e250d3bef8a57a742 opennebula.logrotate +" diff --git a/opennebula b/opennebula new file mode 100644 index 0000000..38e1fb5 --- /dev/null +++ b/opennebula @@ -0,0 +1,46 @@ +#!/sbin/openrc-run + +name=$RC_SVCNAME +description="OpenNebula management" +command="/usr/bin/oned" +command_args="-f" +command_user="oneadmin:oneadmin" +pidfile="/run/one/${RC_SVCNAME}.pid" +supervisor="supervise-daemon" + +depend() { + need mariadb + after syslog networking localmount netmount + want opennebula-scheduler opennebula-hem opennebula-ssh-agent +} + +start_pre() { + /bin/mkdir -p /var/log/one + /bin/mkdir -p /var/lock/one + /bin/mkdir -p /run/one + /bin/chown $command_user -R /var/log/one /run/one /var/lock/one + /usr/sbin/logrotate -s /tmp/logrotate.state -f /etc/logrotate.d/opennebula.logrotate +} + +start() { + ebegin "Starting $RC_SVCNAME" + start-stop-daemon --background \ + --exec $command \ + --make-pidfile --pidfile $pidfile --user $command_user \ + --start -- $command_args + eend $? +} + +stop() { + ebegin "Stopping $RC_SVCNAME" + start-stop-daemon --stop \ + --retry TERM/10/KILL/10 \ + --exec $command \ + --pidfile $pidfile --user $command_user + eend $? +} + +stop_post() { + /bin/rm -f /var/lock/one/one + /usr/share/one/follower_cleanup +} diff --git a/opennebula-flow b/opennebula-flow new file mode 100644 index 0000000..de87e34 --- /dev/null +++ b/opennebula-flow @@ -0,0 +1,36 @@ +#!/sbin/openrc-run + +name=$RC_SVCNAME +description="OpenNebula Flow Service" +command="/usr/bin/ruby /usr/lib/one/oneflow/oneflow-server.rb" +command_user="oneadmin:oneadmin" +pidfile="/run/one/${RC_SVCNAME}.pid" +supervisor="supervise-daemon" + +depend() { + after syslog networking netmount opennebula +} + +start_pre() { + /bin/mkdir -p /var/log/one + /bin/mkdir -p /var/lock/one + /bin/mkdir -p /run/one + /bin/chown $command_user -R /var/log/one /run/one /var/lock/one +} + +start() { + ebegin "Starting $RC_SVCNAME" + start-stop-daemon --background \ + --exec $command \ + --make-pidfile --pidfile $pidfile --user $command_user \ + --start + eend $? +} + +stop() { + ebegin "Stopping $RC_SVCNAME" + start-stop-daemon --stop \ + --exec $command \ + --pidfile $pidfile --user $command_user + eend $? +} diff --git a/opennebula-gate b/opennebula-gate new file mode 100644 index 0000000..d93c80a --- /dev/null +++ b/opennebula-gate @@ -0,0 +1,36 @@ +#!/sbin/openrc-run + +name=$RC_SVCNAME +description="OpenNebula Gate Daemon" +command="/usr/bin/ruby /usr/lib/one/onegate/onegate-server.rb" +command_user="oneadmin:oneadmin" +pidfile="/run/one/${RC_SVCNAME}.pid" +supervisor="supervise-daemon" + +depend() { + after syslog networking netmount opennebula +} + +start_pre() { + /bin/mkdir -p /var/log/one + /bin/mkdir -p /var/lock/one + /bin/mkdir -p /run/one + /bin/chown $command_user -R /var/log/one /run/one /var/lock/one +} + +start() { + ebegin "Starting $RC_SVCNAME" + start-stop-daemon --background \ + --exec $command \ + --make-pidfile --pidfile $pidfile --user $command_user \ + --start + eend $? +} + +stop() { + ebegin "Stopping $RC_SVCNAME" + start-stop-daemon --stop \ + --exec $command \ + --pidfile $pidfile --user $command_user + eend $? +} diff --git a/opennebula-hem b/opennebula-hem new file mode 100644 index 0000000..4450a97 --- /dev/null +++ b/opennebula-hem @@ -0,0 +1,36 @@ +#!/sbin/openrc-run + +name=$RC_SVCNAME +description="OpenNebula Hook Execution Service" +command="/usr/bin/ruby /usr/lib/one/onehem/onehem-server.rb" +command_user="oneadmin:oneadmin" +pidfile="/run/one/${RC_SVCNAME}.pid" +supervisor="supervise-daemon" + +depend() { + after syslog networking netmount opennebula +} + +start_pre() { + /bin/mkdir -p /var/log/one + /bin/mkdir -p /var/lock/one + /bin/mkdir -p /run/one + /bin/chown $command_user -R /var/log/one /run/one /var/lock/one +} + +start() { + ebegin "Starting $RC_SVCNAME" + start-stop-daemon --background \ + --exec $command \ + --make-pidfile --pidfile $pidfile --user $command_user \ + --start + eend $? +} + +stop() { + ebegin "Stopping $RC_SVCNAME" + start-stop-daemon --stop \ + --exec $command \ + --pidfile $pidfile --user $command_user + eend $? +} diff --git a/opennebula-novnc b/opennebula-novnc new file mode 100644 index 0000000..38bc7af --- /dev/null +++ b/opennebula-novnc @@ -0,0 +1,28 @@ +#!/sbin/openrc-run + +name=$RC_SVCNAME +description="OpenNebula noVNC Server" +command="/usr/bin/novnc-server" +command_user="oneadmin:oneadmin" +supervisor="supervise-daemon" + +depend() { + before opennebula-sunstone + after syslog networking netmount +} + +start() { + ebegin "Starting $RC_SVCNAME" + start-stop-daemon \ + --exec $command \ + --user $command_user \ + --start -- start + eend $? +} + +stop() { + ebegin "Stopping $RC_SVCNAME" + $command stop + /bin/rm -f /var/lock/one/.novnc.lock + eend $? +} diff --git a/opennebula-scheduler b/opennebula-scheduler new file mode 100644 index 0000000..7486d33 --- /dev/null +++ b/opennebula-scheduler @@ -0,0 +1,36 @@ +#!/sbin/openrc-run + +name=$RC_SVCNAME +description="OpenNebula Cloud Scheduler Daemon" +command="/usr/bin/mm_sched" +command_user="oneadmin:oneadmin" +pidfile="/run/one/${RC_SVCNAME}.pid" +supervisor="supervise-daemon" + +depend() { + after syslog networking netmount opennebula +} + +start_pre() { + /bin/mkdir -p /var/log/one + /bin/mkdir -p /var/lock/one + /bin/mkdir -p /run/one + /bin/chown $command_user -R /var/log/one /run/one /var/lock/one +} + +start() { + ebegin "Starting $RC_SVCNAME" + start-stop-daemon --background \ + --exec $command \ + --make-pidfile --pidfile $pidfile --user $command_user \ + --start + eend $? +} + +stop() { + ebegin "Stopping $RC_SVCNAME" + start-stop-daemon --stop \ + --exec $command \ + --pidfile $pidfile --user $command_user + eend $? +} diff --git a/opennebula-ssh-agent b/opennebula-ssh-agent new file mode 100644 index 0000000..38e1fb5 --- /dev/null +++ b/opennebula-ssh-agent @@ -0,0 +1,46 @@ +#!/sbin/openrc-run + +name=$RC_SVCNAME +description="OpenNebula management" +command="/usr/bin/oned" +command_args="-f" +command_user="oneadmin:oneadmin" +pidfile="/run/one/${RC_SVCNAME}.pid" +supervisor="supervise-daemon" + +depend() { + need mariadb + after syslog networking localmount netmount + want opennebula-scheduler opennebula-hem opennebula-ssh-agent +} + +start_pre() { + /bin/mkdir -p /var/log/one + /bin/mkdir -p /var/lock/one + /bin/mkdir -p /run/one + /bin/chown $command_user -R /var/log/one /run/one /var/lock/one + /usr/sbin/logrotate -s /tmp/logrotate.state -f /etc/logrotate.d/opennebula.logrotate +} + +start() { + ebegin "Starting $RC_SVCNAME" + start-stop-daemon --background \ + --exec $command \ + --make-pidfile --pidfile $pidfile --user $command_user \ + --start -- $command_args + eend $? +} + +stop() { + ebegin "Stopping $RC_SVCNAME" + start-stop-daemon --stop \ + --retry TERM/10/KILL/10 \ + --exec $command \ + --pidfile $pidfile --user $command_user + eend $? +} + +stop_post() { + /bin/rm -f /var/lock/one/one + /usr/share/one/follower_cleanup +} diff --git a/opennebula-sunstone b/opennebula-sunstone new file mode 100644 index 0000000..c092b14 --- /dev/null +++ b/opennebula-sunstone @@ -0,0 +1,30 @@ +#!/sbin/openrc-run + +name=$RC_SVCNAME +description="OpenNebula Web UI Server" +command="/usr/bin/ruby /usr/lib/one/sunstone/sunstone-server.rb" +command_user="oneadmin:oneadmin" +pidfile="/run/one/${RC_SVCNAME}.pid" +supervisor="supervise-daemon" + +depend() { + after syslog networking netmount opennebula + want opennebula-novnc +} + +start() { + ebegin "Starting $RC_SVCNAME" + start-stop-daemon --background \ + --exec $command \ + --make-pidfile --pidfile $pidfile --user $command_user \ + --start + eend $? +} + +stop() { + ebegin "Stopping $RC_SVCNAME" + start-stop-daemon --stop \ + --exec $command \ + --pidfile $pidfile --user $command_user + eend $? +} diff --git a/opennebula.install b/opennebula.install new file mode 100644 index 0000000..45b045b --- /dev/null +++ b/opennebula.install @@ -0,0 +1,35 @@ +pre-install() { + groupadd cloud + useradd -m -g cloud -c "OpenNebula administrator account" -s /bin/ash oneadmin +} + +post-install() { + # Append the oneadmin credentials to one_auth to avoid overwriting a file + # that may already exist + usermod -m -d /var/lib/one oneadmin + if [ ! -f /var/lib/one/.one/one_auth ]; then + mkdir -p /var/lib/one/.one/ + echo 'oneadmin:0neadm1n' >> /var/lib/one/.one/one_auth + echo ">> You must edit the password in /var/lib/one/.one/one_auth" + fi + chown oneadmin:cloud -R /var/log/one /var/lib/one /run/one /run/lock/one + echo ">> To install required gems run as a local user:" + echo ">> bundler install --gemfile /usr/share/one/Gemfile" +} + +post-upgrade(){ + chown oneadmin:cloud -R /var/lib/one/sunstone + printf "NOTE: This is may be an major upgrade! If you are not installing from scratch, check the compatibility guide at:\n\n\thttp://docs.opennebula.org/5.10/intro_release_notes/release_notes/compatibility.html\n\thttp://docs.opennebula.org/5.10/intro_release_notes/upgrades/index.html\n" + echo ">> To install required gems run as a local user:" + echo ">> bundler install --gemfile /usr/share/one/Gemfile" +} + +pre-deinstall() { + userdel -r oneadmin && echo ">> User 'oneadmin' has been removed." + groupdel cloud && echo ">> Group 'cloud' has been removed." +} + +post-deinstall() { + echo ">> You can uninstall the Ruby gems if no other packages require them." + echo ">> For example, 'gem uninstall sequel' would uninstall the 'sequel' Ruby gem." +} diff --git a/opennebula.logrotate b/opennebula.logrotate new file mode 100644 index 0000000..89b0b71 --- /dev/null +++ b/opennebula.logrotate @@ -0,0 +1,43 @@ +delaycompress +dateext +dateformat -%Y%m%d-%s + +compress +weekly +rotate 4 + +/var/log/one/one_xmlrpc.log { + missingok + notifempty + copytruncate +} + +/var/log/one/oned.log { + missingok + notifempty + copytruncate +} + +/var/log/one/sched.log { + missingok + notifempty + copytruncate +} + +/var/log/one/onehem.log { + missingok + notifempty + copytruncate +} + +/var/log/one/onegate.log { + missingok + notifempty + copytruncate +} + +/var/log/one/oneflow.log { + missingok + notifempty + copytruncate +} diff --git a/opennebula.post-deinstall b/opennebula.post-deinstall new file mode 100644 index 0000000..4de4077 --- /dev/null +++ b/opennebula.post-deinstall @@ -0,0 +1,4 @@ +#!/bin/sh +echo ">> You can uninstall the Ruby gems if no other packages require them." +echo ">> For example, 'gem uninstall sequel' would uninstall the 'sequel' Ruby gem." +exit 0 diff --git a/opennebula.post-install b/opennebula.post-install new file mode 100644 index 0000000..8bf6f35 --- /dev/null +++ b/opennebula.post-install @@ -0,0 +1,13 @@ +#!/bin/sh +# Append the oneadmin credentials to one_auth to avoid overwriting a file +# that may already exist +usermod -m -d /var/lib/one oneadmin +if [ ! -f /var/lib/one/.one/one_auth ]; then + mkdir -p /var/lib/one/.one/ + echo 'oneadmin:0neadm1n' >> /var/lib/one/.one/one_auth + echo ">> You must edit the password in /var/lib/one/.one/one_auth" +fi +chown oneadmin:cloud -R /var/log/one /var/lib/one /run/one /run/lock/one +echo ">> To install required gems run as a local user:" +echo ">> bundler install --gemfile /usr/share/one/Gemfile" +exit 0 diff --git a/opennebula.post-upgrade b/opennebula.post-upgrade new file mode 100644 index 0000000..57ba88a --- /dev/null +++ b/opennebula.post-upgrade @@ -0,0 +1,5 @@ +#!/bin/sh +chown oneadmin:cloud -R /var/lib/one/sunstone +echo ">> To install required gems run as a local user:" +echo ">> bundler install --gemfile /usr/share/one/Gemfile" +exit 0 diff --git a/opennebula.pre-deinstall b/opennebula.pre-deinstall new file mode 100644 index 0000000..4cad350 --- /dev/null +++ b/opennebula.pre-deinstall @@ -0,0 +1,4 @@ +#!/bin/sh +userdel -r oneadmin && echo ">> User 'oneadmin' has been removed." +groupdel cloud && echo ">> Group 'cloud' has been removed." +exit 0 diff --git a/opennebula.pre-install b/opennebula.pre-install new file mode 100644 index 0000000..979b5fe --- /dev/null +++ b/opennebula.pre-install @@ -0,0 +1,4 @@ +#!/bin/sh +groupadd cloud +useradd -m -g cloud -c "OpenNebula administrator account" -s /bin/ash oneadmin +exit 0 diff --git a/svn.patch b/svn.patch new file mode 100644 index 0000000..7361d2c --- /dev/null +++ b/svn.patch @@ -0,0 +1,20 @@ +Index: src/svncterm_server/genfont.c +--- src/svncterm_server/genfont.c ++++ src/svncterm_server/genfont.c +@@ -31,6 +31,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -77,6 +78,8 @@ + unsigned int height, width; /* max dimensions of glyphs */ + /* charsize = height * ((width + 7) / 8) */ + }; ++ ++typedef uint16_t u_int16_t; + + /* -------------------------------------------------------------------------- */ + /* Font map management */