Home Antergos Packup – A Script To Quickly Share Updates Via USB Drive In Arch Linux

Packup – A Script To Quickly Share Updates Via USB Drive In Arch Linux

By sk
Published: Last Updated on 734 views

Update:

Looks like Packup GitHub repository has been removed. I couldn't find it anywhere on Internet. I suggest you all to look for other alternatives.

A while ago, we have written a guide that described how to install packages offline in Ubuntu and its derivatives. Today, we are going to do the same in Arch Linux. This guide teach you to install packages on any offline Arch Linux systems. By doing this, you can save your Internet bandwidth greatly if you have lot of Arch Linux systems. You don't need to repeatedly download packages on or update all Arch Linux systems on your network. Just update one Arch Linux system (let us call it as a main or server system) and pass the downloaded updates from the main system to all other Arch systems in the network. It doesn’t matter whether the other systems must have Internet connection or not. This is where Packup comes in handy. It is a simple script that allows you share the updates via USB stick or external hard disk. The main goal of Packup utility is to reduce internet bandwidth or to allow any offline systems in a possible manner using pacman and any AUR helper programs like Yay. This brief tutorial describes how to quickly share updates via USB or External drive to any offline Arch Linux systems.

Packup - A Script To Quickly Share Updates Via USB Drive In Arch Linux

For the demonstration purpose of this guide, we will be using two Arch Linux systems, one with Internet connection and another without Internet connection. And, we also a need a USB stick or external HDD with sufficient space available.

Steps to do on both systems (Offline and Online systems)

Install NodeJS on all systems. NodeJS is available on default repositories, so you can install it using Pacman as shown below.

$ sudo pacman -S nodejs npm

If you want to transfer AUR packages, you must have installed any AUR helper on your Arch Linux system. Refer the following link to install Yay.

Steps to do on Internet-enabled (Online) system

Go to the your Internet-connected system, and plug-in your USB or External drive. Change to your USB drive and clone the Packup project.

$ cd /run/media/sk/bce5f14a-097a-41c5-88ec-c38e20410182/
$ git clone https://github.com/cookiengineer/packup;

The contents of Packup GitHub repository will be cloned in a directory called "Packup" in your USB or external drive.

Switch to the "Packup" directory:

$ cd packup/

Run the following command to backup both all available local packages and the package index to your USB drive.

$ ./backup.js;

This will take a while depending upon the number packages available in your system.

Finally, run the following command:

$ sync;

You must run the above command before removing the USB drive.

Now, safely remove the USB drive and go to your offline system.

Steps to do on offline system

Plug-in the USB drive and go to the "Packup" directory in your USB drive. I have mounted my USB drive under /mnt.

$ cd /mnt/packup/

Next, update the index for pacman using command:

$ sudo cp ./sync/*.db /var/lib/pacman/sync/;

Then, run the following command:

$ ./upgrade.js;

This command will display the pacman command to manually update from the local packages (using pacman -U).

:: Execute this to upgrade from local package cache:

cd "/run/.../packup"; sudo pacman -U gcc-7.1.1-4-x86_64.pkg.tar.xz gdb-common-8.0-1-x86_64.pkg.tar.xz

Additionally, if you have missing packages that need to be downloaded from main computer (Internet-enabled system), it will display the command that you need to execute on the other computer (using "pacman -Sw --cachedir").

:: Execute this to download upgrades into local package cache:

cd "/run/.../packup"; sudo pacman -Sw --cachedir "/run/.../packup" geoip ghostscript;

So, you can use the above command on an Internet-connected system and download the missing packages and execute them again in the offline system to update the packages. Sounds, great? Indeed!

Once you done with Packup, you can clean up the old packages from your USB drive as shown below.

$ cd /path/to/usb/drive/packup/
$ ./clean.js;
$ sync;

Don't forget to run "sync" command before removing USB drive.

And, that's all for now. As you can see, Packup is simple, yet very useful utility that needs to be keep in your arsenal. If you have a lot of Arch Linux systems, you can use this tool to save Internet bandwidth greatly.

Resource:

  • Packup GitHub Repository

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

2 comments

Jenny January 24, 2019 - 4:07 pm

https://github.com/cookiengineer/packup
doesn’t exist anymore.

Can you know others similar scripts?

Reply
sk January 25, 2019 - 12:09 pm

I don’t know any similar scripts at present. Sorry.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More