summaryrefslogtreecommitdiffstats
path: root/classes/image_types_ostree.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'classes/image_types_ostree.bbclass')
-rw-r--r--classes/image_types_ostree.bbclass55
1 files changed, 40 insertions, 15 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass
index 134f5f5..edddf37 100644
--- a/classes/image_types_ostree.bbclass
+++ b/classes/image_types_ostree.bbclass
@@ -16,11 +16,11 @@ OSTREE_UPDATE_SUMMARY ??= "0"
16SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'systemd', 'true', '')}" 16SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'systemd', 'true', '')}"
17 17
18IMAGE_CMD_ostree () { 18IMAGE_CMD_ostree () {
19 if [ -z "$OSTREE_REPO" ]; then 19 if [ -z "${OSTREE_REPO}" ]; then
20 bbfatal "OSTREE_REPO should be set in your local.conf" 20 bbfatal "OSTREE_REPO should be set in your local.conf"
21 fi 21 fi
22 22
23 if [ -z "$OSTREE_BRANCHNAME" ]; then 23 if [ -z "${OSTREE_BRANCHNAME}" ]; then
24 bbfatal "OSTREE_BRANCHNAME should be set in your local.conf" 24 bbfatal "OSTREE_BRANCHNAME should be set in your local.conf"
25 fi 25 fi
26 26
@@ -93,15 +93,15 @@ IMAGE_CMD_ostree () {
93 if [ "$(ls -A $dir)" ]; then 93 if [ "$(ls -A $dir)" ]; then
94 bbwarn "Data in /$dir directory is not preserved by OSTree. Consider moving it under /usr" 94 bbwarn "Data in /$dir directory is not preserved by OSTree. Consider moving it under /usr"
95 fi 95 fi
96
97 if [ -n "${SYSTEMD_USED}" ]; then
98 echo "d /var/rootdirs/${dir} 0755 root root -" >>${tmpfiles_conf}
99 else
100 echo "mkdir -p /var/rootdirs/${dir}; chown 755 /var/rootdirs/${dir}" >>${tmpfiles_conf}
101 fi
102 rm -rf ${dir} 96 rm -rf ${dir}
103 ln -sf var/rootdirs/${dir} ${dir}
104 fi 97 fi
98
99 if [ -n "${SYSTEMD_USED}" ]; then
100 echo "d /var/rootdirs/${dir} 0755 root root -" >>${tmpfiles_conf}
101 else
102 echo "mkdir -p /var/rootdirs/${dir}; chown 755 /var/rootdirs/${dir}" >>${tmpfiles_conf}
103 fi
104 ln -sf var/rootdirs/${dir} ${dir}
105 done 105 done
106 106
107 if [ -d root ] && [ ! -L root ]; then 107 if [ -d root ] && [ ! -L root ]; then
@@ -110,20 +110,39 @@ IMAGE_CMD_ostree () {
110 fi 110 fi
111 111
112 if [ -n "${SYSTEMD_USED}" ]; then 112 if [ -n "${SYSTEMD_USED}" ]; then
113 echo "d /var/roothome 0755 root root -" >>${tmpfiles_conf} 113 echo "d /var/roothome 0700 root root -" >>${tmpfiles_conf}
114 else 114 else
115 echo "mkdir -p /var/roothome; chown 755 /var/roothome" >>${tmpfiles_conf} 115 echo "mkdir -p /var/roothome; chown 700 /var/roothome" >>${tmpfiles_conf}
116 fi 116 fi
117 117
118 rm -rf root 118 rm -rf root
119 ln -sf var/roothome root 119 ln -sf var/roothome root
120 fi 120 fi
121 121
122 # Creating boot directories is required for "ostree admin deploy" 122 if [ -d usr/local ] && [ ! -L usr/local ]; then
123 if [ "$(ls -A usr/local)" ]; then
124 bbfatal "Data in /usr/local directory is not preserved by OSTree."
125 fi
126 rm -rf usr/local
127 fi
123 128
124 mkdir -p boot/loader.0 129 if [ -n "${SYSTEMD_USED}" ]; then
125 mkdir -p boot/loader.1 130 echo "d /var/usrlocal 0755 root root -" >>${tmpfiles_conf}
126 ln -sf boot/loader.0 boot/loader 131 else
132 echo "mkdir -p /var/usrlocal; chown 755 /var/usrlocal" >>${tmpfiles_conf}
133 fi
134
135 dirs="bin etc games include lib man sbin share src"
136
137 for dir in ${dirs}; do
138 if [ -n "${SYSTEMD_USED}" ]; then
139 echo "d /var/usrlocal/${dir} 0755 root root -" >>${tmpfiles_conf}
140 else
141 echo "mkdir -p /var/usrlocal/${dir}; chown 755 /var/usrlocal/${dir}" >>${tmpfiles_conf}
142 fi
143 done
144
145 ln -sf ../var/usrlocal usr/local
127 146
128 checksum=`sha256sum ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} | cut -f 1 -d " "` 147 checksum=`sha256sum ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} | cut -f 1 -d " "`
129 148
@@ -241,6 +260,12 @@ IMAGE_CMD_garagesign () {
241 ${target_url} \ 260 ${target_url} \
242 --sha256 ${ostree_target_hash} \ 261 --sha256 ${ostree_target_hash} \
243 --hardwareids ${SOTA_HARDWARE_ID} 262 --hardwareids ${SOTA_HARDWARE_ID}
263 if [ -n "${GARAGE_CUSTOMIZE_TARGET}" ]; then
264 bbplain "Running command(${GARAGE_CUSTOMIZE_TARGET}) to customize target"
265 ${GARAGE_CUSTOMIZE_TARGET} \
266 ${GARAGE_SIGN_REPO}/tufrepo/roles/unsigned/targets.json \
267 ${GARAGE_TARGET_NAME}-${target_version}
268 fi
244 garage-sign targets sign --repo tufrepo \ 269 garage-sign targets sign --repo tufrepo \
245 --home-dir ${GARAGE_SIGN_REPO} \ 270 --home-dir ${GARAGE_SIGN_REPO} \
246 --key-name=targets 271 --key-name=targets