You are not logged in.

#1 2014-02-19 09:31:44

timelaw
Member
Registered: 2013-02-04
Posts: 30

Custom Arch Boot-USB with preloaded package list

Hello guys!

The other day I was just thinking that it would be amazing to not having to reinstall each system (I have many PCs) from scratch and was wondering if I could make a bootable USB with a preloaded script to download and install the most common packages I always install. I guess I could do that by adding a script to the USB which would be in the root's "home" during USB-boot. But I'm just asking to see if there's a better way (if it would work at all)

Offline

#2 2014-02-19 10:33:01

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Re: Custom Arch Boot-USB with preloaded package list

Why not create your best fit installation on a computer and copy all the disk contents to a USB using atleast a tar archive.

On the new computer:
- setup partitions
- untar .tar file
- install grub and adapt grub.cfg


fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

#3 2014-02-19 12:15:39

timelaw
Member
Registered: 2013-02-04
Posts: 30

Re: Custom Arch Boot-USB with preloaded package list

Rexilion wrote:

Why not create your best fit installation on a computer and copy all the disk contents to a USB using atleast a tar archive.

On the new computer:
- setup partitions
- untar .tar file
- install grub and adapt grub.cfg

Mostly because I'm installing on a lot of different kinds of PCs. Laptops, desktops, and recently even Macs. So, drivers and such are very different and so I want an installation process but with a pre-set list of packages to download. It's not the downloading that is the issue, but the manual process of actually remembering everything and it would save a lot of time if I had it this way.

So the installation on my desktop wouldn't work on my other ones. Especially since I have three different architectures.

Offline

#4 2014-02-19 12:25:18

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Re: Custom Arch Boot-USB with preloaded package list

For that, I have a script. It uses pacman's ability to mark packages as 'explicitly' installed. Place the script in your homedir and create a file containing the packages you want. Make sure you prefix it with packagelist- . This will allow you to keep your installation well maintainable by scrubbing it from orhpaned deps and such.

You can use 'pacman -D --asdeps' , 'pacman -D --asexplicit' and 'pacman -Qtd' to maintain your installation.

You mention the heterogeneity of computers you install ArchLinux on. I think that it could still pay to create a base installation and roll that. Adding some packages on top. Not many packages are hardware specific. Even the firmware is just linux-firmware (and some other files). Furthermore the xf86-video-* and xf86-input-* spring to mind. But that is about it. And maybe the mac has an additional package or two?

#!/bin/bash

SYS_INSTALLED=$(pacman -Qe | awk '{ print $1 }'| sort)
LIST=$(for i in $(cat ${0%/*}/packagelist-* | grep -v '^#'); do echo $i; done | sort)

for pak in $(echo "$LIST" | uniq -d)
		do echo "$pak" duplicate
done

for pak in $(echo -e "$LIST"'\n'"$SYS_INSTALLED" | sort | uniq -u)
	do if pacman -Qe | awk '{ print $1 }' | grep -q \^"$pak"\$
		then echo "$pak" not in list
		else echo "$pak" not explicitly installed
	fi
done

fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

#5 2014-02-19 19:17:55

M177ER
Member
Registered: 2008-06-15
Posts: 148

Re: Custom Arch Boot-USB with preloaded package list

This is a copy + paste from the Wiki:
https://wiki.archlinux.org/index.php/Pa … d_packages


Backing up and retrieving a list of installed packages

It is good practice to keep periodic backups of all pacman-installed packages. In the event of a system crash which is unrecoverable by other means, pacman can then easily reinstall the very same packages onto a new installation.
■ First, backup the current list of non-local packages:

$ pacman -Qqen > pkglist.txt

■ Store the pkglist.txt on a USB key or other convenient medium or gist.github.com or Evernote, Dropbox, etc.
■ Copy the pkglist.txt file to the new installation, and navigate to the directory containing it.
■ Issue the following command to install from the backup list:

# pacman -S $(< pkglist.txt)

*** I have a note to use this so it doesn't reinstall packages that I already have.

# pacman -S --needed $(< pkglist.txt)

In the case you have a list which was not generated like mentioned above, there may be foreign packages in it (i.e. packages not belonging to any repos you have configured, or packages from the AUR).

In such a case, you may still want to install all available packages from that list:

 # pacman -S --needed $(comm -12 <(pacman -Slq|sort) <(sort badpkdlist) )

Explanation:
■ pacman -Slq lists all available softwares, but the list is sorted by repository first, hence the sort command.
■ Sorted files are required in order to make the comm command work.
■ The -12 parameter display lines common to both entries.
■ The --needed switch is used to skip already installed packages.




You could edit the pkglist.txt to keep a list of packages that you know you what to have installed on each computer

Last edited by M177ER (2014-02-19 19:21:02)

Offline

Board footer

Powered by FluxBB