File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,7 @@ pub(crate) fn require_root() -> Result<()> {
245
245
/// A few process changes that need to be made for writing.
246
246
#[ context( "Preparing for write" ) ]
247
247
pub ( crate ) async fn prepare_for_write ( ) -> Result < ( ) > {
248
+ crate :: cli:: require_root ( ) ?;
248
249
if ostree_ext:: container_utils:: is_ostree_container ( ) ? {
249
250
anyhow:: bail!(
250
251
"Detected container (ostree base); this command requires a booted host system."
Original file line number Diff line number Diff line change @@ -104,13 +104,24 @@ pub(crate) fn impl_run_container() -> Result<()> {
104
104
let sh = Shell :: new ( ) ?;
105
105
let host: Host = serde_yaml:: from_str ( & cmd ! ( sh, "bootc status" ) . read ( ) ?) ?;
106
106
assert ! ( host. status. is_container) ;
107
+ println ! ( "ok status" ) ;
108
+
107
109
for c in [ "upgrade" , "update" ] {
108
110
let o = Command :: new ( "bootc" ) . arg ( c) . output ( ) ?;
109
111
let st = o. status ;
110
112
assert ! ( !st. success( ) ) ;
111
113
let stderr = String :: from_utf8 ( o. stderr ) ?;
112
- assert ! ( stderr. contains( "this command requires a booted host system " ) ) ;
114
+ assert ! ( stderr. contains( "This command requires full root privileges " ) ) ;
113
115
}
116
+ println ! ( "ok upgrade/update are errors in container" ) ;
117
+
118
+ let o = Command :: new ( "runuser" )
119
+ . args ( [ "-u" , "bin" , "bootc" , "upgrade" ] )
120
+ . output ( ) ?;
121
+ assert ! ( !o. status. success( ) ) ;
122
+ let stderr = String :: from_utf8 ( o. stderr ) ?;
123
+ assert ! ( stderr. contains( "requires root privileges" ) ) ;
124
+
114
125
println ! ( "ok container integration testing" ) ;
115
126
Ok ( ( ) )
116
127
}
Original file line number Diff line number Diff line change @@ -261,6 +261,7 @@ pub(crate) fn get_status(
261
261
}
262
262
263
263
/// Implementation of the `bootc status` CLI command.
264
+ #[ context( "Status" ) ]
264
265
pub ( crate ) async fn status ( opts : super :: cli:: StatusOpts ) -> Result < ( ) > {
265
266
let host = if ostree_ext:: container_utils:: is_ostree_container ( ) ? {
266
267
let status = HostStatus {
@@ -271,6 +272,7 @@ pub(crate) async fn status(opts: super::cli::StatusOpts) -> Result<()> {
271
272
r. status = status;
272
273
r
273
274
} else {
275
+ crate :: cli:: require_root ( ) ?;
274
276
let sysroot = super :: cli:: get_locked_sysroot ( ) . await ?;
275
277
let booted_deployment = sysroot. booted_deployment ( ) ;
276
278
let ( _deployments, host) = get_status ( & sysroot, booted_deployment. as_ref ( ) ) ?;
You can’t perform that action at this time.
0 commit comments