A couple of questions about sbopkg
by FlinchX from LinuxQuestions.org on (#4ZXZS)
I have been a sbopkg user for a few years and it was good enough for not motivating me to look for alternatives.
Recently I decided to teach myself using sbopkg in batch mode with a future low-priority goal of being able to automate some package installs with it.
Things I already learned by reading the manpage and experimenting:
- changing default locations (by setting persistent environment variables in root's bash profile)
- syncing the repository (-r)
- check for an update of sbopkg itself (-u)
- checking for updates (-c)
- updating packages (-i and passing it package names displayed by -c)
- exclude interactive prompts (a combination of -B and -e)
- list installed SBo packages (-p)
So far I feel like I'm able to reproduce almost everything I do when using sbopkg interactively (invoking it with no arguments), but there are a couple of knowledge gaps that I'd like to plug.
1. When using sbopkg in interactive mode, after letting "Updates" from main menu run and choosing to add the found updates to the queue, I can pick "Queue" from main menu and load the queue with all suggested updates.
As for sbopkg -c, I have three problems with that.
a. I can notice it's still not fully non-interactive. Sure it does not use dialog widgets, but it still displays that updating progress bar. How to redirect its output to a file for further processing (I admit I did not try that yet), or is it smart enough to detect it and not display the progress bar when I'm redirecting the output to a file?
b. When it finishes working, it displays pretty much what I see in dialog mode. How to get just a list of package names? Or should I post-process the output with a script to get that?
c. It says nothing either about adding potential update to a queue. Where's the queue with updates similar to the interactive version, or there is none?
2. Is the combination of -B and -e enough to exclude ANY prompt when downloading/building/installing things?
3. I have noticed that when building queues with sqg, the packages in the queue are not sorted alphabetically. My guess is that they are placed there in the right order (right as in to exclude the situation when a dependency of a package appears after the actual package that requires it in the queue, thus breaking the build process). At least I can't remember any situation when I had such troubles while using queuefiles. The queue generated by "Updates" is quite different, it seems to sort the updates, which sometimes breaks the way I described above. While I'm usually able to work around this by just knowing and remembering that "package X needs package Y, so I'll build package Y first", I would really like to clear this question up now and forever.
4. IIRC, when downloading/building/installing a list of packages, the workflow is like this:
- download pkg1
- build pkg1
- install pkg1
- repeat for pkg2, ...
So if something breaks midway, I end with just a partial install. Is it possible to avoid this somehow? Like not installing anything from a queue if anything fails to download/build? I have searched through sbopkg manpage and I see nothing that would look like a --dry-run option (for the download/build parts of the download/build/install cycle).
5. If I run sbopkg -i -e stop for a list of packages and something fails, how do I get to know it happened? As far as I know, this problem is usually solved by exitting with custom non-zero values of exit codes, but sbopkg's manpage doesn't seem to mention anything about exit codes / return values. I admit I didn't get to the point of trying to find this answer myself by reading the sbopkg code.
My apologies if this post ended being too long, I will appreciate direct answers to any of the questions above as well as links to resources that cover the raised topics. Maybe someone already solved the batch usage of sbopkg problem and documented all the gotchas in a blog post or wiki - I'd be happy to read more about it.
So far I am just trying to improve my sbopkg knowledge, but my future goal is to be able to use sbopkg in full non-interactive mode someday for automating package installs. Maybe with a devops tool (I know for a fact that ansible has a slackpkg module, but doesn't have a sbopkg one).


Recently I decided to teach myself using sbopkg in batch mode with a future low-priority goal of being able to automate some package installs with it.
Things I already learned by reading the manpage and experimenting:
- changing default locations (by setting persistent environment variables in root's bash profile)
- syncing the repository (-r)
- check for an update of sbopkg itself (-u)
- checking for updates (-c)
- updating packages (-i and passing it package names displayed by -c)
- exclude interactive prompts (a combination of -B and -e)
- list installed SBo packages (-p)
So far I feel like I'm able to reproduce almost everything I do when using sbopkg interactively (invoking it with no arguments), but there are a couple of knowledge gaps that I'd like to plug.
1. When using sbopkg in interactive mode, after letting "Updates" from main menu run and choosing to add the found updates to the queue, I can pick "Queue" from main menu and load the queue with all suggested updates.
As for sbopkg -c, I have three problems with that.
a. I can notice it's still not fully non-interactive. Sure it does not use dialog widgets, but it still displays that updating progress bar. How to redirect its output to a file for further processing (I admit I did not try that yet), or is it smart enough to detect it and not display the progress bar when I'm redirecting the output to a file?
b. When it finishes working, it displays pretty much what I see in dialog mode. How to get just a list of package names? Or should I post-process the output with a script to get that?
c. It says nothing either about adding potential update to a queue. Where's the queue with updates similar to the interactive version, or there is none?
2. Is the combination of -B and -e enough to exclude ANY prompt when downloading/building/installing things?
3. I have noticed that when building queues with sqg, the packages in the queue are not sorted alphabetically. My guess is that they are placed there in the right order (right as in to exclude the situation when a dependency of a package appears after the actual package that requires it in the queue, thus breaking the build process). At least I can't remember any situation when I had such troubles while using queuefiles. The queue generated by "Updates" is quite different, it seems to sort the updates, which sometimes breaks the way I described above. While I'm usually able to work around this by just knowing and remembering that "package X needs package Y, so I'll build package Y first", I would really like to clear this question up now and forever.
4. IIRC, when downloading/building/installing a list of packages, the workflow is like this:
- download pkg1
- build pkg1
- install pkg1
- repeat for pkg2, ...
So if something breaks midway, I end with just a partial install. Is it possible to avoid this somehow? Like not installing anything from a queue if anything fails to download/build? I have searched through sbopkg manpage and I see nothing that would look like a --dry-run option (for the download/build parts of the download/build/install cycle).
5. If I run sbopkg -i -e stop for a list of packages and something fails, how do I get to know it happened? As far as I know, this problem is usually solved by exitting with custom non-zero values of exit codes, but sbopkg's manpage doesn't seem to mention anything about exit codes / return values. I admit I didn't get to the point of trying to find this answer myself by reading the sbopkg code.
My apologies if this post ended being too long, I will appreciate direct answers to any of the questions above as well as links to resources that cover the raised topics. Maybe someone already solved the batch usage of sbopkg problem and documented all the gotchas in a blog post or wiki - I'd be happy to read more about it.
So far I am just trying to improve my sbopkg knowledge, but my future goal is to be able to use sbopkg in full non-interactive mode someday for automating package installs. Maybe with a devops tool (I know for a fact that ansible has a slackpkg module, but doesn't have a sbopkg one).