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
13
Merge Requests
13
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.package
Commits
76d0bc0e
Commit
76d0bc0e
authored
Nov 22, 2024
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
264ee12d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
15 deletions
+26
-15
playbook/roles/ors/files/configure-sudoers
playbook/roles/ors/files/configure-sudoers
+5
-3
playbook/roles/ors/tasks/main.yml
playbook/roles/ors/tasks/main.yml
+13
-7
playbook/roles/ors/templates/get-amarisoft-info.j2
playbook/roles/ors/templates/get-amarisoft-info.j2
+5
-1
playbook/roles/ors/templates/init-sdr.j2
playbook/roles/ors/templates/init-sdr.j2
+3
-2
playbook/settings/ors.yml
playbook/settings/ors.yml
+0
-2
No files found.
playbook/roles/ors/files/configure-sudoers
View file @
76d0bc0e
#!/bin/bash
DIR
=
$(
dirname
$(
realpath
$0
))
AMARISOFT_DIR
=
$1
AMARISOFT_VERSION
=
$2
mkdir
-p
/etc/sudoers.d
COMMAND_LIST
=(
"rm-tmp-lte"
"init-enb"
"init-mme"
"init-sdr"
"get-sdr-info"
)
PARTITION_AMOUNT
=
"
$(
sed
-n
's/partition_amount = \(.*\)/\1/gp'
/etc/opt/slapos/slapos.cfg
)
"
...
...
@@ -7,7 +10,7 @@ for c in "${COMMAND_LIST[@]}"; do
if
[
"
$SLAPUSER_LINES
"
!=
"
$PARTITION_AMOUNT
"
]
;
then
echo
"Configuring /etc/sudoers.d/slapuser-
$c
..."
for
i
in
$(
seq
0
$((
$PARTITION_AMOUNT
-
1
))
)
;
do
echo
"slapuser
$i
ALL=NOPASSWD:
/opt/amarisoft
/
$c
"
>>
slapuser-
$c
echo
"slapuser
$i
ALL=NOPASSWD:
$AMARISOFT_DIR
/
$c
"
>>
slapuser-
$c
done
mv
slapuser-
$c
/etc/sudoers.d/
chmod
440 /etc/sudoers.d/slapuser-
$c
...
...
@@ -15,11 +18,10 @@ for c in "${COMMAND_LIST[@]}"; do
done
c
=
"sdr-util"
SLAPUSER_LINES
=
"
$(
cat
/etc/sudoers.d/slapuser-
$c
2> /dev/null |
wc
-l
)
"
AMARISOFT_PATH
=
"/opt/amarisoft/
$(
ls
-1
/opt/amarisoft |
grep
"^v[0-9]
\{
4
\}
-[0-9]
\{
2
\}
-[0-9]
\{
2
\}
.*[0-9]*$"
|
sort
|
tail
-n1
)
"
if
[
"
$SLAPUSER_LINES
"
!=
"
$PARTITION_AMOUNT
"
]
;
then
echo
"Configuring /etc/sudoers.d/slapuser-
$c
..."
for
i
in
$(
seq
0
$((
$PARTITION_AMOUNT
-
1
))
)
;
do
echo
"slapuser
$i
ALL=NOPASSWD:
$AMARISOFT_
PATH
/trx_sdr/sdr_util -c 0 version"
>>
slapuser-
$c
echo
"slapuser
$i
ALL=NOPASSWD:
$AMARISOFT_
DIR
/
$AMARISOFT_VERSION
/trx_sdr/sdr_util -c 0 version"
>>
slapuser-
$c
done
mv
slapuser-
$c
/etc/sudoers.d/
chmod
440 /etc/sudoers.d/slapuser-
$c
...
...
playbook/roles/ors/tasks/main.yml
View file @
76d0bc0e
...
...
@@ -18,14 +18,20 @@
-
name
:
Create {{ amarisoft_dir }} directory
file
:
path={{ amarisoft_dir }} state=directory mode=0755
-
name
:
Copy get-amarisoft-info script
copy
:
src=get-amarisoft-info dest={{ amarisoft_dir }} owner=root mode=555
-
name
:
Render get-amarisoft-info script
template
:
src
:
get-amarisoft-info.j2
dest
:
{{
amarisoft_dir
}}
/get-amarisoft-info
-
name
:
Copy get-license-info script for backwards compatibility
copy
:
src=get-amarisoft-info dest={{ amarisoft_dir }}/get-license-info owner=root mode=555
-
name
:
Render get-license-info script for backwards compatibility
template
:
src
:
get-amarisoft-info.j2
dest
:
{{
amarisoft_dir
}}
/get-license-info
-
name
:
Copy init-sdr script
copy
:
src=init-sdr dest={{ amarisoft_dir }} owner=root mode=550
-
name
:
Render init-sdr script
template
:
src
:
init-sdr.j2
dest
:
{{
amarisoft_dir
}}
/init-sdr
-
name
:
Copy init-enb script
copy
:
src=init-enb dest={{ amarisoft_dir }} owner=root mode=550
...
...
@@ -359,7 +365,7 @@
ignore_errors
:
yes
-
name
:
Configure sudoers
script
:
configure-sudoers
script
:
configure-sudoers
{{ amarisoft_dir }}
# Network
...
...
playbook/roles/ors/
files/get-amarisoft-info
→
playbook/roles/ors/
templates/get-amarisoft-info.j2
100755 → 100644
View file @
76d0bc0e
...
...
@@ -5,11 +5,13 @@ import argparse, os, re, sys
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'-e'
,
'--expiration'
,
action
=
'store_true'
)
parser
.
add_argument
(
'-v'
,
'--version'
,
action
=
'store_true'
)
parser
.
add_argument
(
'-o'
,
'--old-version'
,
action
=
'store_true'
)
args
=
parser
.
parse_args
()
amarisoft_dir
=
'/opt/amarisoft'
amarisoft_dir
=
"{{ amarisoft_dir }}"
try
:
lte_version
=
sorted
(
filter
(
lambda
x
:
re
.
match
(
r"v[0-9]{4}-[0-9]{2}-[0-9]{2}"
,
x
),
os
.
listdir
(
amarisoft_dir
)))[
-
1
][
1
:]
old_lte_version
=
sorted
(
filter
(
lambda
x
:
re
.
match
(
r"v2021-[0-9]{2}-[0-9]{2}"
,
x
),
os
.
listdir
(
amarisoft_dir
)))[
-
1
][
1
:]
except
FileNotFoundError
:
lte_version
=
'Unknown'
lte_expiration
=
"Unknown"
...
...
@@ -28,3 +30,5 @@ if args.expiration:
print
(
lte_expiration
,
end
=
''
)
elif
args
.
version
:
print
(
lte_version
,
end
=
''
)
elif
args
.
old_version
:
print
(
old_lte_version
,
end
=
''
)
playbook/roles/ors/
files/init-sdr
→
playbook/roles/ors/
templates/init-sdr.j2
100755 → 100644
View file @
76d0bc0e
#!/bin/bash
OLD_AMARISOFT_PATH
=
"/opt/amarisoft/
$(
ls
-1
/opt/amarisoft |
grep
"^v2021-[0-9]
\{
2
\}
-[0-9]
\{
2
\}
.*[0-9]*$"
|
sort
|
tail
-n1
)
"
AMARISOFT_PATH
=
"/opt/amarisoft/
$(
ls
-1
/opt/amarisoft |
grep
"^v[0-9]
\{
4
\}
-[0-9]
\{
2
\}
-[0-9]
\{
2
\}
.*[0-9]*$"
|
sort
|
tail
-n1
)
"
DIR
=
$(
dirname
$(
realpath
$0
))
OLD_AMARISOFT_PATH
={{
amarisoft_dir
}}
/
$(
$DIR
/get-amarisoft-info
-o
)
AMARISOFT_PATH
={{
amarisoft_dir
}}
/
$(
$DIR
/get-amarisoft-info
-v
)
export
PATH
=
"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:
$PATH
"
lsmod |
grep
-q
sdr
&&
rmmod sdr
;
...
...
playbook/settings/ors.yml
View file @
76d0bc0e
---
install_folder
:
"
/opt/amarisoft"
amarisoft_version
:
"
2023-06-10"
launch_upgrader
:
True
playbook_report
:
True
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