Gentoo Stage 4 Utilities Suite
Find a file
Walter Hüttenmeyer d4ded4bd5f add new portage paths with optional portageq logic (#18)
* add new portage paths

added /var/db/repos/gentoo and /var/cache/distfiles to hard-coded list of excludes.
Portage has moved (when?) according to https://wiki.gentoo.org/wiki//usr/portage

* Added portageq logic

Added portageq logic to detect where portage stores its tree and distfiles.
If this fails, fall back to a default list declared in EXCLUDES_DEFAULT_PORTAGE
2019-08-05 14:18:24 +02:00
.gitignore Initial commit 2014-05-18 23:52:33 +02:00
LICENSE Initial commit 2014-05-18 23:52:33 +02:00
mkstage4.sh add new portage paths with optional portageq logic (#18) 2019-08-05 14:18:24 +02:00
README.md Clarified distribution 2019-08-02 17:28:43 +02:00

mkstage4

This is a Bash script to create stage 4 tarballs either for the running system, or a system at a specified mount point. The script is a new edition of an earlier mkstage4 script by Greg Fitzgerald (unmaintained as of 2012) which is itself a revamped edition of the original mkstage4 by Reto Glauser (unmaintaied as of 2009).

More information on mkstage4 can be found on its own Chymeric Tutorials article: mkstage4 - Stage 4 Tarballs Made Easy.

Chinese Introduction 中文说明

Installation

The script can be run directly from its containing folder (and thus, is installed simply by downloading or cloning it from here - and adding run permissions):

git clone https://github.com/TheChymera/mkstage4.git /your/mkstage4/directory
cd /your/mkstage4/directory
chmod +x mkstage4.sh

For Gentoo Linux and Derivatives, mkstage4 is also available in Portage via the base Gentoo overlay. On any Gentoo system, just run the following command:

emerge app-backup/mkstage4

Usage

If you are running the script from the containing folder (first install method) please make sure you use the ./mkstage4.sh command instead of just mkstage4!

Archive your current system (mounted at /):

mkstage4 -s archive_name

Archive system located at a custom mount point:

mkstage4 -t /custom/mount/point archive_name

Command line arguments:

  mkstage4.sh [-q -c -b -l -k -p] [-s || -t <target-mountpoint>] [-e <additional excludes dir*>] <archive-filename> [custom-tar-options]
  -q: activates quiet mode (no confirmation).
  -c: excludes connman network lists.
  -b: excludes boot directory.
  -l: excludes lost+found directory.
  -p: compresses parallelly using pbzip2.
  -e: an additional excludes directory (one dir one -e).
  -s: makes tarball of current system.
  -k: separately save current kernel modules and src (smaller & save decompression time).
  -t: makes tarball of system located at the <target-mountpoint>.
  -h: displays help message.

Extract Tarball

Tarballs created with mkstage4 can be extracted with:

tar xvjpf archive_name.tar.bz2

If you use -k option, extract src & modules separately

tar xvjpf archive_name.tar.bz2.kmod
tar xvjpf archive_name.tar.bz2.ksrc

If you have install pbzip2, you can extract parallelly with:

tar -I pbzip2 -xvf archive_name.tar.bz2

Dependencies

  • Bash - in Portage as app-shells/bash
  • tar - in Portage as app-arch/tar
  • pbzip2 (optional, if it is installed the archive can be compressed using multiple parallel threads) - in Portage as app-arch/pbzip2

Please note that these are very basic dependencies and should already be included in any Linux system.


Released under the GPLv3 license. Project led by Horea Christian (address all correspondence to: chr@chymera.eu).