Verified Commit 0f4eabe1 authored by A. Wilcox's avatar A. Wilcox 🦊
Browse files

adelie-build-cd: Initial work at adding Kind support

parent d24c3c93
......@@ -33,37 +33,37 @@ fatal() {
ensure_commands() {
if ! type apk>/dev/null 2>/dev/null; then
fatal
printf 'You must have apk installed. On Gentoo, see sys-devel/apk-tools.\n'
exit -1
fatal
printf 'You must have apk installed. On Gentoo, see sys-devel/apk-tools.\n'
exit -1
fi
if ! type cpio>/dev/null 2>/dev/null; then
fatal
printf 'You must have cpio installed. On Gentoo, see app-arch/cpio.\n'
exit -1
fatal
printf 'You must have cpio installed. On Gentoo, see app-arch/cpio.\n'
exit -1
fi
if ! type mksquashfs>/dev/null 2>/dev/null; then
fatal
printf 'You must have mksquashfs installed. On Gentoo, see sys-fs/squashfs-tools.\n'
exit -1
fatal
printf 'You must have mksquashfs installed. On Gentoo, see sys-fs/squashfs-tools.\n'
exit -1
fi
if ! type xorriso>/dev/null 2>/dev/null; then
fatal
printf 'You must have xorriso installed:\n\n'
fatal
printf 'You must have xorriso installed:\n\n'
printf '* cdrkit (Alpine, Gentoo) will not generate a usable PPC ISO.\n'
printf '* wodim (Debian) will not generate a usable PPC64 ISO.\n'
printf '* cdrtools (Schily) will overrun the PPC64 ISO and write junk to grubcore.img.\n'
printf '\nSorry, but xorriso really is required.\n'
exit -1
exit -1
fi
}
usage() {
printf 'usage: %s [-a ARCH] [-f|--full] [-p|--phase PHASE] [-v VERSION] [--help]\n\n' $PROGNAME
printf 'usage: %s [-a ARCH] [-f|--full] [-k|--kind KIND] [-p|--phase PHASE] [-v VERSION] [--help]\n\n' $PROGNAME
printf 'Create an Adélie Linux CD image (.ISO) using the specified parameters.\n\n'
printf 'Default ARCH: %s\n' $def_arch
printf 'Default VERSION: %s\n' $def_ver
......@@ -73,38 +73,43 @@ usage() {
while [ -n "$1" ]; do
case $1 in
-a | --arch)
shift
declare -r MY_ARCH=$1
;;
-h | --help)
usage
exit
;;
-f | --full)
declare -r DO_FULL=full
;;
-p | --phase)
shift
declare -r MY_PHASE=$1
;;
-s | --sign)
declare -r SIGN=yes
;;
-v | --version)
shift
declare -r MY_VER=$1
;;
*)
usage >&2
exit -1
;;
-a | --arch)
shift
declare -r MY_ARCH=$1
;;
-h | --help)
usage
exit
;;
-f | --full)
declare -r DO_FULL=full
;;
-k | --kind)
shift
declare -r MY_KIND=$1
;;
-p | --phase)
shift
declare -r MY_PHASE=$1
;;
-s | --sign)
declare -r SIGN=yes
;;
-v | --version)
shift
declare -r MY_VER=$1
;;
*)
usage >&2
exit -1
;;
esac
shift
done
set -a
declare -r ARCH=${MY_ARCH:-$def_arch}
declare -r KIND=${MY_KIND:-live}
declare -r LDARCH=${LDARCH:-$ARCH}
declare -r PHASE=${MY_PHASE:-all}
declare -r VERSION=${MY_VER:-$def_ver}
......@@ -140,6 +145,7 @@ install_pkgs() {
declare -r PACKAGES=$(cat packages 2>/dev/null || fatal 'No core packages specified')
declare -r ARCH_PKGS=$(cat packages-$ARCH 2>/dev/null || echo '')
declare -r KIND_PKGS=$(cat packages-$KIND 2>/dev/null || echo '')
mkdir -p squashroot-$ARCH/etc/apk/keys
cp 'packages@adelielinux.org.pub' squashroot-$ARCH/etc/apk/keys/
......@@ -151,7 +157,7 @@ install_pkgs() {
apk --arch $ARCH \
-X "$URL/system/$EXTRA_MIRROR" \
-X "$URL/user/$EXTRA_MIRROR" \
-U --root squashroot-$ARCH --initdb add $PACKAGES $ARCH_PKGS
-U --root squashroot-$ARCH --initdb add $PACKAGES $ARCH_PKGS $KIND_PKGS
}
make_structure() {
......@@ -177,6 +183,13 @@ make_structure() {
squashroot-$ARCH/etc/runlevels/boot/$bootservice
done
if [ -f services-$KIND ]; then
for service in $(cat services-$KIND 2>/dev/null || echo ''); do
ln -s /etc/init.d/$service \
sqaushroot-$ARCH/etc/runlevels/default/$service
done
fi
cat >squashroot-$ARCH/etc/fstab <<- FSTAB
# Welcome to Adélie Linux.
# This fstab(5) is for the live media only. Do not edit or use for your installation.
......
.Dd August 13, 2017
.Dd February 02, 2020
.Dt ADELIE-BUILD-CD 8 SMM
.Os "Adélie Linux"
.Sh NAME
.Nm adelie-build-cd
.Nd create an Adélie Linux live CD image or install media
.Sh SYNOPSIS
.Nm
.Op Fl a Ar ARCH
.Op Fl f
.Op Fl k Ar KIND
.Op Fl p Ar PHASE
.Op Fl s
.Op Fl v Ar VERSION
.Sh DESCRIPTION
.Nm
creates a live CD image or installer CD image for Adélie Linux using
.Xr apk 8
and
.Xr mkisofs 8 .
.Bl -tag -width "-v VERSION" -offset indent -compact
.It Fl a Ar ARCH
You may specify any architecture available in the Adélie repository for
.Ar ARCH ;
however, some architectures may require you to have additional utilities
present on your system to be made bootable. Specifically, x86 and x86_64
require
.Xr syslinux 1
to be installed. This defaults to the currently running system's architecture
as reported by
present on your system to be made bootable. This defaults to the currently
running system's architecture as reported by
.Xr uname 1 .
.It Fl f
Specifies that a full installation image should be created, including a
.Pa packages/
directory containing .apk files that can be used for an offline install. If
this flag is not specified, a live image will be created instead.
.It Fl k Ar KIND
Specifies the 'kind' of image creation to make. This defaults to the 'live'
kind. Kinds are similar to a Fedora 'spin'; see the
.Sy Kinds
section.
.It Fl p Ar PHASE
Specifies the phase of image creation to make as specified in the
.Sy Phases
......@@ -57,10 +53,7 @@ suite of utilities to be available.
.It Fl v Ar VERSION
Specifies the version of Adélie Linux to use for the created ISO.
.El
.Ss Phases
The
.Nm
utility defines the following phases for
......@@ -68,7 +61,6 @@ utility defines the following phases for
which can be run independently, or can be run in order by specifying the special
.Sy all
phase.
.Bl -tag -width "install" -offset indent -compact
.It clean
Erase all temporary files. Typically required for predictable build results.
......@@ -93,10 +85,17 @@ Run all of the above phases in the above order. This is the default if
.Fl p
is not specified.
.El
.Ss Kinds
Kinds are a specific set of packages and optional startup scripts that define
a specific 'kind' of CD image. Official Kinds include Horizon, KDE Live, and
MATE Live. You can specify your own by creating a
.Pa packages-$KIND
file containing the names of packages you wish (one per line). Additionally,
you may optionally create a
.Pa services-$KIND
file containing the names of services to start up in the default runlevel (one
per line).
.Sh ENVIRONMENT
.Bl -tag -width "EXTRA_MIRROR" -offset indent -compact
.It Ev Sy LDARCH
If the musl ld library file is different from the apk arch (such as ppc vs
......@@ -113,10 +112,7 @@ Use a custom URL for downloading. This does not change the URLs written to
For instance, a speedy way to generate a testing ISO on a builder would be to
specify MY_URL=/srv/packages.
.El
.Sh FILES
.Bl -ohang -width "iso-params-$ARCH" -offset indent -compact
.It Pa iso-params-$ARCH
A list of additional parameters to provide to
......@@ -139,40 +135,22 @@ If this file exists and is executable, it will be run just before
.Xr mkisofs 8
to do any final preparation to the disc root before creating the image.
.El
.Sh EXAMPLES
adelie-build-cd -a x86_64
.Pp
LDARCH=powerpc adelie-build-cd -a ppc
.Pp
EXTRA_MIRROR=i525 LDARCH=i386 SIGNING_KEY=/etc/portage/adelie.key ./build-cd -a x86
.Sh SEE ALSO
.Xr mksquashfs 1 ,
.Xr apk 8 ,
.Xr mkisofs 8 .
.Sh HISTORY
The
.Nm
command first appeared during the 1.0 ALPHA1 phase. It is written in portable
.St -p1003.2a-92
shell language. Any deviation from the standard should be considered a bug.
.Sh AUTHORS
.An A. Wilcox
.Aq awilfox@adelielinux.org
.Sh BUGS
There is no way to specify packages that should only be included on a full disc
or live disc. All disc types have the same packages installed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment