Commit d5410843 authored by Ilya Veselov's avatar Ilya Veselov

add_dpkg

parent 38dc989d
...@@ -34,4 +34,4 @@ dependencies { ...@@ -34,4 +34,4 @@ dependencies {
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.10' compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.10'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9' compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
} }
\ No newline at end of file
build:
#@echo "Setting version in package:"
@echo "Building not required. Binary package."
#debian/tools/set-version.sh
install:
cp -av src/* "${DESTDIR}"
clean:
@echo "Cleaning not required. Binary package."
buildscript {
repositories {
maven {
url 'http://artifactory.lan.arta.kz/artifactory/remote-repos/'
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.netflix.nebula:gradle-ospackage-plugin:4.5.1"
classpath 'org.ajoberstar:gradle-git:0.8.0'
}
}
apply plugin: 'base'
apply plugin: 'nebula.ospackage'
description = 'ARTA Synergy Extensions - Import'
ospackage {
def date = new Date();
maintainer = 'Technology Development Department <tdd@arta.pro>'
packageName = 'arta-synergy-extensions-import'
version = 'import_version'
distribution = 'extensions'
packageGroup = 'non-free'
user = 'root'
permissionGroup = 'root'
from("${projectDir}/src") {
into '/'
}
requires('arta-synergy-synergy', '4.1-r1~200130.034722', GREATER | EQUAL)
requires('curl')
requires('debconf', '0.5', GREATER | EQUAL).or('debconf-2.0')
postInstallFile file("${projectDir}/debian/postinst")
supplementaryControl "${projectDir}/debian/templates"
}
build.finalizedBy buildDeb
defaultTasks 'clean', 'build'
/opt/synergy/jboss/standalone/configuration/arta/apps/kato/kato.properties
Source: arta-synergy-apps-kato
Section: non-free
Priority: extra
Maintainer: Technology Development Department <tdd@arta.pro>
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 3.9.2
Homepage: http://arta.pro
Package: arta-synergy-apps-kato
Architecture: all
Depends: arta-synergy-synergy (>= 3.13-r1~170403.103832), libxml-xpath-perl, libxml2-utils, curl, ${misc:Depends}
Description: ARTA Synergy Apps Collection - kato
ARTA Synergy Apps Collection - kato
Format: http://dep.debian.net/deps/dep5
Upstream-Name: arta-synergy-extensions-kato
Source: <url://example.com>
Files: *
Copyright: <years> <put author's name and email here>
<years> <likewise for another author>
License: <special license>
<Put the license of the package here indented by 1 space>
<This follows the format of Description: lines in control file>
.
<Including paragraphs>
# If you want to use GPL v2 or later for the /debian/* files use
# the following clauses, or change it to suit. Delete these two lines
Files: debian/*
Copyright: 2020 Ilya Vesselov <i.vesselov@arta.pro>
License: GPL-2+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
#!/bin/sh
set -e
# Source debconf library
. /usr/share/debconf/confmodule
get_synergy_url() {
local synergy_url
db_fset arta-synergy-extensions-kato/synergy_url seen false
# Set default value if we ain't got one
db_get arta-synergy-extensions-kato/synergy_url
if [ "$RET" = "" ]; then
db_set arta-synergy-extensions-kato/synergy_url "http://$(hostname -f):8080/Synergy"
fi
# Get url
db_input high arta-synergy-extensions-kato/synergy_url || true
db_go
# Get answer
db_get arta-synergy-extensions-kato/synergy_url
synergy_url="$RET"
echo "$synergy_url"
}
get_synergy_user_login() {
local synergy_user_login
db_fset arta-synergy-extensions-kato/synergy_user_login seen false
# Set default value if we ain't got one
db_get arta-synergy-extensions-kato/synergy_user_login
if [ "$RET" = "" ]; then
db_set arta-synergy-extensions-kato/synergy_user_login "1"
fi
# Get url
db_input high arta-synergy-extensions-kato/synergy_user_login || true
db_go
# Get answer
db_get arta-synergy-extensions-kato/synergy_user_login
synergy_user_login="$RET"
echo "$synergy_user_login"
}
get_synergy_user_password() {
local synergy_user_password
db_fset arta-synergy-extensions-kato/synergy_user_password seen false
# Set default value if we ain't got one
db_get arta-synergy-extensions-kato/synergy_user_password
if [ "$RET" = "" ]; then
db_set arta-synergy-extensions-kato/synergy_user_password "1"
fi
# Get url
db_input high arta-synergy-extensions-kato/synergy_user_password || true
db_go
# Get answer
db_get arta-synergy-extensions-kato/synergy_user_password
synergy_user_password="$RET"
echo "$synergy_user_password"
}
load_kato() {
local kato_data="/opt/synergy/extensions/kato/contents.json"
local kato_app="/opt/synergy/extensions/kato/app-kato.7zip"
local synergy_url=$1
local synergy_user_login=$(get_synergy_user_login)
local synergy_user_password=$(get_synergy_user_password)
# ==============================
# Load Synergy Application
# ==============================
echo -n "Loading Synergy application...\n"
local result="$(curl --write-out "\nstatus=%{http_code}" -s -u "$synergy_user_login:$synergy_user_password" \
-F "data=@$kato_app" \
"$synergy_url/rest/api/app/import")";
# check upload status, if error status not equal to 0, then exit with error
local expected_success_status='"errorCode":0';
if ! $(echo "$result" | grep -q "$expected_success_status"); then
local request_status=$(echo "$result" | grep -o "status=.*");
local message="";
case $request_status in
"status=401") message="error authorizations" ;;
"status=403") message="access denied" ;;
"status=500") message="unknown error" ;;
esac
echo "ERROR: System configuration upload error: $message\nServer response: $result" >&2;
exit 1;
fi
echo "done."
# ==================
# Load KATO data
# ==================
echo -n "Loading KATO data...\n"
local count=0
local ost=0
local limit="$(wc $kato_data -l | cut -f 1 -d ' ')"
while read LINE
do
local result="$(curl -X POST --write-out "\nstatus=%{http_code}" -s -u "$synergy_user_login:$synergy_user_password" \
"$synergy_url/rest/api/registry/create_doc_rcc" \
--header "Content-Type: application/json" \
-d "{\"registryCode\":\"kato\", \"wasOpened\": false, \"sendToActivation\": true, $LINE}")"
# check upload status, if error status not equal to 0, then exit with error
local expected_success_status='"errorCode":0';
if ! $(echo "$result" | grep -q "$expected_success_status"); then
local request_status=$(echo "$result" | grep -o "status=.*");
local message="";
case $request_status in
"status=401") message="error authorizations" ;;
"status=403") message="access denied" ;;
"status=500") message="unknown error" ;;
esac
echo "ERROR: System configuration upload error: $message\nServer response: $result" >&2;
exit 1;
fi
count=$(($count+1))
number=$(($count%100))
if [ "$number" -eq "$ost" ]
then echo "Добавлено записей КАТО: $count из $limit"
else continue
fi
done < $kato_data
echo "done."
}
waiting_synergy_start() {
local synergy_url=$1
local count=0;
local MAX_ATTEMPT_COUNT=300; # ~5 minute
echo -n "Waiting for Synergy to start..."
until wget -q -c -t 0 -O - $synergy_url 2>&1 > /dev/null; do
sleep 1;
if [ ${count} -ge $MAX_ATTEMPT_COUNT ]; then
echo "ERROR: Synergy not available" >&2;
exit 1;
fi
count=$((count + 1))
echo -n "."
done;
# synergy started and api ready
echo "started."
}
case "$1" in
configure)
SYNERGY_URL=$(get_synergy_url)
# TODO: Yes, I know we use some kind of kludge here
# But! we need to decide if we include nginx or something to default setup
# then the solution will be more appropriate
waiting_synergy_start $SYNERGY_URL
load_kato $SYNERGY_URL
# Work around problem described here:
# https://lists.debian.org/debian-mentors/2005/11/msg00067.html
db_stop
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@
Template: arta-synergy-extensions-kato/synergy_url
Type: string
Description: ARTA Synergy instance address:
Please enter the address of your ARTA Synergy installation.
This should contain protocol (http or https), port (if needed), and /Synergy
Template: arta-synergy-extensions-kato/synergy_user_login
Type: string
Default: system
Description: ARTA Synergy user login:
Please enter the login of your ARTA Synergy user.
Template: arta-synergy-extensions-kato/synergy_user_password
Type: password
Default: 1
Description: ARTA Synergy user password:
Please enter the password of your ARTA Synergy user.
#!/bin/bash
set -e
TAR="tar"
CP="cp -v"
PACKAGE_NAME="arta-synergy-extensions-import"
UPSTREAM_VERSION="1.0"
DEFAULT_REPO="extensions"
DEFAULT_URGENCY="low"
AUTHOR="Technology Development Department <tdd@arta.pro>"
CHANGELOG="dpkg/debian/changelog"
SYNERGYPATH="opt/synergy"
JBOSSPATH="${SYNERGYPATH}/jboss"
JBOSSDEPLOY="${JBOSSPATH}/standalone/deployments"
REVISION_LETTER="z"
DESTINATION="${JBOSSDEPLOY}"
DEFAULT_REPO=$1
if [[ $1 == *"master"* ]]
then
DEFAULT_REPO="ier"
REVISION_LETTER="r"
fi
if [[ $1 == *"extensions"* ]]
then
# DEFAULT_REPO="$PRODUCT-$UPSTREAM_VERSION"
REVISION_LETTER="r"
fi
PKG_DIR="PACKAGE"
DSTDIR="${PKG_DIR}/${PACKAGE_NAME}"
VERSIONS_DIR="${DSTDIR}/src/opt/synergy/versions"
BUILD_NUMBER=$(date +"%y%m%d.%H%M%S")
BUILD_TIME=$(date +%F_%H:%m)
PACKAGE_VERSION="${UPSTREAM_VERSION}-${REVISION_LETTER}1~${BUILD_NUMBER}"
rm -rf "${PKG_DIR}"
mkdir -p "${DSTDIR}"
#mkdir -p "${DSTDIR}/src/${DESTINATION}"
mkdir -p "${DSTDIR}/src/${SYNERGYPATH}/extensions/import/hamming"
mkdir -p "${DSTDIR}/src/${SYNERGYPATH}/extensions/import/minsky"
mkdir -p "${DSTDIR}/src/usr/share/doc/${PACKAGE_NAME}"
# For kibana plugins
#mkdir -p "${DSTDIR}/src/usr/share"
#mkdir -p "$VERSIONS_DIR"
$TAR --exclude-vcs -c -C dpkg debian | $TAR xv -C "$DSTDIR"
$CP -a dpkg/Makefile "$DSTDIR"
$CP -a "src/wars/hamming/import.war" "${DSTDIR}/src/${SYNERGYPATH}/extensions/import/hamming"
$CP -a "src/wars/minsky/import.war" "${DSTDIR}/src/${SYNERGYPATH}/extensions/import/minsky"
$CP -a "dpkg/debian/copyright" "${DSTDIR}/src/usr/share/doc/${PACKAGE_NAME}"
$CP -a "dpkg/build.gradle" "${DSTDIR}"
# Generating changelog entry
rm -f "$DSTDIR/changelog.entry"
touch "$DSTDIR/changelog.entry"
echo "$PACKAGE_NAME ($PACKAGE_VERSION) ${DEFAULT_REPO}; urgency=${DEFAULT_URGENCY}" >> "$DSTDIR/changelog.entry"
echo "" >> "$DSTDIR/changelog.entry" >> "$DSTDIR/changelog.entry"
echo " * Automatic build with number ${BUILD_NUMBER} ($BUILD_TIME)" >> "$DSTDIR/changelog.entry"
echo "" >> "${DSTDIR}/changelog.entry"
echo " -- ${AUTHOR} $(date -R)" >> "$DSTDIR/changelog.entry"
echo "" >> "$DSTDIR/changelog.entry"
sed -i 's/import_version/'"$PACKAGE_VERSION"'/' "${DSTDIR}/build.gradle"
cat "$DSTDIR/changelog.entry" $CHANGELOG > "$DSTDIR/debian/changelog"
rm "$DSTDIR/changelog.entry"
$CP -a "$DSTDIR/debian/changelog" "$DSTDIR/src/usr/share/doc/${PACKAGE_NAME}/changelog.Debian"
gzip "$DSTDIR/src/usr/share/doc/${PACKAGE_NAME}/changelog.Debian"
mkdir -p $VERSIONS_DIR
echo "$PACKAGE_VERSION ($1)" > "$VERSIONS_DIR/$PACKAGE_NAME"
#!/usr/bin/env bash
REPODIR='/srv/tengrirepo'
CONFDIR=$REPODIR'/conf'
#Файл пришедший с пакетом
app=arta-synergy-extensions-kato_*.changes
newCodeName=$(grep "Distribution" $app | cut -d" " -f2)
#Файл с настройками репозитория
fileDisrtib=$CONFDIR'/distributions'
existCodeName=$(grep "Codename: $newCodeName" $fileDisrtib | cut -d" " -f2)
#Если репозитория не существует то создаём его
if [ -z "$existCodeName" ]; then
echo "" >> $fileDisrtib
echo "Origin: ARTA" >> $fileDisrtib
echo "Label: ARTA" >> $fileDisrtib
echo "Suite: $newCodeName" >> $fileDisrtib
echo "Codename: $newCodeName" >> $fileDisrtib
echo "Version: 3.0" >> $fileDisrtib
echo "Architectures: i386 amd64 source" >> $fileDisrtib
echo "Components: main non-free contrib" >> $fileDisrtib
echo "Description: For $newCodeName synergy" >> $fileDisrtib
echo "Log:" >> $fileDisrtib
echo " --type=dsc changelogs.sh" >> $fileDisrtib
echo 'CREATE REPOSITORY AND ADD PACKAGES'
else
echo 'ONLY UPDATE PACKAGES'
fi
reprepro -b $REPODIR include $newCodeName $app
find . ! -name "repository*.sh" -delete
...@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME ...@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-4.6-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment