@@ -782,22 +782,24 @@ static void strv_pair_print(char **l, const char *prefix) {
782782 printf ("%*s %s=%s\n" , (int ) strlen (prefix ), "" , * p , * q );
783783}
784784
785- static int get_sysext_scopes (DissectedImage * m , char * * * ret_scopes ) {
785+ static int get_extension_scopes (DissectedImage * m , char * * * ret_scopes ) {
786786 _cleanup_strv_free_ char * * l = NULL ;
787787 const char * e ;
788788
789789 assert (m );
790790 assert (ret_scopes );
791791
792- /* If there's no extension-release file its not a system extension. Otherwise the SYSEXT_SCOPE field
793- * indicates which scope it is for — and it defaults to "system" + "portable" if unset. */
794-
792+ /* If there's no extension-release file its not a system extension. Otherwise the SYSEXT_SCOPE
793+ * field for sysext images and the CONFEXT_SCOPE field for confext images indicates which scope
794+ * it is for — and it defaults to "system" + "portable" if unset. */
795795 if (!m -> extension_release ) {
796796 * ret_scopes = NULL ;
797797 return 0 ;
798798 }
799799
800800 e = strv_env_pairs_get (m -> extension_release , "SYSEXT_SCOPE" );
801+ if (!e )
802+ e = strv_env_pairs_get (m -> extension_release , "CONFEXT_SCOPE" );
801803 if (e )
802804 l = strv_split (e , WHITESPACE );
803805 else
@@ -858,7 +860,7 @@ static int action_dissect(DissectedImage *m, LoopDevice *d) {
858860 else if (r < 0 )
859861 return log_error_errno (r , "Failed to acquire image metadata: %m" );
860862 else if (arg_json_format_flags & JSON_FORMAT_OFF ) {
861- _cleanup_strv_free_ char * * sysext_scopes = NULL ;
863+ _cleanup_strv_free_ char * * extension_scopes = NULL ;
862864
863865 if (!sd_id128_is_null (m -> image_uuid ))
864866 printf ("Image UUID: %s\n" , SD_ID128_TO_UUID_STRING (m -> image_uuid ));
@@ -896,21 +898,22 @@ static int action_dissect(DissectedImage *m, LoopDevice *d) {
896898 printf (" %s initrd\n" ,
897899 COLOR_MARK_BOOL (!strv_isempty (m -> initrd_release )));
898900
899- r = get_sysext_scopes (m , & sysext_scopes );
901+ r = get_extension_scopes (m , & extension_scopes );
900902 if (r < 0 )
901- return log_error_errno (r , "Failed to parse SYSEXT_SCOPE : %m" );
903+ return log_error_errno (r , "Failed to parse scope : %m" );
902904
903- printf (" %s extension for system\n" ,
904- COLOR_MARK_BOOL (strv_contains (sysext_scopes , "system" )));
905- printf (" %s extension for initrd\n" ,
906- COLOR_MARK_BOOL (strv_contains (sysext_scopes , "initrd" )));
907- printf (" %s extension for portable service\n" ,
908- COLOR_MARK_BOOL (strv_contains (sysext_scopes , "portable" )));
905+ const char * string_class = image_class_to_string (m -> image_class );
906+ printf (" %s %s extension for system\n" ,
907+ COLOR_MARK_BOOL (strv_contains (extension_scopes , "system" )), string_class );
908+ printf (" %s %s extension for initrd\n" ,
909+ COLOR_MARK_BOOL (strv_contains (extension_scopes , "initrd" )), string_class );
910+ printf (" %s %s extension for portable service\n" ,
911+ COLOR_MARK_BOOL (strv_contains (extension_scopes , "portable" )), string_class );
909912
910913 putc ('\n' , stdout );
911914 } else {
912915 _cleanup_ (json_variant_unrefp ) JsonVariant * mi = NULL , * osr = NULL , * irdr = NULL , * exr = NULL ;
913- _cleanup_strv_free_ char * * sysext_scopes = NULL ;
916+ _cleanup_strv_free_ char * * extension_scopes = NULL ;
914917
915918 if (!strv_isempty (m -> machine_info )) {
916919 r = strv_pair_to_json (m -> machine_info , & mi );
@@ -936,9 +939,9 @@ static int action_dissect(DissectedImage *m, LoopDevice *d) {
936939 return log_oom ();
937940 }
938941
939- r = get_sysext_scopes (m , & sysext_scopes );
942+ r = get_extension_scopes (m , & extension_scopes );
940943 if (r < 0 )
941- return log_error_errno (r , "Failed to parse SYSEXT_SCOPE : %m" );
944+ return log_error_errno (r , "Failed to parse scope : %m" );
942945
943946 r = json_build (& v , JSON_BUILD_OBJECT (
944947 JSON_BUILD_PAIR ("name" , JSON_BUILD_STRING (bn )),
@@ -955,9 +958,10 @@ static int action_dissect(DissectedImage *m, LoopDevice *d) {
955958 JSON_BUILD_PAIR_CONDITION (m -> has_init_system >= 0 , "useBootableContainer" , JSON_BUILD_BOOLEAN (m -> has_init_system )),
956959 JSON_BUILD_PAIR ("useInitrd" , JSON_BUILD_BOOLEAN (!strv_isempty (m -> initrd_release ))),
957960 JSON_BUILD_PAIR ("usePortableService" , JSON_BUILD_BOOLEAN (strv_env_pairs_get (m -> os_release , "PORTABLE_MATCHES" ))),
958- JSON_BUILD_PAIR ("useSystemExtension" , JSON_BUILD_BOOLEAN (strv_contains (sysext_scopes , "system" ))),
959- JSON_BUILD_PAIR ("useInitRDExtension" , JSON_BUILD_BOOLEAN (strv_contains (sysext_scopes , "initrd" ))),
960- JSON_BUILD_PAIR ("usePortableExtension" , JSON_BUILD_BOOLEAN (strv_contains (sysext_scopes , "portable" )))));
961+ JSON_BUILD_PAIR ("ExtensionType" , JSON_BUILD_STRING (image_class_to_string (m -> image_class ))),
962+ JSON_BUILD_PAIR ("useSystemExtension" , JSON_BUILD_BOOLEAN (strv_contains (extension_scopes , "system" ))),
963+ JSON_BUILD_PAIR ("useInitRDExtension" , JSON_BUILD_BOOLEAN (strv_contains (extension_scopes , "initrd" ))),
964+ JSON_BUILD_PAIR ("usePortableExtension" , JSON_BUILD_BOOLEAN (strv_contains (extension_scopes , "portable" )))));
961965 if (r < 0 )
962966 return log_oom ();
963967 }
0 commit comments