Sunday, June 3, 2018

Apt-offline set-command examples

I realized that my main article on Apt-offline does't provide a sufficient selection of samples of set-commands, perhaps because I assume tnat most people would use the GUI, except when using Apt-offline to install the GUI, in which case you would use the set-command I provided for this case.

In general, the set-command begins with "sudo apt-offline set apt-offline.sig," where "sudo" is a means of requiring the administrative password to be entered in order to begin making any changes (it's also required in order to perform Apt-offline install-ops, which are the final step in the process of making changes via Apt-offline). "Apt-offline set" is the logical beginning for an Apt-offline set-command. "Apt-offline.sig" is the name of the signature file which the command is intended to generate, and I recommend leaving the name as it is, for reasons explained many times elsewhere (it's part of my system for efficiently using Apt-offline). But you could get fancy and insert a path before the signature file name, so that the signature file would end up somewhere else besides the Home directory (wherever you put it, make sure it's a permanent directory, such as Downloads), and you could use a different name for the signature file in each case. But it's just more work.

The rest of the set-command depends on what sort of change you want to make. You can perform an update, install apps, upgrade apps, etc. To do an update, the command would be "sudo apt-offline set apt-offline.sig --update." To install a couple of apps, it would be "sudo apt-offline set apt-offline.sig --install-packages <app1>,<app2>." (Note that there's just a comma between the app-names.) A complete listing of set-command options can be found on Apt-offline's man-page at https://manpages.debian.org/testing/apt-offline/apt-offline.8.en.html.

Apt-offline's command syntax is fairly easy to master, and you could create command-templates containing the options which you normally use, and just copy the template and substitute the particulars in to create the command required for each case. Once you become adept at using the commands, you'll find that it's more efficient to use the commands than to use the GUI.

Installing Apt-offline on a new installation which requires an update before installing anything

I just recently learned that it's sometimes necessary to update the package index before installing anything on a new hdd/ssd installation of Debian Linux or some derivative. This requirement has apparently existed for quite a while, but I've never run into it before despite having performed many installations.

But what if you need to install Apt-offline in order to update the package index? There is a way, but it drastically limits the selection of types of Linux which can be used, because they have to include two things by default: the section of the package index pertaining to Apt-offline, and an app which can install individual packages. The only two that I've found which satisfy these criteria are Ubuntu Mate and KDE Neon, and I'm looking into others. Since it's possible to copy the package LISTS (the installed form of the package index, contained in /var/lib/apt/lists) from Ubuntu Mate to other types of Ubuntu, this might improve the selection of types of Ubuntu which can satisfy the aforementioned criteria. Debian in general doesn't include the pertinent section ("contrib"). Debian KDE might, because 8.7.1 KDE does even though no other version of Debian does, based on my experience.

OK, so what you do is to use a flash-drive installation (of the type of Linux being installed) to generate a download-script for Apt-offline (or Apt-offline GUI, to avoid having to learn set- and install-command syntax, which is somewhat more difficult than falling off a log), by entering "sudo apt install apt-offline," etc. and copying the list of URL's of the files which APT tries to download but can't due to the lack of an internet connection. (To copy the list from the terminal, highlight the list and press Ctlr-Shift-C.) Copy it to a text file named something like DLS-UM1804-AOL.txt (saved with Windows line endings in case you'll end up using it on a Windows PC), edit out everything except the URL's, and use it to download the files, as described in the main article on Apt-offline in this blog.

When you have the packages (.deb files), you would then install them one at a time using a an application which can install single packages, which includes Gdebi and various package manager GUI's. Since the installation-order matters, it's a matter of trial and error - if some dependency is missing, the installer will tell you to install it first. For a small number of packages, this is no big deal, but for a larger number, it can be a PITA, which is why you might want to avoid installing Apt-offline's GUI until after you've installed Apt-offline and can use it to install the GUI.

The first thing you would do after installing Apt-offline would be to update the package index, which requires Apt-offline (for security) and begins by selecting the package-index sections which you might need in the foreseeable future, and various other parameters, using an app such as Software & Updates. Then, if you haven't installed Apt-offline's GUI, you'd use a text command such as "sudo apt-offline set apt-offline.sig --update," which creates a fancy download-script known as a signature file, containing the URL's of the new package-index files and various security-related information, located in the Home directory unless you specify a different location in the set-command, although I would leave it as it is.

Then you'd copy the signature file to what I call a "change-name folder," which is a folder named after the change or changes represented by the signature file. You would also create a folder named "pkgs" (an arbitrary name which has worked well for me) in the change-name folder. (The reason for this approach will become clear as you go through the process of making changes to an installation using Apt-offline. You don't want to wade through an explanation, so just trust me and do this.)

Next, you'd copy the aforementioned change-name folder to a flash drive or smartphone, depending on the device used for performing the Apt-offline get-op. To prepare for the get-op, you would at some point move apt-offline.sig and the "pkgs" folder out of the change-name folder and into the get-process directory, which is just whatever directory is specified in the get-command. The get-command would be something like "apt-offline get <path to get-process directory>/apt-offline.sig -d <path to get-process directory>/pkgs," which means "download the files listed in apt-offline.sig in this directory and put them in the folder pkgs in this directory." (Obviously, pkgs should be empty at the beginning of the process, to keep things organized.)

After the get-op, the signature file and pkgs folder would be moved back to the change-name folder, which would be transferred back to the installation being updated. Finally, an install-op would be performed on the pkgs folder, such as by executing the command "sudo apt-offline install pkgs," assuming that the pkgs folder is located in the Home directory. The update process would be completed, and then you could use Apt-offline to install whatever other available software you desire. I'd start with Apt-offline-gui and Synaptic package manager. The corresponding set-command would be "sudo apt-offline set apt-offline.sig --install-packages apt-offline-gui,synaptic." (Note that the apps are separated by just a comma - no spaces. Each app's special name without caps or spaces can be found by using a software-manager app to perform a search for the app, assuming that the relevant section of the package index is installed.)

Once you make a couple of changes to an installation using Apt-offline, it will become routine. It's not exactly convenient, which is why you should make all of the possible changes which you'll probably want for the foreseeable future at once. It helps if you have frequent and convenient access to a variety of wifi hotspots with good download speeds.

There might be a local Linux users group (LUG) in your area, in which case you could contact them about lugging your desktop PC to a location where you could connect it to the internet in order to set up the software on your PC, at least initially, with someone with experience on hand to provide guidance, and from then on use Apt-offline to make changes.