Changes in structure

This commit is contained in:
santic-zombie
2022-07-10 23:39:29 +03:00
parent c6e95bcc08
commit 6e372a5d4e
21 changed files with 0 additions and 0 deletions

115
opennebula/APKBUILD Normal file
View File

@@ -0,0 +1,115 @@
# Contributor: Santic <email@santic-zombie.ru>
# Maintainer: Santic <email@santic-zombie.ru>
pkgname=opennebula
pkgver=6.4.0
pkgrel=1
pkgdesc="OpenNebula Server and Scheduler (Community Edition)"
url="https://opennebula.io/"
arch="x86_64"
options="!check"
license="Apache"
depends="augeas
curl
czmq
gnutls
g++
libvncserver
libnsl
libpg_query
libpq
libxml2
logrotate
mariadb
mariadb-client
mariadb-server-utils
npm
openssl
ruby
ruby-augeas
ruby-bundler
ruby-nokogiri
ruby-pg
ruby-rexml
ruby-xmlrpc
shadow
sqlite
sqlite-static
xmlrpc-c"
makedepends="alpine-sdk
augeas-dev
bash
curl-dev
czmq-dev
gnutls-dev
libnsl-dev
libpq-dev
libvncserver-dev
libxml2-dev
linux-headers
mariadb-dev
make
openssl-dev
python3
ronn
ruby-dev
scons
sqlite-dev
xmlrpc-c-dev"
install="${pkgname}.pre-install
${pkgname}.post-install
${pkgname}.post-upgrade
${pkgname}.pre-deinstall
${pkgname}.post-deinstall"
source="https://downloads.opennebula.io/packages/opennebula-${pkgver}/opennebula-${pkgver}.tar.gz
Gruntfile.patch
package.patch
svn.patch
opennebula
opennebula-scheduler
opennebula-novnc
opennebula-sunstone
opennebula-hem
opennebula-flow
opennebula-gate
opennebula-ssh-agent
opennebula.logrotate"
builddir="$srcdir/"
prepare() {
cd "opennebula-${pkgver}"
patch -p0 < "${srcdir}/Gruntfile.patch"
patch -p0 < "${srcdir}/package.patch"
patch -p0 < "${srcdir}/svn.patch"
rm -rf "${HOME}/.npm-packages"
mkdir "${HOME}/.npm-packages"
npm config set prefix "${HOME}/.npm-packages"
NPM_PACKAGES="${HOME}/.npm-packages"
export PATH="$PATH:$NPM_PACKAGES/bin"
npm install bower grunt -g
}
build() {
cd "opennebula-${pkgver}"
CXXFLAGS="--std=c++14" scons -j2 new_xmlrpc=yes mysql=yes sqlite=yes sunstone=yes systemd=no
}
package() {
cd "opennebula-${pkgver}"
install -D -m755 "${srcdir}/opennebula" "${pkgdir}/etc/init.d/opennebula"
install -D -m755 "${srcdir}/opennebula-scheduler" "${pkgdir}/etc/init.d/opennebula-scheduler"
install -D -m755 "${srcdir}/opennebula-novnc" "${pkgdir}/etc/init.d/opennebula-novnc"
install -D -m755 "${srcdir}/opennebula-sunstone" "${pkgdir}/etc/init.d/opennebula-sunstone"
install -D -m755 "${srcdir}/opennebula-hem" "${pkgdir}/etc/init.d/opennebula-hem"
install -D -m755 "${srcdir}/opennebula-flow" "${pkgdir}/etc/init.d/opennebula-flow"
install -D -m755 "${srcdir}/opennebula-gate" "${pkgdir}/etc/init.d/opennebula-gate"
install -D -m755 "${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
}

View File

@@ -0,0 +1,22 @@
Index: src/sunstone/public/Gruntfile.js
--- src/sunstone/public/Gruntfile.js
+++ src/sunstone/public/Gruntfile.js
@@ -14,6 +14,8 @@
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
+const sass = require('node-sass');
+
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
@@ -24,7 +26,8 @@
},
dist: {
options: {
- outputStyle: "compressed"
+ outputStyle: "compressed",
+ implementation: sass
},
files: {
"css/app.css": "scss/app.scss"

40
opennebula/README.md Normal file
View File

@@ -0,0 +1,40 @@
# APKBUILD
## Prepare
```
# apk add alpine-sdk sudo
# visudo
```
```
# addgroup <yourusername> abuild
```
```
# mkdir -p /var/cache/distfiles
# chmod a+w /var/cache/distfiles
```
```
abuild-keygen -a -i
```
```
apk add shadow
```
```
useradd -m -g cloud -c "OpenNebula administrator account" -s /bin/ash oneadmin
```
## Build
```
abuild checksum
```
```
abuild -r
```

View File

@@ -0,0 +1,30 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula Flow Service"
command="/usr/bin/ruby /usr/lib/one/oneflow/oneflow-server.rb"
command_user="oneadmin:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
need opennebula
after syslog networking netmount
}
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 $?
}

View File

@@ -0,0 +1,30 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula Gate Daemon"
command="/usr/bin/ruby /usr/lib/one/onegate/onegate-server.rb"
command_user="oneadmin:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
need opennebula
after syslog networking netmount
}
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 $?
}

30
opennebula/opennebula-hem Normal file
View File

@@ -0,0 +1,30 @@
#!/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:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
need opennebula
after syslog networking netmount
}
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 $?
}

View File

@@ -0,0 +1,28 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula noVNC Server"
command="/usr/bin/novnc-server"
command_user="oneadmin:cloud"
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 $?
}

View File

@@ -0,0 +1,30 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula Cloud Scheduler Daemon"
command="/usr/bin/mm_sched"
command_user="oneadmin:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
need opennebula
after syslog networking netmount
}
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 $?
}

View File

@@ -0,0 +1,46 @@
#!/sbin/openrc-run
name=$RC_SVCNAME
description="OpenNebula management"
command="/usr/bin/oned"
command_args="-f"
command_user="oneadmin:cloud"
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
}

View File

@@ -0,0 +1,31 @@
#!/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:cloud"
pidfile="/run/one/${RC_SVCNAME}.pid"
supervisor="supervise-daemon"
depend() {
need opennebula
after syslog networking netmount
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 $?
}

View File

@@ -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
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,4 @@
#!/bin/sh
groupadd cloud
useradd -m -g cloud -c "OpenNebula administrator account" -s /bin/ash oneadmin
exit 0

13
opennebula/package.patch Normal file
View File

@@ -0,0 +1,13 @@
Index: src/sunstone/public/package.json
--- src/sunstone/public/package.json
+++ src/sunstone/public/package.json
@@ -6,7 +6,7 @@
"grunt-cli": "1.3.2",
"grunt-contrib-requirejs": "1.0.0",
"grunt-contrib-watch": "1.1.0",
- "grunt-sass": "2.1.0",
- "node-sass": "4.14.1"
+ "grunt-sass": "3.1.0",
+ "node-sass": "7.0.1"
}
}

View File

@@ -0,0 +1,117 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2022, OpenNebula Project, OpenNebula Systems */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
const sass = require('node-sass');
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
sass: {
options: {
includePaths: ["bower_components/foundation-sites/scss"]
},
dist: {
options: {
outputStyle: "compressed",
implementation: sass
},
files: {
"css/app.css": "scss/app.scss"
}
}
},
watch: {
grunt: {
files: ["Gruntfile.js"]
},
sass: {
files: "scss/*.scss",
tasks: ["sass"]
},
requirejs: {
files: "app/**/*.js",
tasks: ["requirejs"]
}
},
requirejs: {
compileCSS: {
options: {
out: "./css/app.min.css",
cssIn: "./css/app.css",
optimizeCss: "default"
}
},
compileJS: {
options: {
appDir: "./app",
baseUrl: "./", // 1
dir: "./dist", // 2
//name: 'vendor/almond', // 3
mainConfigFile: "./app/main.js", // 5
preserveLicenseComments: false,
optimize: "none",
generateSourceMaps: true,
removeCombined: true,
//skipDirOptimize: false,
//findNestedDependencies: true,
modules: [
{
name: "main",
include: ["almond"]
},
{
name: "login",
include: ["almond"],
insertRequire: ["login"]
},
{
name: "console/vnc",
include: ["almond"],
insertRequire: ["console/vnc"]
},
{
name: "console/vmrc",
include: ["almond"],
insertRequire: ["console/vmrc"]
},
{
name: "console/spice",
include: ["almond"],
insertRequire: ["console/spice"]
},
{
name: "console/guacamole",
include: ["almond"],
insertRequire: ["console/guacamole"]
}
]
}
}
}
});
grunt.loadNpmTasks("grunt-sass");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-requirejs");
grunt.registerTask("build", ["sass"]);
grunt.registerTask("default", ["build","watch"]);
};

View File

@@ -0,0 +1,12 @@
{
"name": "opennebula-sunstone",
"version": "0.0.1",
"devDependencies": {
"grunt": "<1.1.0",
"grunt-cli": "1.3.2",
"grunt-contrib-requirejs": "1.0.0",
"grunt-contrib-watch": "1.1.0",
"grunt-sass": "3.1.0",
"node-sass": "7.0.1"
}
}

20
opennebula/svn.patch Normal file
View File

@@ -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 <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include <zlib.h>
#include <string.h>
#include <linux/limits.h>
@@ -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 */