diff --git a/subcommands/common_config.go b/subcommands/common_config.go index 8fe65429..d36ae455 100644 --- a/subcommands/common_config.go +++ b/subcommands/common_config.go @@ -232,9 +232,19 @@ func SetUpdatesConfig(opts *SetUpdatesConfigOptions, reportedTag string, reporte if reportedApps != nil { fmt.Printf("Apps reported as installed on device: [%s]\n", strings.Join(reportedApps, ",")) } - fmt.Printf("Setting apps to [%s]\n", opts.UpdateApps) - sota.Set("pacman.docker_apps", opts.UpdateApps) - sota.Set("pacman.compose_apps", opts.UpdateApps) + if strings.TrimSpace(opts.UpdateApps) == "-" { + fmt.Printf("Setting apps to system default.\n") + if sota.Has("pacman.docker_apps") { + DieNotNil(sota.Delete("pacman.docker_apps")) + } + if sota.Has("pacman.compose_apps") { + DieNotNil(sota.Delete("pacman.compose_apps")) + } + } else { + fmt.Printf("Setting apps to [%s]\n", opts.UpdateApps) + sota.Set("pacman.docker_apps", opts.UpdateApps) + sota.Set("pacman.compose_apps", opts.UpdateApps) + } changed = true } if opts.UpdateTag != "" && configuredTag != opts.UpdateTag { @@ -245,8 +255,15 @@ func SetUpdatesConfig(opts *SetUpdatesConfigOptions, reportedTag string, reporte if len(reportedTag) > 0 { fmt.Printf("Tag reported by device: %s\n", reportedTag) } - fmt.Printf("Setting tag to %s\n", opts.UpdateTag) - sota.Set("pacman.tags", opts.UpdateTag) + if strings.TrimSpace(opts.UpdateTag) == "-" { + fmt.Printf("Setting tag to system default.\n") + if sota.Has("pacman.tags") { + DieNotNil(sota.Delete("pacman.tags")) + } + } else { + fmt.Printf("Setting tag to %s\n", opts.UpdateTag) + sota.Set("pacman.tags", opts.UpdateTag) + } changed = true } diff --git a/subcommands/config/updates.go b/subcommands/config/updates.go index 26a57315..c71a373f 100644 --- a/subcommands/config/updates.go +++ b/subcommands/config/updates.go @@ -20,11 +20,30 @@ in a device group. When run without options, prints out the current configuratio # Make devices start taking updates from Targets tagged with "devel": fioctl config updates --group beta --tag devel - # Set the docker apps that devices will run: + # Set the Compose apps that devices will run: fioctl config updates --group beta --apps shellhttpd - # Set the docker apps and the tag for devices: - fioctl config updates --group beta --apps shellhttpd --tag master`, + # Set the Compose apps and the tag for devices: + fioctl config updates --group beta --apps shellhttpd --tag master + + # There are two special characters: "," and "-". + # Providing a "," sets the Compose apps to "none" for devices. + # This will make the device run no apps: + fioctl config updates --apps , + + # Providing a "-" sets the Compose apps to "preset-apps" (all apps on most devices). + # The system looks in the following locations to get the complete config: + - /usr/lib/sota/conf.d/ + - /var/sota/sota.toml + - /etc/sota/conf.d/ + fioctl config updates --apps - + + # Set the device tag to a "preset-tag", + # and the system will look in the following locations to get the complete config: + - /usr/lib/sota/conf.d/ + - /var/sota/sota.toml + - /etc/sota/conf.d/ + fioctl config updates --tag -`, } cmd.AddCommand(configUpdatesCmd) configUpdatesCmd.Flags().StringP("group", "g", "", "Device group to use") diff --git a/subcommands/devices/config_updates.go b/subcommands/devices/config_updates.go index 23480da3..66f94a9e 100644 --- a/subcommands/devices/config_updates.go +++ b/subcommands/devices/config_updates.go @@ -21,12 +21,29 @@ currently configured and reporting.`, # Make a device start taking updates from Targets tagged with "devel" fioctl devices config updates --tag devel - # Set the docker apps a device will run: + # Set the Compose apps a device will run: fioctl devices config updates --apps shellhttpd - # Set the docker apps and the tag: + # Set the Compose apps and the tag: fioctl devices config updates --apps shellhttpd --tag master -`, + + # There are two special characters: "," and "-". + # Providing a "," sets the Compose apps to "none", meaning it will run no apps: + fioctl devices config updates --apps , + + # Providing a "-" sets the Compose apps to "preset-apps" (all apps on most devices). + # The system looks in the following locations to get the complete config: + - /usr/lib/sota/conf.d/ + - /var/sota/sota.toml + - /etc/sota/conf.d/ + fioctl devices config updates --apps - + + # Set the device tag to a preset-tag, + # and the system will look in the following locations in order to get the complete config: + - /usr/lib/sota/conf.d/ + - /var/sota/sota.toml + - /etc/sota/conf.d/ + fioctl devices config updates --tag -`, } configCmd.AddCommand(configUpdatesCmd) configUpdatesCmd.Flags().StringP("tag", "", "", "Target tag for device to follow")