File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 191191# and when the name is prefixed with a "-" it means that the extension should be disabled if enabled by default in the file from /usr.
192192# It may contain comments starting with "#" at the beginning of a line or after a name.
193193# The file is also used in bootengine to know which extensions to enable.
194- # Note that we don't need "{ grep || true ; }" to suppress the match return code because in for _ in $(grep...) return codes are ignored
195- for NAME in $( grep -h -o ' ^[^#]*' /etc/flatcar/enabled-sysext.conf /usr/share/flatcar/enabled-sysext.conf | grep -v -x -f <( grep ' ^-' /etc/flatcar/enabled-sysext.conf | cut -d - -f 2-) | grep -v -P ' ^(-).*' ) ; do
196- KEEP=" /etc/flatcar/sysext/flatcar-${NAME} -${VERSION} .raw"
197- shopt -s nullglob
198- # Delete sysext images that belonged to the now overwritten /usr partition but keep the sysext image for the current version
199- for OLD_IMAGE in /etc/flatcar/sysext/flatcar* raw; do
200- if [ " ${OLD_IMAGE} " != " ${KEEP} " ] && [ -f " ${OLD_IMAGE} " ]; then
201- rm -f " ${OLD_IMAGE} "
202- fi
194+ ENABLED_EXTENSIONS=$( grep -h -o ' ^[^#]*' /etc/flatcar/enabled-sysext.conf /usr/share/flatcar/enabled-sysext.conf | grep -v -x -f <( grep ' ^-' /etc/flatcar/enabled-sysext.conf | cut -d - -f 2-) | grep -v -P ' ^(-).*' || true)
195+ shopt -s nullglob
196+ # Delete sysext images that belonged to the now overwritten /usr partition but keep the sysext image for the current version
197+ for OLD_IMAGE in /etc/flatcar/sysext/flatcar* raw; do
198+ SHOULD_KEEP=false
199+ for NAME in ${ENABLED_EXTENSIONS} ; do
200+ if [ " ${OLD_IMAGE} " == " /etc/flatcar/sysext/flatcar-${NAME} -${VERSION} .raw" ]; then
201+ SHOULD_KEEP=true
202+ break
203+ fi
203204 done
205+ if [ " ${SHOULD_KEEP} " == false ] && [ -f " ${OLD_IMAGE} " ]; then
206+ rm -f " ${OLD_IMAGE} "
207+ fi
208+ done
209+ for NAME in ${ENABLED_EXTENSIONS} ; do
204210 # Note that in the case of VERSION=NEXT_VERSION we will replace the running sysext and maybe it's better
205211 # to do so than not because it allows to recover from a corrupted file (where the corruption happened on disk)
206212 SUCCESS=false
You can’t perform that action at this time.
0 commit comments