Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
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
Kasra Jamshidi
slapos.package
Commits
1b0200c1
Commit
1b0200c1
authored
Jun 06, 2013
by
Vivien Alger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored script
parent
a30d624a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
43 deletions
+91
-43
prepare_slapos_build.sh
prepare_slapos_build.sh
+66
-43
prepare_spec.sh
prepare_spec.sh
+25
-0
No files found.
prepare_slapos_build.sh
100644 → 100755
View file @
1b0200c1
...
@@ -7,10 +7,65 @@ RELEASE=2
...
@@ -7,10 +7,65 @@ RELEASE=2
VERSION_REGEX
=
"s/
\%
RECIPE_VERSION
\%
/
$RECIPE_VERSION
/g;s/
\%
VERSION
\%
/
$VERSION
/g;s/
\%
RELEASE
\%
/
$RELEASE
/g"
VERSION_REGEX
=
"s/
\%
RECIPE_VERSION
\%
/
$RECIPE_VERSION
/g;s/
\%
VERSION
\%
/
$VERSION
/g;s/
\%
RELEASE
\%
/
$RELEASE
/g"
CURRENT_DIRECTORY
=
"
$(
pwd
)
"
CURRENT_DIRECTORY
=
"
$(
pwd
)
"
TEMPLATES_DIRECTORY
=
$CURRENT_DIRECTORY
/templates
TEMPLATES_DIRECTORY
=
$CURRENT_DIRECTORY
/templates
DEB_DIRECTORY
=
$TEMPLATES_DIRECTORY
/deb
SLAPOS_ORGINAL_DIRECTORY
=
slapos-node
SLAPOS_ORGINAL_DIRECTORY
=
slapos-node
SLAPOS_DIRECTORY
=
slapos-node_
$VERSION
+
$RECIPE_VERSION
+
$RELEASE
SLAPOS_DIRECTORY
=
slapos-node_
$VERSION
+
$RECIPE_VERSION
+
$RELEASE
OBS_DIRECTORY
=
$CURRENT_DIRECTORY
/home:VIFIBnexedi:branches:home:VIFIBnexedi/SlapOS-Node
OBS_DIRECTORY
=
$CURRENT_DIRECTORY
/home:VIFIBnexedi:branches:home:VIFIBnexedi/SlapOS-Node
RE6STNET_SCRIPT
=
$TEMPLATES_DIRECTORY
/re6stnet.sh
function
prepare_download_cache
{
cd
$CURRENT_DIRECTORY
/
$SLAPOS_DIRECTORY
/slapos/
rm
-rf
build/
bash offline.sh
||
(
echo
"Impossible to build SlapOS, exiting."
&&
exit
1
)
}
function
prepare_tarball
{
cd
$CURRENT_DIRECTORY
tar
-czf
$SLAPOS_DIRECTORY
.tar.gz
$SLAPOS_DIRECTORY
}
function
spec_generation
{
$CURRENT_DIRECTORY
/prepare_spec.sh
$VERSION_REGEX
$TEMPLATES_DIRECTORY
$RE6STNET_SCRIPT
}
function
prepare_deb_packaging
{
# Add entry to changelog
dch
-pm
-v
$VERSION
+
$RECIPE_VERSION
+
$RELEASE
--changelog
$DEB_DIRECTORY
/debian/changelog
--check-dirname-level
=
0
"New version of slapos (
$VERSION
+
$RECIPE_VERSION
+
$RELEASE
)"
# Add cron and logrotate files
cp
-R
$DEB_DIRECTORY
/debian
$OBS_DIRECTORY
/
cp
$CURRENT_DIRECTORY
/
$SLAPOS_ORGINAL_DIRECTORY
/template/slapos-node.cron.d
$OBS_DIRECTORY
/debian/cron.d
cp
$CURRENT_DIRECTORY
/
$SLAPOS_ORGINAL_DIRECTORY
/template/slapos-node.logrotate
$OBS_DIRECTORY
/debian/slapos-node.logrotate
cat
$RE6STNET_SCRIPT
>>
$OBS_DIRECTORY
/debian/post
tar
-czf
$OBS_DIRECTORY
/debian.tar.gz
$OBS_DIRECTORY
/debian
sed
$VERSION_REGEX
$DEB_DIRECTORY
/slapos.dsc.in
>
$SLAPOS_DIRECTORY
.dsc
}
function
obs_upload
{
# Prepare obs
cd
$OBS_DIRECTORY
# Update directory
osc up
# Remove former configuration
osc
rm
-f
$SLAPOS_ORGINAL_DIRECTORY
*
.tar.gz
osc
rm
-f
slapos.spec
osc
rm
-f
slapos
*
.dsc
# Add tarball
cp
$CURRENT_DIRECTORY
/
$SLAPOS_DIRECTORY
.tar.gz
.
osc add
$SLAPOS_DIRECTORY
.tar.gz
# Add spec
cp
$CURRENT_DIRECTORY
/slapos.spec
.
osc add slapos.spec
# Add .dsc
osc add
$SLAPOS_DIRECTORY
.dsc
# Upload new Package
osc commit
-m
"New SlapOS Recipe
$RECIPE_VERSION
"
}
# Prepare directory for new version if needed
# Prepare directory for new version if needed
if
[
!
-d
"
$CURRENT_DIRECTORY
/
$SLAPOS_DIRECTORY
"
]
;
then
if
[
!
-d
"
$CURRENT_DIRECTORY
/
$SLAPOS_DIRECTORY
"
]
;
then
...
@@ -22,51 +77,19 @@ sed $VERSION_REGEX $TEMPLATES_DIRECTORY/Makefile.in > $CURRENT_DIRECTORY/$SLAPOS
...
@@ -22,51 +77,19 @@ sed $VERSION_REGEX $TEMPLATES_DIRECTORY/Makefile.in > $CURRENT_DIRECTORY/$SLAPOS
sed
$VERSION_REGEX
$TEMPLATES_DIRECTORY
/offline.sh.in
>
$CURRENT_DIRECTORY
/
$SLAPOS_DIRECTORY
/slapos/offline.sh
sed
$VERSION_REGEX
$TEMPLATES_DIRECTORY
/offline.sh.in
>
$CURRENT_DIRECTORY
/
$SLAPOS_DIRECTORY
/slapos/offline.sh
# Prepare Download Cache for SlapOS
# Prepare Download Cache for SlapOS
cd
$CURRENT_DIRECTORY
/
$SLAPOS_DIRECTORY
/slapos/
prepare_download_cache
#rm -rf build/
bash offline.sh
||
(
echo
"Impossible to build SlapOS, exiting."
&&
exit
1
)
# Prepare tarball
# Prepare tarball
cd
$CURRENT_DIRECTORY
prepare_tarball
tar
-czf
$SLAPOS_DIRECTORY
.tar.gz
$SLAPOS_DIRECTORY
# Generate spec file
spec_generation
################# Prepare obs ###################################
cd
$OBS_DIRECTORY
# Prepare deb packaging
prepare_deb_packaging
# Update directory
osc up
# Upload to obs
obs_upload
# Remove former configuration
osc
rm
-f
$SLAPOS_ORGINAL_DIRECTORY
*
.tar.gz
osc
rm
-f
slapos.spec
# Prepare new tarball
cp
$CURRENT_DIRECTORY
/
$SLAPOS_DIRECTORY
.tar.gz
.
osc add
$SLAPOS_DIRECTORY
.tar.gz
# Prepare new specfile
sed
$VERSION_REGEX
$TEMPLATES_DIRECTORY
/slapos.spec.in
>
slapos.spec
osc add slapos.spec
##################### Prepare configuration file for .deb ############
# Add entry to changelog
cd
$TEMPLATES_DIRECTORY
/debian
dch
-pm
-v
$VERSION
+
$RECIPE_VERSION
+
$RELEASE
--check-dirname-level
=
0
"New version of slapos (
$VERSION
+
$RECIPE_VERSION
+
$RELEASE
)"
# Add cron and logrotate files
cp
$CURRENT_DIRECTORY
/
$SLAPOS_ORGINAL_DIRECTORY
/template/slapos-node.cron.d
$TEMPLATES_DIRECTORY
/debian/cron.d
cp
$CURRENT_DIRECTORY
/
$SLAPOS_ORGINAL_DIRECTORY
/template/slapos-node.logrotate
$TEMPLATES_DIRECTORY
/debian/slapos-node.logrotate
cd
$TEMPLATES_DIRECTORY
tar
-czf
debian.tar.gz debian
cd
$OBS_DIRECTORY
cp
$TEMPLATES_DIRECTORY
/debian.tar.gz
.
#prepare new .dsc file
osc
rm
-f
slapos
*
.dsc
sed
$VERSION_REGEX
$TEMPLATES_DIRECTORY
/slapos.dsc.in
>
$SLAPOS_DIRECTORY
.dsc
osc add
$SLAPOS_DIRECTORY
.dsc
## Upload new Package
osc commit
-m
"New SlapOS Recipe
$RECIPE_VERSION
"
# Save current version
# Save current version
echo
"
$RECIPE_VERSION
"
>
$CURRENT_DIRECTORY
/slapos-recipe-version
echo
"
$RECIPE_VERSION
"
>
$CURRENT_DIRECTORY
/slapos-recipe-version
...
...
prepare_spec.sh
0 → 100755
View file @
1b0200c1
#!/bin/bash -e
# Script to prepare .spec file for building slapos-node rpm package
VERSION_REGEX
=
$1
TEMPLATES_DIRECTORY
=
$2
RPM_DIRECTORY
=
$TEMPLATES_DIRECTORY
/rpm
RE6STNET_SCRIPT
=
$3
SLAPOS_SPEC
=
slapos.spec
# Replace version/release/etc… informations in base spec file
sed
$VERSION_REGEX
$RPM_DIRECTORY
/slapos.spec.base.in
>
$SLAPOS_SPEC
# Post scriplet generation
echo
"%post"
>>
$SLAPOS_SPEC
cat
$RE6STNET_SCRIPT
>>
$SLAPOS_SPEC
cat
$RPM_DIRECTORY
/post
>>
$SLAPOS_SPEC
# Preun scriplet generation
echo
"%preun"
>>
$SLAPOS_SPEC
cat
$RPM_DIRECTORY
/preun
>>
$SLAPOS_SPEC
# Postun scriplet generation
echo
"%postun"
>>
$SLAPOS_SPEC
cat
$RPM_DIRECTORY
/postun
>>
$SLAPOS_SPEC
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