2. Installing all `ISU package` `systemd` service files to the `systemd` standard locations
(`/run/generator/systemd`) to override system-default service files (`/usr/lib/systemd`),
which are checked in later
-3. Altering installed `systemd` service files to provide fallback to start non-ISU (original)
-services in case of situation, where an ISU service do not work and/or keeps crashing.
#### Details of `isu-generator` operation
- note that for `user-services` the user session path is different and is defined when
the program is invoked by the `systemd --user` instance.
- - installs original unit name under `nonisu-SERVICE_NAME` for use in
- case of ISU package failure
-
- installs mount unit to mount ISU rootfs in `/run/isu/ISU_PKG_NAME/rootfs`
(e.g. `run-isu-dlog-rootfs.mount`)
├── /usr/bin/dlog_logger
├── /etc/dlog.conf.d
-As a fallback mechanism, the following procedure is used:
-* original unit is copied to the `systemd-generator` directory as the `nonisu-NAME`
- file, which can be referenced as a normal unit name
-* new service file is automatically modified to include the following:
-
- OnFailure=nonisu-NAME
- Conflicts=nonisu-NAME
-
- which will automatically start the original unit if the ISU package's
- service fails to start or if the signature verification fails.
-
-
### Management of ISU packages
Currently management is assumed to be handled manually by the system administrator.
- note that for user-services (user session path is different and is defined during program invocation
by `systemd --user` instance.
- - installs original unit name under `nonisu-SERVICE_NAME` for use in
- case of ISU package failure
-
- installs mount unit to mount ISU rootfs in `/run/isu/ISU_PKG_NAME/rootfs`
(eg. `run-isu-dlog-rootfs.mount`)
└── rootfs
├── /usr/bin/dlog_logger
├── /etc/dlog.conf.d
-
-As a fallback mechanism following is used:
-* original unit is copied to systemd generator directory as `nonisu-NAME`
- file, which can be referenced as normal unit name
-* new service file is automatically modified to include
-
- OnFailure=nonisu-NAME
- Conflicts=nonisu-NAME
-
- Which will cause to automatically start original unit if ISU package's
- service fails to start (or signature verification fails).
rm -f "${new_srv_path}" "${new_srv_path}.tmp"
- # 1st step: copy ISU package's .service file to generator dir and original .service under diffeerent name
- # (nonisu-.. -> different name is needed as original .service will be masked by our new service from ISU)
cat "$srv_path" > "$new_srv_path".tmp || return 1
if [ -f "$SERVICES_DIR/${srv_fname}" ]; then
- cp -a "$SERVICES_DIR/${srv_fname}" "$UNITDIR/nonisu-${srv_fname}" || return 1
-
- # 2nd step: generate mount unit for ISU image and extend the service file to use it
+ # generate mount unit for ISU image and extend the service file to use it
local mount_unit="run-isu-$(systemd-escape ${isu_pkg_name})-rootfs.mount"
cat <<EOF >> "$UNITDIR/$mount_unit" || return 1
# This unit file has been automatically generated by isu-generator.
[Unit]
After=${mount_unit}
BindsTo=${mount_unit}
-OnFailure=nonisu-${srv_fname}
-Conflicts=nonisu-${srv_fname}
EOF
fi
- # 3rd step: make new unit visible
+ # make new unit visible
mv "${new_srv_path}.tmp" "${new_srv_path}" || return 1
return 0