Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mkimage-profiles
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Anton Palgunov
mkimage-profiles
Commits
a16e63ed
Commit
a16e63ed
authored
Feb 11, 2024
by
Anton Midyukov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
services: create lists of services to disable/enable in Live with installer
Some services that need to be enabled or disabled may appear after additional installation of basic packages.
parent
17464870
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
144 additions
and
0 deletions
+144
-0
10-services-install
...ures.in/services/live/image-scripts.d/10-services-install
+144
-0
No files found.
features.in/services/live/image-scripts.d/10-services-install
0 → 100755
View file @
a16e63ed
#!/bin/sh
# this script piggybacks service status information
# into the system to be installed (instead of applying
# it to rootfs being formed immediately)
# NB: The script is a copy of a similar script from install2,
# but is executed during a live build if there is an classic
# installer in it.
[
-x
/usr/sbin/install2
]
||
exit
0
STATUS
=
`
mktemp
`
CONFDIR
=
/usr/share/install2
CHECK_FILES
=
.
shell-config
switch
()
{
local
sname
=
"
$1
"
sname
=
"
${
sname
%.service
}
"
sname
=
"
${
sname
%.socket
}
"
sname
=
"
${
sname
%.target
}
"
[
-n
"
$CHECK_FILES
"
]
&&
\
grep
-E
-qs
"^[[:blank:]]*
$sname
(.service|.socket|.target)?[[:blank:]]*$"
\
$CHECK_FILES
&&
return
||
:
# avoid service duplication: drop sevice without unit type
[
"
$sname
"
=
"
$1
"
]
||
shell_config_del
"
$STATUS
"
"
$sname
"
case
"
$2
"
in
on|off|enabled|disabled|mask|unmask
)
shell_config_set
"
$STATUS
"
"
$1
"
"
$2
"
;;
esac
}
for
f
in
services-on services-off systemd-enabled systemd-disabled
;
do
[
-s
"
$CONFDIR
/
$f
"
]
||
continue
CHECK_FILES
=
"
$CHECK_FILES
$CONFDIR
/
$f
"
done
# defaults (most likely features.in ones)
for
i
in
$GLOBAL_DEFAULT_SERVICES_ENABLE
;
do
switch
$i
on
;
done
for
i
in
$GLOBAL_DEFAULT_SERVICES_DISABLE
;
do
switch
$i
off
;
done
# explicitly specified behaviour (e.g. via conf.d)
for
i
in
$GLOBAL_SERVICES_ENABLE
;
do
switch
$i
on
;
done
for
i
in
$GLOBAL_SERVICES_DISABLE
;
do
switch
$i
off
;
done
# defaults systemd services
for
i
in
$GLOBAL_DEFAULT_SYSTEMD_SERVICES_ENABLE
;
do
switch
$i
on
;
done
for
i
in
$GLOBAL_DEFAULT_SYSTEMD_SERVICES_DISABLE
;
do
switch
$i
off
;
done
# explicitly specified behaviour systemd services
for
i
in
$GLOBAL_SYSTEMD_SERVICES_ENABLE
;
do
switch
$i
on
;
done
for
i
in
$GLOBAL_SYSTEMD_SERVICES_DISABLE
;
do
switch
$i
off
;
done
SERVICES
=
"
$GLOBAL_DEFAULT_SERVICES_ENABLE
$GLOBAL_DEFAULT_SERVICES_DISABLE
"
SERVICES
=
"
$SERVICES
$GLOBAL_SERVICES_ENABLE
$GLOBAL_SERVICES_DISABLE
"
SERVICES
=
"
$SERVICES
$GLOBAL_DEFAULT_SYSTEMD_SERVICES_ENABLE
$GLOBAL_DEFAULT_SYSTEMD_SERVICES_DISABLE
"
SERVICES
=
"
$SERVICES
$GLOBAL_SYSTEMD_SERVICES_ENABLE
$GLOBAL_SYSTEMD_SERVICES_DISABLE
"
SERVICES
=
"
$(
echo
$SERVICES
|
tr
" "
"
\n
"
|
sort
-u
)
"
for
i
in
$SERVICES
;
do
onoff
=
"
$(
shell_config_get
"
$STATUS
"
"
$i
"
)
"
[
-n
"
$onoff
"
]
||
continue
echo
"
$i
"
>>
"
$CONFDIR
"
/services-
"
$onoff
"
done
if
[
-s
"
$CONFDIR
"
/services-on
]
;
then
if
[
-s
"
$CONFDIR
"
/systemd-enabled
]
||
[
-n
"
$GLOBAL_SYSTEMD_SERVICES_ENABLE
"
]
;
then
cat
"
$CONFDIR
"
/services-on
>>
"
$CONFDIR
"
/systemd-enabled
rm
"
$CONFDIR
"
/services-on
else
cp
-a
"
$CONFDIR
"
/
{
services-on,systemd-enabled
}
fi
fi
if
[
-s
"
$CONFDIR
"
/services-off
]
;
then
if
[
-s
"
$CONFDIR
"
/systemd-disabled
]
||
[
-n
"
$GLOBAL_SYSTEMD_SERVICES_DISABLE
"
]
;
then
cat
"
$CONFDIR
"
/services-off
>>
"
$CONFDIR
"
/systemd-disabled
rm
"
$CONFDIR
"
/services-off
else
cp
-a
"
$CONFDIR
"
/
{
services-off,systemd-disabled
}
fi
fi
rm
"
$STATUS
"
# Mask|Unmask systemd units
STATUS
=
`
mktemp
`
CHECK_FILES
=
for
f
in
systemd-mask systemd-unmask
;
do
[
-s
"
$CONFDIR
/
$f
"
]
||
continue
CHECK_FILES
=
"
$CHECK_FILES
$CONFDIR
/
$f
"
done
for
i
in
$GLOBAL_SYSTEMD_SERVICES_MASK
;
do
switch
$i
mask
;
done
for
i
in
$GLOBAL_SYSTEMD_SERVICES_UNMASK
;
do
switch
$i
unmask
;
done
SERVICES
=
"
$GLOBAL_SYSTEMD_SERVICES_MASK
$GLOBAL_SYSTEMD_SERVICES_UNMASK
"
SERVICES
=
"
$(
echo
$SERVICES
|
tr
" "
"
\n
"
|
sort
-u
)
"
for
i
in
$SERVICES
;
do
maskunmask
=
"
$(
shell_config_get
"
$STATUS
"
"
$i
"
)
"
[
-n
"
$maskunmask
"
]
||
continue
echo
"
$i
"
>>
"
$CONFDIR
"
/systemd-
"
$maskunmask
"
ed
done
rm
"
$STATUS
"
# Enable|Disable logind services
STATUS
=
`
mktemp
`
CHECK_FILES
=
for
f
in
systemd-user-enabled systemd-user-disabled
;
do
[
-s
"
$CONFDIR
/
$f
"
]
||
continue
CHECK_FILES
=
"
$CHECK_FILES
$CONFDIR
/
$f
"
done
# defaults logind services
for
i
in
$GLOBAL_DEFAULT_SYSTEMD_USER_SERVICES_ENABLE
;
do
switch
$i
enabled
;
done
for
i
in
$GLOBAL_DEFAULT_SYSTEMD_USER_SERVICES_DISABLE
;
do
switch
$i
disabled
;
done
# explicitly specified behaviour logind services
for
i
in
$GLOBAL_SYSTEMD_USER_SERVICES_ENABLE
;
do
switch
$i
enabled
;
done
for
i
in
$GLOBAL_SYSTEMD_USER_SERVICES_DISABLE
;
do
switch
$i
disabled
;
done
SERVICES
=
"
$GLOBAL_DEFAULT_SYSTEMD_USER_SERVICES_ENABLE
$GLOBAL_DEFAULT_SYSTEMD_USER_SERVICES_DISABLE
"
SERVICES
=
"
$SERVICES
$GLOBAL_SYSTEMD_USER_SERVICES_ENABLE
$GLOBAL_SYSTEMD_USER_SERVICES_DISABLE
"
SERVICES
=
"
$(
echo
"
$SERVICES
"
|
tr
' '
'\n'
|
sort
-u
)
"
for
i
in
$SERVICES
;
do
onoff
=
"
$(
shell_config_get
"
$STATUS
"
"
$i
"
)
"
[
-n
"
$onoff
"
]
||
continue
echo
"
$i
"
>>
"
$CONFDIR
"
/systemd-user-
"
$onoff
"
done
rm
"
$STATUS
"
:
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