start delayed.service --> finish default.target --> start all of delayed.service -->
finish delayed.target --> StartupFinished
Change-Id: I2f291ea8b5f535157eec4f105f2c37b0cea448c9
LOCAL_FS_TARGET_WANTS =
MULTI_USER_TARGET_WANTS =
GRAPHICAL_TARGET_WANTS =
+DELAYED_TARGET_WANTS=
RESCUE_TARGET_WANTS =
SYSINIT_TARGET_WANTS =
SOCKETS_TARGET_WANTS =
TIMERS_TARGET_WANTS =
USER_SOCKETS_TARGET_WANTS =
USER_DEFAULT_TARGET_WANTS =
+USER_DELAYED_TARGET_WANTS =
USER_BUSNAMES_TARGET_WANTS =
SYSTEM_UNIT_ALIASES =
what="$(LOCAL_FS_TARGET_WANTS)" && wants=local-fs.target && dir=$(systemunitdir) && $(add-wants)
what="$(MULTI_USER_TARGET_WANTS)" && wants=multi-user.target && dir=$(systemunitdir) && $(add-wants)
what="$(GRAPHICAL_TARGET_WANTS)" && wants=graphical.target && dir=$(systemunitdir) && $(add-wants)
+ what="$(DELAYED_TARGET_WANTS)" && wants=delayed.target && dir=$(systemunitdir) && $(add-wants)
what="$(RESCUE_TARGET_WANTS)" && wants=rescue.target && dir=$(systemunitdir) && $(add-wants)
what="$(SYSINIT_TARGET_WANTS)" && wants=sysinit.target && dir=$(systemunitdir) && $(add-wants)
what="$(SOCKETS_TARGET_WANTS)" && wants=sockets.target && dir=$(systemunitdir) && $(add-wants)
what="$(SLICES_TARGET_WANTS)" && wants=slices.target && dir=$(systemunitdir) && $(add-wants)
what="$(USER_SOCKETS_TARGET_WANTS)" && wants=sockets.target && dir=$(userunitdir) && $(add-wants)
what="$(USER_DEFAULT_TARGET_WANTS)" && wants=default.target && dir=$(userunitdir) && $(add-wants)
+ what="$(USER_DELAYED_TARGET_WANTS)" && wants=delayed.target && dir=$(userunitdir) && $(add-wants)
install-busnames-target-wants-hook:
what="$(BUSNAMES_TARGET_WANTS)" && wants=busnames.target && dir=$(systemunitdir) && $(add-wants)
dist_systemunit_DATA += \
units/delayed.target \
- units/delayed.service
+ units/booting-done.service \
+ units/system-delayed-target-trigger.service \
+ units/system-default-target-done.service \
+ units/system-delayed-target-done.service
GRAPHICAL_TARGET_WANTS += \
- delayed.service
+ system-delayed-target-trigger.service \
+ system-default-target-done.service
+
+DELAYED_TARGET_WANTS += \
+ booting-done.service \
+ system-delayed-target-done.service
dist_systemunit_DATA_busnames += \
units/busnames.target
dist_userunit_DATA += \
units/user/delayed.target \
- units/user/delayed.service
+ units/user/user-delayed-target-trigger.service \
+ units/user/user-default-target-done.service \
+ units/user/user-delayed-target-done.service
USER_DEFAULT_TARGET_WANTS += \
- delayed.service
+ user-delayed-target-trigger.service \
+ user-default-target-done.service
+
+USER_DELAYED_TARGET_WANTS += \
+ user-delayed-target-done.service
nodist_userunit_DATA = \
units/user/systemd-exit.service
Source1: pamconsole-tmp.conf
Source2: %{name}-rpmlintrc
Source3: test-runner.c
-Source4: wait_systemd_startupfinished.sh
+Source4: wait-default-target.sh
+Source5: wait-delayed-target.sh
Source1001: systemd.manifest
BuildRequires: gperf
BuildRequires: intltool >= 0.40.0
ln -sf ./libsystemd.pc %{buildroot}%{_libdir}/pkgconfig/libsystemd-login.pc
# Delayed target
-install -m 0755 %{SOURCE4} %{buildroot}%{_bindir}/wait_systemd_startupfinished.sh
+install -m 0755 %{SOURCE4} %{buildroot}%{_bindir}/wait-default-target.sh
+install -m 0755 %{SOURCE5} %{buildroot}%{_bindir}/wait-delayed-target.sh
+
# end of install
%pre
%{_prefix}/lib/systemd/network/99-default.link
%exclude %{_prefix}/lib/systemd/system-preset/90-systemd.preset
%{_prefix}/lib/systemd/user/delayed.target
-%{_prefix}/lib/systemd/user/delayed.service
-%{_prefix}/lib/systemd/user/default.target.wants/delayed.service
+%{_prefix}/lib/systemd/user/user-delayed-target-trigger.service
+%{_prefix}/lib/systemd/user/default.target.wants/user-delayed-target-trigger.service
+%{_prefix}/lib/systemd/user/user-default-target-done.service
+%{_prefix}/lib/systemd/user/default.target.wants/user-default-target-done.service
+%{_prefix}/lib/systemd/user/user-delayed-target-done.service
+%{_prefix}/lib/systemd/user/delayed.target.wants/user-delayed-target-done.service
%{_prefix}/lib/systemd/libsystemd-shared-231.so
%{_prefix}/lib/systemd/libsystemd-shared.so
%{_localstatedir}/log/journal
-%{_bindir}/wait_systemd_startupfinished.sh
+%{_bindir}/wait-default-target.sh
+%{_bindir}/wait-delayed-target.sh
%files -n libsystemd
%manifest %{name}.manifest
--- /dev/null
+#!/bin/bash
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+for loop in {1..30}
+do
+ echo $1: ${loop}/30
+
+ if [ -f /run/systemd/system/graphical.target.done -a -f /run/user/5001/systemd/default.target.done ]
+ then
+ echo $1: "System and User Default Target Done"
+ # Do nothing, service unit do next step.
+
+ exit 0
+ fi
+
+ /usr/bin/sleep 1
+done
+
+# timeout
+#########################################################################################################
+echo $1: "Default Target 30 Seconds Timeout"
+# Do nothing, service unit do next step.
+
+exit 0
--- /dev/null
+#!/bin/bash
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+for loop in {1..30}
+do
+ echo ${loop}/30
+
+ if [ -f /run/systemd/system/delayed.target.done -a -f /run/user/5001/systemd/delayed.target.done -a -f /run/systemd/system/graphical.target.done -a -f /run/user/5001/systemd/default.target.done ]
+ then
+ echo "System and User Delayed Target Done"
+ /usr/bin/vconftool set -t int memory/sysman/booting_status 1 -f
+ /usr/bin/dbus-send --type=signal --system /org/tizen/system org.tizen.system.Booting.BootingDone int32:1
+
+ exit 0
+ fi
+
+ /usr/bin/sleep 1
+done
+
+# timeout
+#########################################################################################################
+echo "Delayed Target 30 Seconds Timeout"
+/usr/bin/vconftool set -t int memory/sysman/booting_status 3 -f
+/usr/bin/dbus-send --type=signal --system /org/tizen/system org.tizen.system.Booting.BootingDone int32:3
+
+exit 0
+++ /dev/null
-#!/bin/bash
-PATH=/bin:/usr/bin:/sbin:/usr/sbin
-
-IS_USER_SESSION=" "
-if [ "$1" = "--user" ]
-then
- IS_USER_SESSION="--user"
-fi
-
-WAIT_CMD="/usr/bin/systemctl "${IS_USER_SESSION}" is-system-running"
-EXEC_CMD="/usr/bin/systemctl --no-block "${IS_USER_SESSION}" start delayed.target"
-
-echo "Wait CMD:" ${WAIT_CMD}
-echo "Exec CMD:" ${EXEC_CMD}
-
-while [ 1 ]
-do
- STATE=$($WAIT_CMD)
- echo ${STATE}
-
- if [ ${STATE} = "running" -o ${STATE} = "degraded" ]
- then
- $($EXEC_CMD)
- exit 0;
- fi
-
- /usr/bin/sleep 1
-done
-
--- /dev/null
+[Unit]
+Description=All Delayed Target Booting Done Service
+RefuseManualStart=yes
+RefuseManualStop=yes
+
+[Service]
+User=system_fw
+Group=system_fw
+ExecStart=/usr/bin/wait-delayed-target.sh
+RemainAfterExit=yes
+SmackProcessLabel=System
+++ /dev/null
-[Unit]
-Description=Trigger System Delayed services
-Requires=graphical.target
-After=graphical.target
-DefaultDependencies=no
-RefuseManualStart=yes
-RefuseManualStop=yes
-
-[Service]
-ExecStart=/usr/bin/wait_systemd_startupfinished.sh
-RemainAfterExit=yes
-SmackProcessLabel=System
[Unit]
-Description=System Delayed Services
+Description=System Delayed Target
--- /dev/null
+[Unit]
+Description=System Default Target Done Service
+After=graphical.target
+DefaultDependencies=no
+RefuseManualStart=yes
+RefuseManualStop=yes
+
+[Service]
+Type=oneshot
+User=system_fw
+Group=system_fw
+ExecStart=/usr/bin/touch /run/systemd/system/graphical.target.done
+RemainAfterExit=yes
+SecureBits=keep-caps
+Capabilities=cap_dac_override=i
+SmackProcessLabel=System
--- /dev/null
+[Unit]
+Description=System Delayed Target Done Service
+After=delayed.target
+DefaultDependencies=no
+RefuseManualStart=yes
+RefuseManualStop=yes
+
+[Service]
+Type=oneshot
+User=system_fw
+Group=system_fw
+ExecStart=/usr/bin/touch /run/systemd/system/delayed.target.done
+RemainAfterExit=yes
+SecureBits=keep-caps
+Capabilities=cap_dac_override=i
+SmackProcessLabel=System
--- /dev/null
+[Unit]
+Description=System Delayed Target Trigger Service
+After=basic.target
+Wants=wait-mount@opt-usr.service
+After=wait-mount@opt-usr.service
+DefaultDependencies=no
+RefuseManualStart=yes
+RefuseManualStop=yes
+
+[Service]
+# At least one service must remain, and systemd will not enter the Startupfinished state.
+# So this unit, which is oneshot type, becomes that one service.
+Type=oneshot
+ExecStart=/usr/bin/wait-default-target.sh System
+ExecStart=/usr/bin/systemctl --no-block start delayed.target
+RemainAfterExit=yes
+SmackProcessLabel=System
+++ /dev/null
-[Unit]
-Description=Trigger User Delayed Services
-Requires=default.target
-After=default.target
-DefaultDependencies=no
-RefuseManualStart=yes
-RefuseManualStop=yes
-
-[Service]
-ExecStart=/usr/bin/wait_systemd_startupfinished.sh --user
-RemainAfterExit=yes
[Unit]
-Description=User Delayed Services
+Description=User Delayed Target
--- /dev/null
+[Unit]
+Description=User Default Target Done Service
+After=default.target
+DefaultDependencies=no
+RefuseManualStart=yes
+RefuseManualStop=yes
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/touch /run/user/5001/systemd/default.target.done
+RemainAfterExit=yes
--- /dev/null
+[Unit]
+Description=User Delayed Target Done Service
+After=delayed.target
+DefaultDependencies=no
+RefuseManualStart=yes
+RefuseManualStop=yes
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/touch /run/user/5001/systemd/delayed.target.done
+RemainAfterExit=yes
--- /dev/null
+[Unit]
+Description=User Delayed Target Trigger Service
+After=basic.target
+DefaultDependencies=no
+Wants=wait-mount@opt-usr.service
+After=wait-mount@opt-usr.service
+RefuseManualStart=yes
+RefuseManualStop=yes
+
+[Service]
+# At least one service must remain, and systemd will not enter the Startupfinished state.
+# So this unit, which is oneshot type, becomes that one service.
+Type=oneshot
+ExecStart=/usr/bin/wait-default-target.sh User
+ExecStart=/usr/bin/systemctl --no-block --user start delayed.target
+RemainAfterExit=yes