Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
Import registry records
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
develop
Import registry records
Commits
8bdf345e
Commit
8bdf345e
authored
Aug 26, 2020
by
Ilya Veselov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debian_files
parent
1a0f04a1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
185 deletions
+22
-185
dpkg/build.gradle
dpkg/build.gradle
+2
-3
dpkg/debian/postinst
dpkg/debian/postinst
+18
-163
dpkg/debian/templates
dpkg/debian/templates
+0
-17
dpkg/prepare.sh
dpkg/prepare.sh
+2
-2
No files found.
dpkg/build.gradle
View file @
8bdf345e
...
@@ -32,11 +32,10 @@ ospackage {
...
@@ -32,11 +32,10 @@ ospackage {
from
(
"${projectDir}/src"
)
{
from
(
"${projectDir}/src"
)
{
into
'/'
into
'/'
}
}
requires
(
'arta-synergy-synergy'
,
'4.1-r1~200130.034722'
,
GREATER
|
EQUAL
)
requires
(
'arta-synergy-synergy'
,
'4.0-r1~190130.034722'
,
GREATER
|
EQUAL
)
requires
(
'curl'
)
requires
(
'debconf'
,
'0.5'
,
GREATER
|
EQUAL
).
or
(
'debconf-2.0'
)
requires
(
'debconf'
,
'0.5'
,
GREATER
|
EQUAL
).
or
(
'debconf-2.0'
)
postInstallFile
file
(
"${projectDir}/debian/postinst"
)
postInstallFile
file
(
"${projectDir}/debian/postinst"
)
supplementaryControl
"${projectDir}/debian/templates"
//
supplementaryControl "${projectDir}/debian/templates"
}
}
build
.
finalizedBy
buildDeb
build
.
finalizedBy
buildDeb
...
...
dpkg/debian/postinst
View file @
8bdf345e
...
@@ -4,182 +4,37 @@ set -e
...
@@ -4,182 +4,37 @@ set -e
# Source debconf library
# Source debconf library
.
/usr/share/debconf/confmodule
.
/usr/share/debconf/confmodule
war_setting
()
{
get_synergy_url
()
{
local
war_path
=
"/opt/synergy/extensions/import"
local
synergy_url
local
deployments_path
=
"/opt/synergy/jboss/standalone/deployments"
local
version_file
=
"/opt/synergy/versions/arta-synergy-synergy"
db_fset arta-synergy-extensions-kato/synergy_url seen
false
local
version
=
$(
awk
'{print $2}'
$version_file
|
tr
-d
\(\)
)
case
$version
in
# Set default value if we ain't got one
"hamming"
)
cp
$war_path
/hamming/import.war
$deployments_path
/
;;
db_get arta-synergy-extensions-kato/synergy_url
"minsky"
)
cp
$war_path
/minsky/import.war
$deployments_path
/
;;
if
[
"
$RET
"
=
""
]
;
then
"master"
)
cp
$war_path
/minsky/import.war
$deployments_path
/
;;
db_set arta-synergy-extensions-kato/synergy_url
"http://
$(
hostname
-f
)
:8080/Synergy"
"wilkinson"
)
cp
$war_path
/minsky/import.war
$deployments_path
/
;;
fi
*
)
echo
"Your version is
$version
, import.war can not be set. Version must be hamming, minsky or wilkinson"
esac
# Get url
chown
jboss:synergy
$deployments_path
/import.war
db_input high arta-synergy-extensions-kato/synergy_url
||
true
touch
$deployments_path
/import.war.dodeploy
db_go
mkdir
/tmp/crm-import
chmod
777
-R
/tmp/crm-import
# 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
"
\n
status=%{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
\n
Server 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
"
\n
status=%{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
\n
Server 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
case
"
$1
"
in
configure
)
configure
)
SYNERGY_URL
=
$(
get_synergy_url
)
# TODO: Yes, I know we use some kind of kludge here
# 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
# But! we need to decide if we include nginx or something to default setup
# then the solution will be more appropriate
# then the solution will be more appropriate
waiting_synergy_start
$SYNERGY_URL
war_setting
load_kato
$SYNERGY_URL
# Work around problem described here:
# Work around problem described here:
# https://lists.debian.org/debian-mentors/2005/11/msg00067.html
# https://lists.debian.org/debian-mentors/2005/11/msg00067.html
db_stop
#
db_stop
;;
;;
abort-upgrade|abort-remove|abort-deconfigure
)
abort-upgrade|abort-remove|abort-deconfigure
)
...
...
dpkg/debian/templates
View file @
8bdf345e
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.
dpkg/prepare.sh
View file @
8bdf345e
...
@@ -51,8 +51,8 @@ mkdir -p "${DSTDIR}/src/usr/share/doc/${PACKAGE_NAME}"
...
@@ -51,8 +51,8 @@ mkdir -p "${DSTDIR}/src/usr/share/doc/${PACKAGE_NAME}"
$TAR
--exclude-vcs
-c
-C
dpkg debian |
$TAR
xv
-C
"
$DSTDIR
"
$TAR
--exclude-vcs
-c
-C
dpkg debian |
$TAR
xv
-C
"
$DSTDIR
"
$CP
-a
dpkg/Makefile
"
$DSTDIR
"
$CP
-a
dpkg/Makefile
"
$DSTDIR
"
$CP
-a
"
src/
wars/hamming/import.war"
"
${
DSTDIR
}
/src/
${
SYNERGYPATH
}
/extensions/import/hamming"
$CP
-a
"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
"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/debian/copyright"
"
${
DSTDIR
}
/src/usr/share/doc/
${
PACKAGE_NAME
}
"
$CP
-a
"dpkg/build.gradle"
"
${
DSTDIR
}
"
$CP
-a
"dpkg/build.gradle"
"
${
DSTDIR
}
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment