Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
S
src
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
9
Issues
9
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Code Review
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pmodules
src
Commits
e230fbce
Commit
e230fbce
authored
Oct 29, 2020
by
gsell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
review of build script
parent
798a8ee8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
24 deletions
+82
-24
build
build
+82
-24
No files found.
build
View file @
e230fbce
...
...
@@ -13,14 +13,15 @@ unset PMODULES_ROOT
unset
PMODULES_HOME
unset
PMODULES_DISTFILESDIR
declare
-
rx
CONFIG_DIR
=
'config'
declare
-
rx
CONFIG_FILE
=
'modbuild.conf'
# defaults
declare
-
rx
DEFAULT_PMODULES_ROOT
=
'/opt/psi'
declare
-
rx
DEFAULT_PMODULES_DISTFILESDIR
=
"${DEFAULT_PMODULES_ROOT}/var/distfiles"
declare
-
rx
DEFAULT_MODBUILD_CONFIG
=
'config/modbuild.conf'
declare
-
rx
DEFAULT_VERSIONS_CONFIG
=
'config/versions.conf'
declare
-
rx
DEFAULT_VERSIONS_CONFIG
=
"${CONFIG_DIR}/versions.conf"
declare
-
rx
DEFAULT_PMODULES_TMPDIR
=
'/var/tmp/${USER}'
#-----------------------------------------------------------------------------
#
get_version
()
{
...
...
@@ -43,10 +44,11 @@ build [OPTIONS] configure|compile|install
#-----------------------------------------------------------------------------
#
pmodules
::
configure
()
{
local
install
_root
=
"${DEFAULT_PMODULES_ROOT}"
local
pmodules
_root
=
"${DEFAULT_PMODULES_ROOT}"
local
distfilesdir
=
"${DEFAULT_PMODULES_DISTFILESDIR}"
local
tmpdir
=
"${DEFAULT_PMODULES_TMPDIR}"
local
config_file
=
"${BOOTSTRAP_DIR}/${DEFAULT_MODBUILD_CONFIG}"
local
config_file
=
''
local
opt_force
=
'no'
while
((
$
# > 0 )); do
case
"$1"
in
...
...
@@ -57,12 +59,12 @@ pmodules::configure() {
--
config
=*
)
config_file
=
"${1#*=}"
;;
--
install
-
root
)
install
_root
=
"$2"
--
pmodules
-
root
)
pmodules
_root
=
"$2"
shift
1
;;
--
install
-
root
=*
)
install
_root
=
"${1#*=}"
--
pmodules
-
root
=*
)
pmodules
_root
=
"${1#*=}"
;;
--
distfilesdir
)
distfilesdir
=
"$2"
...
...
@@ -71,6 +73,9 @@ pmodules::configure() {
--
distfilesdir
=*
)
distfilesdir
=
"${1#*=}"
;;
-
f
|
--
force
)
opt_force
=
'yes'
;;
--
tmpdir
)
tmpdir
=
"$2"
shift
1
...
...
@@ -87,13 +92,52 @@ pmodules::configure() {
esac
shift
1
done
if
[[
-
n
"${config_file}"
]];
then
config_file
=
$
(
std
::
abspath
"${config_file}"
)
if
[[
$
(
dirname
"${config_file}"
!=
"${BOOTSTRAP_DIR}/${CONFIG_DIR}"
]];
then
echo
"Invalid directory for The configuration file."
1
>&
2
std
::
die
1
"The configuration file must be in '${BOOTSTRAP_DIR}/${CONFIG_DIR}'!"
fi
else
config_file
=
"${BOOTSTRAP_DIR}/${CONFIG_DIR}/${CONFIG_FILE}"
fi
if
[[
!
-
d
$
{
pmodules_root
}
]];
then
echo
"The root directory '${pmodules_root}' does not exist, trying to create it..."
if
!
mkdir
-
p
"${pmodules_root}"
;
then
std
::
die
1
"Creating the root directory failed!
\n
Aborting..."
fi
fi
if
[[
!
-
w
$
{
pmodules_root
}
]];
then
std
::
die
1
"The root directory '${pmodules_root}' is not writable!
\n
Aborting..."
fi
mkdir
-
p
"${pmodules_root}/${CONFIG_DIR}"
||
\
std
::
die
1
"Aborting..."
if
[[
"${opt_force}"
==
'yes'
]];
then
rm
-
f
"${BOOTSTRAP_DIR}/${CONFIG_DIR}/${config_file}"
fi
sed_cmd
=
"s:@PMODULES_ROOT@:${install_root}:g;"
if
[[
-
L
$
{
BOOTSTRAP_DIR
}
/
$
{
CONFIG_DIR
}
/
$
{
config_file
}
]];
then
std
::
die
1
"The Pmodules environment has already been configured!
Use the option --force to override.
\n
Aborting..."
fi
sed_cmd
=
"s:@PMODULES_ROOT@:${pmodules_root}:g;"
sed_cmd
+=
"s:@PMODULES_DISTFILESDIR@:${distfilesdir}:g;"
sed_cmd
+=
"s:@PMODULES_TMPDIR@:${tmpdir}:g;"
sed_cmd
+=
"s:@PMODULES_VERSION@:${PMODULES_VERSION}:g"
sed
"${sed_cmd}"
"${DEFAULT_MODBUILD_CONFIG}.in"
>
"${config_file}"
sed
"${sed_cmd}"
"${BOOTSTRAP_DIR}/${CONFIG_DIR}/${CONFIG_FILE}.in"
\
>
"${pmodules_root}/${CONFIG_DIR}/${CONFIG_FILE}"
||
\
std
::
die
1
"Cannot create configuration file in Pmodules root
\n
Aborting..."
ln
-
s
"${pmodules_root}/${CONFIG_DIR}/${CONFIG_FILE}"
\
"${BOOTSTRAP_DIR}/${CONFIG_DIR}/${config_file}"
install
-
d
-
m
0755
"${PMODULES_HOME}/bin"
install
-
d
-
m
0755
"${PMODULES_HOME}/config"
install
-
d
-
m
0755
"${PMODULES_HOME}/init"
install
-
d
-
m
0755
"${PMODULES_HOME}/lib"
install
-
d
-
m
0755
"${PMODULES_HOME}/libexec"
install
-
d
-
m
0755
"${PMODULES_HOME}/sbin"
}
#-----------------------------------------------------------------------------
...
...
@@ -105,7 +149,6 @@ pmodules::compile() {
shift
"${BOOTSTRAP_DIR}/Pmodules/modbuild"
\
"--debug"
\
"--config=${config_file}"
\
"--enable-cleanup"
\
"--force-rebuild"
\
...
...
@@ -115,7 +158,7 @@ pmodules::compile() {
}
local
force
=
'no'
local
config_file
=
"${BOOTSTRAP_DIR}/${DEFAULT_MODBUILD_CONFIG}"
local
config_file
=
''
while
((
$
# > 0 )); do
case
$
1
in
...
...
@@ -132,11 +175,11 @@ pmodules::compile() {
--
config
=*
)
config_file
=
$
(
std
::
get_abspath
"${1#*=}"
)
;;
--
install
-
root
)
--
pmodules
-
root
)
PMODULES_ROOT
=
"$2"
shift
1
;;
--
install
-
root
=*
)
--
pmodules
-
root
=*
)
PMODULES_ROOT
=
"${1#*=}"
;;
-
f
|
--
force
)
...
...
@@ -152,13 +195,28 @@ pmodules::compile() {
shift
1
done
source
"${config_file}"
install
-
d
-
m
0755
"${PMODULES_HOME}/bin"
install
-
d
-
m
0755
"${PMODULES_HOME}/config"
install
-
d
-
m
0755
"${PMODULES_HOME}/init"
install
-
d
-
m
0755
"${PMODULES_HOME}/lib"
install
-
d
-
m
0755
"${PMODULES_HOME}/libexec"
install
-
d
-
m
0755
"${PMODULES_HOME}/sbin"
if
[[
-
n
"${config_file}"
]]
&&
[[
-
n
"${PMODULES_ROOT}"
]];
then
std
::
die
1
"You cannot use the options '--config' and '--pmodules-root at the same time!"
fi
if
[[
-
n
"${PMODULES_ROOT}"
]];
then
config_file
=
"${PMODULES_ROOT}/${CONFIG_DIR}/${CONFIG_FILE}"
elif
[[
-
z
"${config_file}"
]];
then
config_file
=
"${BOOTSTRAP_DIR}/${CONFIG_DIR}/$(basename ${config_file})"
fi
if
[[
!
-
r
"${config_file}"
]];
then
std
::
die
1
"Configuration file '${config_file}' does not exist or is not readable!"
fi
source
"${config_file}"
||
std
::
die
1
"Cannot read configuration file '${config_file}'"
if
[[
-
z
"${PMODULES_ROOT}"
]];
then
std
::
die
1
"Error in configuration file '${config_file}': PMODULE_ROOT not defined!"
fi
if
[[
-
z
"${PMODULES_DISTFILESDIR}"
]];
then
std
::
die
1
"Error in configuration file '${config_file}': PMODULES_DISTFILESDIR not defined!"
fi
if
[[
-
z
"${PMODULES_TMPDIR}"
]];
then
std
::
die
1
"Error in configuration file '${config_file}': PMODULE_TMPDIR not defined!"
fi
if
[[
!
-
f
"${PMODULES_HOME}/sbin/base64"
]]
||
[[
$
{
force
}
==
'yes'
]];
then
build
coreutils
...
...
@@ -207,11 +265,11 @@ pmodules::install() {
--
debug
)
set
-
x
;;
--
install
-
root
)
--
pmodules
-
root
)
PMODULES_ROOT
=
"$2"
shift
1
;;
--
install
-
root
=*
)
--
pmodules
-
root
=*
)
PMODULES_ROOT
=
"${1#*=}"
;;
-
f
|
--
force
)
...
...
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