Skip to content

Commit

Permalink
Added systemd code to bootstrap rear with Fedora15 and other distro's…
Browse files Browse the repository at this point in the history
… with systemd
  • Loading branch information
gdha committed Mar 17, 2011
1 parent 2dffe66 commit f7fa02b
Show file tree
Hide file tree
Showing 44 changed files with 480 additions and 0 deletions.
7 changes: 7 additions & 0 deletions usr/share/rear/CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
Version 1.11.0 not yet released
-------------------------------
2011-03-17 GD * Added systemd code to bootstrap rear with Fedora15 and other distro's with systemd
2011-03-16 JH * Enable the use of the layout code when the USE_LAYOUT flag is specified.
Prevent several scripts from running during a restore when the USE_LAYOUT flag is specified
Move LVM and MD tools inclusion to prep/ from dr/
Introduce a flag to control the use of the layout code (USE_LAYOUT="y") to use new
layout method, otherwise the old dr method is still used.
*** Be aware: give feedback on mailing list with your results
2011-03-14 GD * added patch SF#3192697 (from John Baldwin) conc. restoring point in time
with NBU
2011-03-11 DAG * several minor fixes in 95_copy_result_files.sh, 85_make_USB_bootable.sh,
Expand Down
1 change: 1 addition & 0 deletions usr/share/rear/skel/default/etc/mtab
25 changes: 25 additions & 0 deletions usr/share/rear/skel/default/etc/systemd/system.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# See systemd.conf(5) for details

[Manager]
LogLevel=debug
LogTarget=kmsg
#LogColor=yes
#LogLocation=no
#DumpCore=yes
CrashShell=yes
ShowStatus=yes
#SysVConsole=yes
#CrashChVT=1
#CPUAffinity=1 2
#MountAuto=yes
#SwapAuto=yes
#DefaultControllers=cpu
DefaultStandardOutput=inherit
DefaultStandardError=inherit
14 changes: 14 additions & 0 deletions usr/share/rear/skel/default/lib/systemd/system/basic.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# See systemd.special(7) for details

[Unit]
Description=Basic System
Requires=sysinit.target sockets.target
#After=sysinit.target sockets.target
RefuseManualStart=yes
14 changes: 14 additions & 0 deletions usr/share/rear/skel/default/lib/systemd/system/final.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# See systemd.special(7) for details

[Unit]
Description=Final Step
DefaultDependencies=no
RefuseManualStart=yes
After=shutdown.target umount.target
9 changes: 9 additions & 0 deletions usr/share/rear/skel/default/lib/systemd/system/getty.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

[Unit]
Description=Login Prompts
37 changes: 37 additions & 0 deletions usr/share/rear/skel/default/lib/systemd/system/getty@.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

[Unit]
Description=Getty on %I
BindTo=dev-%i.device
After=dev-%i.device

# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
# getty.target didn't actually pull it in.
#Before=getty.target

[Service]
Environment=TERM=linux
#ExecStart=-/bin/agetty %I 38400
#ExecStart=/bin/agetty %I 38400
ExecStart=/bin/mingetty %I
Restart=always
RestartSec=0
UtmpIdentifier=%I
KillMode=process-group

# Unset locale for the console getty since the console has problems
# displaying some internationalized messages.
Environment=LANG= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGE= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=

# Some login implementations ignore SIGTERM, so we send SIGHUP
# instead, to ensure that login terminates cleanly.
KillSignal=SIGHUP

[Install]
Alias=getty.target.wants/getty@tty1.service getty.target.wants/getty@tty2.service getty.target.wants/getty@tty3.service getty.target.wants/getty@tty4.service
16 changes: 16 additions & 0 deletions usr/share/rear/skel/default/lib/systemd/system/halt.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

[Unit]
Description=Halt
DefaultDependencies=no
Requires=shutdown.target umount.target final.target
After=shutdown.target umount.target final.target

[Service]
Type=oneshot
ExecStart=/bin/systemctl --force halt
18 changes: 18 additions & 0 deletions usr/share/rear/skel/default/lib/systemd/system/halt.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# See systemd.special(7) for details

[Unit]
Description=Halt
DefaultDependencies=no
Requires=halt.service
After=halt.service
AllowIsolate=yes

[Install]
Alias=ctrl-alt-del.target
17 changes: 17 additions & 0 deletions usr/share/rear/skel/default/lib/systemd/system/multi-user.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# See systemd.special(7) for details

[Unit]
Description=Multi-User
Requires=sysinit.target
Names=runlevel3.target
AllowIsolate=yes

[Install]
Alias=default.target
16 changes: 16 additions & 0 deletions usr/share/rear/skel/default/lib/systemd/system/poweroff.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

[Unit]
Description=Power-Off
DefaultDependencies=no
Requires=shutdown.target umount.target final.target
After=shutdown.target umount.target final.target

[Service]
Type=oneshot
ExecStart=/bin/systemctl --force poweroff
19 changes: 19 additions & 0 deletions usr/share/rear/skel/default/lib/systemd/system/poweroff.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# See systemd.special(7) for details

[Unit]
Description=Power-Off
DefaultDependencies=no
Names=runlevel0.target
Requires=poweroff.service
After=poweroff.service
AllowIsolate=yes

[Install]
Alias=ctrl-alt-del.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Unit]
Description=ReaR boot script
DefaultDependencies=no

[Service]
Type=oneshot
ExecStart=/etc/scripts/boot
16 changes: 16 additions & 0 deletions usr/share/rear/skel/default/lib/systemd/system/reboot.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

[Unit]
Description=Reboot
DefaultDependencies=no
Requires=shutdown.target umount.target final.target
After=shutdown.target umount.target final.target

[Service]
Type=oneshot
ExecStart=/bin/systemctl --force reboot
19 changes: 19 additions & 0 deletions usr/share/rear/skel/default/lib/systemd/system/reboot.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# See systemd.special(7) for details

[Unit]
Description=Reboot
DefaultDependencies=no
Names=runlevel6.target
Requires=reboot.service
After=reboot.service
AllowIsolate=yes

[Install]
Alias=ctrl-alt-del.target
11 changes: 11 additions & 0 deletions usr/share/rear/skel/default/lib/systemd/system/rpcbind.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# See systemd.special(7) for details

[Unit]
Description=RPC Port Mapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Unit]
Description=ReaR run-syslog script
DefaultDependencies=no

[Service]
Type=oneshot
ExecStart=/etc/scripts/run-syslog
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Unit]
Description=ReaR system setup script
DefaultDependencies=no

[Service]
Type=oneshot
ExecStart=/etc/scripts/system-setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

[Unit]
Description=Serial Getty on %I
BindTo=dev-%i.device
After=dev-%i.device

# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
# getty.target didn't actually pull it in.
After=getty.target

[Service]
Environment=TERM=vt100
ExecStart=-/bin/agetty -s %I 115200,38400,9600
Restart=always
RestartSec=0
UtmpIdentifier=%I
KillMode=process-group

# Some login implementations ignore SIGTERM, so we send SIGHUP
# instead, to ensure that login terminates cleanly.
KillSignal=SIGHUP
13 changes: 13 additions & 0 deletions usr/share/rear/skel/default/lib/systemd/system/shutdown.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# See systemd.special(7) for details

[Unit]
Description=Shutdown
DefaultDependencies=no
RefuseManualStart=yes
11 changes: 11 additions & 0 deletions usr/share/rear/skel/default/lib/systemd/system/sockets.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# See systemd.special(7) for details

[Unit]
Description=Sockets
9 changes: 9 additions & 0 deletions usr/share/rear/skel/default/lib/systemd/system/sshd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=ReaR sshd service
DefaultDependencies=no
ConditionPathExists=/etc/inittab

[Service]
ExecStart=/etc/scripts/run-sshd
Type=oneshot
TimeoutSec=0

4 comments on commit f7fa02b

@pcahyna
Copy link
Member

@pcahyna pcahyna commented on f7fa02b Jun 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gdha , do you remember why is there sysinit.service and run-system-setup.service that execute the same script? Isn't the latter redundant?

@gdha
Copy link
Member Author

@gdha gdha commented on f7fa02b Jun 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pcahyna looks indeed that sysinit.service is redundant in favor of run-system-setup.service. My best guess is that sysinit.service was the first attempt to use systemd with ReaR and still keep the old SysV style in place.

@pcahyna
Copy link
Member

@pcahyna pcahyna commented on f7fa02b Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pcahyna looks indeed that sysinit.service is redundant in favor of run-system-setup.service.

Thanks for the reply @gdha, I believe it is rather vice-versa, because sysinit.service is actually executed during boot, while run-system-setup.service is not (and the former has also well-defined meaning in the usual boot sequence, see bootup(7), so some other stuff is expecting it). Therefore, I am going to remove run-system-setup.service and keep sysinit.service.

@pcahyna
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #3041

Please sign in to comment.