diff options
author | Stefan Agner <stefan.agner@toradex.com> | 2019-07-19 22:11:50 +0200 |
---|---|---|
committer | Laurent Bonnans <laurent.bonnans@here.com> | 2019-08-15 17:49:09 +0200 |
commit | 9ad56b95d14b5f88011239180e8a0f533cca8c24 (patch) | |
tree | 54ae776543c87fe2f4c620822dad5b4cc3e5eabb | |
parent | cf24eba09f3b32a5ca84345ee8d94d2ea9071a7b (diff) | |
download | meta-updater-9ad56b95d14b5f88011239180e8a0f533cca8c24.tar.gz |
image_types_ostree: add /usr/local support
Add /usr/local support as outlined in OSTree documentation. This
makes sure that a writeable and persistent /usr/local directory
is available.
See also: https://ostree.readthedocs.io/en/latest/manual/adapting-existing/
Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
-rw-r--r-- | classes/image_types_ostree.bbclass | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 39d04dc..2e8e8f5 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
@@ -104,6 +104,31 @@ IMAGE_CMD_ostree () { | |||
104 | ln -sf var/roothome root | 104 | ln -sf var/roothome root |
105 | fi | 105 | fi |
106 | 106 | ||
107 | if [ -d usr/local ] && [ ! -L usr/local ]; then | ||
108 | if [ "$(ls -A usr/local)" ]; then | ||
109 | bbfatal "Data in /usr/local directory is not preserved by OSTree." | ||
110 | fi | ||
111 | rm -rf usr/local | ||
112 | fi | ||
113 | |||
114 | if [ -n "${SYSTEMD_USED}" ]; then | ||
115 | echo "d /var/usrlocal 0755 root root -" >>${tmpfiles_conf} | ||
116 | else | ||
117 | echo "mkdir -p /var/usrlocal; chown 755 /var/usrlocal" >>${tmpfiles_conf} | ||
118 | fi | ||
119 | |||
120 | dirs="bin etc games include lib man sbin share src" | ||
121 | |||
122 | for dir in ${dirs}; do | ||
123 | if [ -n "${SYSTEMD_USED}" ]; then | ||
124 | echo "d /var/usrlocal/${dir} 0755 root root -" >>${tmpfiles_conf} | ||
125 | else | ||
126 | echo "mkdir -p /var/usrlocal/${dir}; chown 755 /var/usrlocal/${dir}" >>${tmpfiles_conf} | ||
127 | fi | ||
128 | done | ||
129 | |||
130 | ln -sf ../var/usrlocal usr/local | ||
131 | |||
107 | if [ "${KERNEL_IMAGETYPE}" = "fitImage" ]; then | 132 | if [ "${KERNEL_IMAGETYPE}" = "fitImage" ]; then |
108 | # this is a hack for ostree not to override init= in kernel cmdline - | 133 | # this is a hack for ostree not to override init= in kernel cmdline - |
109 | # make it think that the initramfs is present (while it is in FIT image) | 134 | # make it think that the initramfs is present (while it is in FIT image) |