@@ -158,12 +158,19 @@ func NewWayCommand() []*cmdr.Command {
158
158
return []* cmdr.Command {cmd }
159
159
}
160
160
161
- func wayClean (cmd * cobra.Command , args []string ) error {
162
- if ! core .IsWayland () {
161
+ func isSupported () {
162
+ switch core .IsSupported () {
163
+ case 1 :
163
164
cmdr .Error .Println (vso .Trans ("waydroid.vso.errors.notWayland" ))
164
165
os .Exit (1 )
165
- return nil
166
+ case 2 :
167
+ cmdr .Error .Println (vso .Trans ("waydroid.vso.errors.secureBoot" ))
168
+ os .Exit (1 )
166
169
}
170
+ }
171
+
172
+ func wayClean (cmd * cobra.Command , args []string ) error {
173
+ isSupported ()
167
174
168
175
cmdr .Info .Println (vso .Trans ("waydroid.clean.info.index" ))
169
176
_ , err := os .Stat (core .IndexCacheDir )
@@ -188,10 +195,7 @@ func wayClean(cmd *cobra.Command, args []string) error {
188
195
}
189
196
190
197
func wayDelete (cmd * cobra.Command , args []string ) error {
191
- if ! core .IsWayland () {
192
- cmdr .Error .Println (vso .Trans ("waydroid.vso.errors.notWayland" ))
193
- os .Exit (1 )
194
- }
198
+ isSupported ()
195
199
196
200
if core .AskConfirmation (vso .Trans ("waydroid.delete.confirmation" ), false ) {
197
201
return core .WayDelete ()
@@ -200,10 +204,7 @@ func wayDelete(cmd *cobra.Command, args []string) error {
200
204
}
201
205
202
206
func wayInfo (cmd * cobra.Command , args []string ) error {
203
- if ! core .IsWayland () {
204
- cmdr .Error .Println (vso .Trans ("waydroid.vso.errors.notWayland" ))
205
- os .Exit (1 )
206
- }
207
+ isSupported ()
207
208
208
209
if len (args ) < 1 {
209
210
cmdr .Error .Println (vso .Trans ("waydroid.error.noArguments" ))
@@ -245,10 +246,7 @@ func wayInfo(cmd *cobra.Command, args []string) error {
245
246
}
246
247
247
248
func wayStatus (cmd * cobra.Command , args []string ) error {
248
- if ! core .IsWayland () {
249
- cmdr .Error .Println (vso .Trans ("waydroid.vso.errors.notWayland" ))
250
- os .Exit (1 )
251
- }
249
+ isSupported ()
252
250
253
251
_ , err := core .GetWay ()
254
252
if err != nil {
@@ -263,10 +261,7 @@ func wayStatus(cmd *cobra.Command, args []string) error {
263
261
}
264
262
265
263
func wayInit (cmd * cobra.Command , args []string ) error {
266
- if ! core .IsWayland () {
267
- cmdr .Error .Println (vso .Trans ("waydroid.vso.errors.notWayland" ))
268
- os .Exit (1 )
269
- }
264
+ isSupported ()
270
265
271
266
force , _ := cmd .Flags ().GetBool ("force" )
272
267
@@ -289,10 +284,7 @@ func wayInit(cmd *cobra.Command, args []string) error {
289
284
}
290
285
291
286
func wayInstallRemote (search string , noconfirm bool , noprompt bool ) (string , core.FdroidPackage , error ) {
292
- if ! core .IsWayland () {
293
- cmdr .Error .Println (vso .Trans ("waydroid.vso.errors.notWayland" ))
294
- os .Exit (1 )
295
- }
287
+ isSupported ()
296
288
297
289
_ , err := os .Stat (core .APKCacheDir )
298
290
if os .IsNotExist (err ) {
@@ -345,10 +337,7 @@ func wayInstallRemote(search string, noconfirm bool, noprompt bool) (string, cor
345
337
}
346
338
347
339
func wayInstall (cmd * cobra.Command , args []string ) error {
348
- if ! core .IsWayland () {
349
- cmdr .Error .Println (vso .Trans ("waydroid.vso.errors.notWayland" ))
350
- os .Exit (1 )
351
- }
340
+ isSupported ()
352
341
353
342
if len (args ) == 0 {
354
343
cmdr .Error .Println (vso .Trans ("waydroid.error.noArguments" ))
@@ -423,10 +412,7 @@ func wayInstall(cmd *cobra.Command, args []string) error {
423
412
}
424
413
425
414
func wayLaunch (cmd * cobra.Command , args []string ) error {
426
- if ! core .IsWayland () {
427
- cmdr .Error .Println (vso .Trans ("waydroid.vso.errors.notWayland" ))
428
- os .Exit (1 )
429
- }
415
+ isSupported ()
430
416
431
417
way , err := core .GetWay ()
432
418
if err != nil {
@@ -444,10 +430,7 @@ func wayLaunch(cmd *cobra.Command, args []string) error {
444
430
}
445
431
446
432
func wayLauncher (cmd * cobra.Command , args []string ) error {
447
- if ! core .IsWayland () {
448
- cmdr .Error .Println (vso .Trans ("waydroid.vso.errors.notWayland" ))
449
- os .Exit (1 )
450
- }
433
+ isSupported ()
451
434
452
435
way , err := core .GetWay ()
453
436
if err != nil {
@@ -465,10 +448,7 @@ func wayLauncher(cmd *cobra.Command, args []string) error {
465
448
}
466
449
467
450
func wayRemove (cmd * cobra.Command , args []string ) error {
468
- if ! core .IsWayland () {
469
- cmdr .Error .Println (vso .Trans ("waydroid.vso.errors.notWayland" ))
470
- os .Exit (1 )
471
- }
451
+ isSupported ()
472
452
473
453
way , err := core .GetWay ()
474
454
if err != nil {
@@ -541,10 +521,7 @@ func wayRemove(cmd *cobra.Command, args []string) error {
541
521
}
542
522
543
523
func waySearch (cmd * cobra.Command , args []string ) error {
544
- if ! core .IsWayland () {
545
- cmdr .Error .Println (vso .Trans ("waydroid.vso.errors.notWayland" ))
546
- os .Exit (1 )
547
- }
524
+ isSupported ()
548
525
549
526
if len (args ) == 0 {
550
527
cmdr .Error .Println (vso .Trans ("waydroid.error.noArguments" ))
@@ -568,10 +545,7 @@ func waySearch(cmd *cobra.Command, args []string) error {
568
545
}
569
546
570
547
func waySync (cmd * cobra.Command , args []string ) error {
571
- if ! core .IsWayland () {
572
- cmdr .Error .Println (vso .Trans ("waydroid.vso.errors.notWayland" ))
573
- os .Exit (1 )
574
- }
548
+ isSupported ()
575
549
576
550
err := core .GetRepos ()
577
551
if err != nil {
@@ -583,10 +557,7 @@ func waySync(cmd *cobra.Command, args []string) error {
583
557
}
584
558
585
559
func wayUpdate (cmd * cobra.Command , args []string ) error {
586
- if ! core .IsWayland () {
587
- cmdr .Error .Println (vso .Trans ("waydroid.vso.errors.notWayland" ))
588
- os .Exit (1 )
589
- }
560
+ isSupported ()
590
561
591
562
db , err := core .GetWayDatabase ()
592
563
if err != nil {
0 commit comments