Compare commits
2 Commits
bash_OBSOL
...
python_rew
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d611da615 | ||
| a75cff05b7 |
@@ -1,7 +0,0 @@
|
||||
!!!!!!!!!!! NOTE !!!!!!!!!!!!!
|
||||
|
||||
THIS BRANCH IS *NO LONGER MAINTAINED*.
|
||||
IT HAS BEEN OBSOLETED BY THE (now merged into master) "python_rewrite" BRANCH.
|
||||
DO NOT SEND BUGS REGARDING THIS BRANCH.
|
||||
DO NOT USE THIS BRANCH.
|
||||
IT IS ONLY KEPT AROUND FOR HISTORICAL REASONS.
|
||||
1
TODO
Normal file
1
TODO
Normal file
@@ -0,0 +1 @@
|
||||
- maybe use ZConfig? https://pypi.python.org/pypi/ZConfig
|
||||
61
bdisk/base.py
Executable file
61
bdisk/base.py
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import re
|
||||
import hashlib
|
||||
import gnupg
|
||||
from urllib.request import urlopen
|
||||
|
||||
def download_tarball(arch, dlpath):
|
||||
# arch - should be i686 or x86_64
|
||||
# returns path/filename e.g. /some/path/to/file.tar.gz
|
||||
# we use .gnupg since we'll need it later.
|
||||
try:
|
||||
os.makedirs(dlpath + '/.gnupg')
|
||||
except OSError as exception:
|
||||
if exception.errno != errno.EEXIST:
|
||||
raise
|
||||
#mirror = 'http://mirrors.kernel.org/archlinux'
|
||||
mirror = 'https://mirror.us.leaseweb.net/archlinux'
|
||||
rlsdir = mirror + '/iso/latest'
|
||||
sha_in = urlopen(rlsdir + '/sha1sums.txt')
|
||||
sha1sums = sha_in.read()
|
||||
sha_in.close()
|
||||
sha1_list = sha1sums.decode("utf-8")
|
||||
sha_list = list(filter(None, sha1_list.split('\n')))
|
||||
sha_dict = {x.split()[1]: x.split()[0] for x in sha_list}
|
||||
pattern = re.compile('^archlinux-bootstrap-[0-9]{4}\.[0-9]{2}\.[0-9]{2}-' + arch + '\.tar\.gz$')
|
||||
tarball = [filename.group(0) for l in list(sha_dict.keys()) for filename in [pattern.search(l)] if filename][0]
|
||||
sha1 = sha_dict[tarball]
|
||||
# all that lousy work just to get a sha1 sum. okay. so.
|
||||
if os.path.isfile(dlpath + '/latest.' + arch + '.tar.gz'):
|
||||
pass
|
||||
else:
|
||||
# fetch the tarball...
|
||||
print("Fetching the tarball for {0} architecture, please wait...".format(arch))
|
||||
tarball_dl = urlopen(rlsdir + tarball)
|
||||
with open(dlpath + '/latest.' + arch + '.tar.gz', 'wb') as f:
|
||||
f.write(tarball_dl)
|
||||
tarball_dl.close()
|
||||
tarball_hash = hashlib.sha1(open(dlpath + '/latest.' + arch + '.tar.gz', 'rb').read()).hexdigest()
|
||||
if tarball_hash != sha1:
|
||||
exit("There was a failure fetching the tarball and the wrong version exists on the filesystem.\nPlease try again later.")
|
||||
else:
|
||||
# okay, so the sha1 matches. let's verify the signature.
|
||||
# we don't want to futz with the users normal gpg.
|
||||
gpg = gnupg.GPG(gnupghome=dlpath + '/.gnupg')
|
||||
input_data = gpg.gen_key_input(name_email='tempuser@nodomain.tld',passphrase='placeholder_passphrase')
|
||||
key = gpg.gen_key(input_data)
|
||||
keyid = '7F2D434B9741E8AC'
|
||||
gpg_sig = tarball + '.sig'
|
||||
sig_dl = urlopen(rlsdir + gpg_sig)
|
||||
with open(dlpath + '/latest.' + arch + '.tar.gz.sig', 'wb') as f:
|
||||
f.write(sig_dl)
|
||||
sig_dl.close()
|
||||
sig = dlpath + '/latest.' + arch + '.tar.gz.sig'
|
||||
gpg.verify_file(dlpath + '/latest.' + arch + '.tar.gz', sig_file = sig)
|
||||
|
||||
|
||||
return(sha1sum)
|
||||
|
||||
print(download_tarball('x86_64'))
|
||||
16
bdisk/host.py
Executable file
16
bdisk/host.py
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import platform
|
||||
|
||||
def getOS():
|
||||
# Returns one of: SuSE, debian, fedora, redhat, centos, mandrake,
|
||||
# mandriva, rocks, slackware, yellowdog, gentoo, UnitedLinux,
|
||||
# turbolinux, arch, mageia
|
||||
distro = list(platform.linux_distribution())[0].lower()
|
||||
return(distro)
|
||||
|
||||
def getBits():
|
||||
bits = list(platform.architecture())[0]
|
||||
return(bits)
|
||||
208
bin/build.sh
208
bin/build.sh
@@ -1,208 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# A lot of snippets, inspiration, and some config directives are from https://projects.archlinux.org/archiso.git/ / the ArchLinux ISO layout.
|
||||
# Many thanks and praise are deserved.
|
||||
|
||||
|
||||
#DEBUG
|
||||
#set -x
|
||||
|
||||
echo "Starting at $(date)..."
|
||||
|
||||
## Import settings
|
||||
if [ -f "build.conf" ];
|
||||
then
|
||||
echo "Now importing settings/variables."
|
||||
set -e
|
||||
source extra/build.conf.sample
|
||||
source build.conf
|
||||
set +e
|
||||
else
|
||||
echo "You have not configured a build.conf OR you are not running from the project's root directory (the git repository's working directory).
|
||||
If you are indeed in the correct directory, you may copy the sample at extra/build.conf.sample,
|
||||
edit it for appropriate values, and copy to <PROJECT ROOT>/build.conf"
|
||||
echo 'For now, though, I am using the defaults. If the build fails complaining about a'
|
||||
echo 'missing http user, you need to specify a custom/distro-pertinent one.'
|
||||
cp extra/build.conf.sample build.conf
|
||||
set -e
|
||||
source extra/build.conf.sample
|
||||
set +e
|
||||
fi
|
||||
|
||||
|
||||
## PREPARATION ##
|
||||
|
||||
# safemode browsing enabled. lolz
|
||||
set -e
|
||||
|
||||
# do some basic error checking
|
||||
ARCH=$(uname -m)
|
||||
|
||||
if [[ ${EUID} -ne 0 ]];
|
||||
then
|
||||
#echo "This script must be run as root" 1>&2
|
||||
echo "This script must be run as root."
|
||||
exit 1
|
||||
elif [ -f ${LOCKFILE} ];
|
||||
then
|
||||
echo "Script already running, stale lockfile present, or an error occurred during last run."
|
||||
echo "Please clear ${LOCKFILE} by hand before attempting another build."
|
||||
echo -n "Timestamp of lockfile is: "
|
||||
ls -l ${LOCKFILE} | awk '{print $6" "$7" "$8}'
|
||||
exit 1
|
||||
elif [[ "$(uname -s)" != "Linux" ]];
|
||||
then
|
||||
echo "ERROR: This script is only supported on GNU/Linux."
|
||||
exit 1
|
||||
elif [[ "${ARCH}" != 'x86_64' ]];
|
||||
then
|
||||
echo "Your hardware architecture, ${ARCH}, is not supported. Only x86_64 is supported."
|
||||
echo "Dying now."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking directory structure and creating lockfile at ${LOCKFILE}..."
|
||||
touch ${LOCKFILE}
|
||||
|
||||
# make sure the paths exist and then check for an existing chroot session
|
||||
for i in ${BASEDIR} ${CHROOTDIR32} ${CHROOTDIR64} ${BUILDDIR}32 ${BUILDDIR}64 ${ISODIR} ${MOUNTPT} ${TEMPDIR}/{${UXNAME},${DISTNAME}} ${ARCHBOOT} ${SRCDIR} ${TFTPDIR} ${HTTPDIR}/${DISTNAME} ${BASEDIR}/logs;
|
||||
do
|
||||
if [ ! -d ${i} ];
|
||||
then
|
||||
#echo "${i} does not exist - creating."
|
||||
mkdir -p ${i}
|
||||
fi
|
||||
done
|
||||
|
||||
source ${BASEDIR}/lib/00-depcheck.func.sh
|
||||
|
||||
if [ ! -f "./BUILDNO" ];
|
||||
then
|
||||
echo '0' > ./BUILDNO
|
||||
fi
|
||||
|
||||
CHROOTDIR_GLOB="${CHROOTDIR}"
|
||||
BUILDDIR_GLOB="${BUILDDIR}"
|
||||
|
||||
# Set the version.
|
||||
BUILDVERSION="$(git describe --abbrev=0 --tags)-$(git rev-parse --short --verify HEAD)"
|
||||
BUILD="$(cat BUILDNO)"
|
||||
BUILD="$(expr ${BUILD} + 1)"
|
||||
echo ${BUILD} > ./BUILDNO
|
||||
BUILDTIME="$(date)"
|
||||
BUILD_MACHINE="$(hostname -f) (${HOST_DIST})"
|
||||
#BUILD_USERNAME="${SUDO_USER}"
|
||||
#BUILD_USERNAME="$(who am i | awk '{print $1}')"
|
||||
set +e ; logname > /dev/null 2>&1
|
||||
if [[ "${?}" == "0" ]];
|
||||
then
|
||||
BUILD_USERNAME="$(logname)"
|
||||
else
|
||||
BUILD_USERNAME="$(whoami)"
|
||||
fi
|
||||
set -e
|
||||
USERNAME_REAL="$(grep ${BUILD_USERNAME} /etc/passwd | cut -f5 -d':')"
|
||||
|
||||
cat > ${BASEDIR}/VERSION_INFO.txt << EOF
|
||||
Version: ${BUILDVERSION}
|
||||
Build: ${BUILD}
|
||||
Time: ${BUILDTIME}
|
||||
Machine: ${BUILD_MACHINE}
|
||||
User: ${BUILD_USERNAME} (${USERNAME_REAL})
|
||||
EOF
|
||||
|
||||
## FUNCTIONS ##
|
||||
|
||||
#source ${BASEDIR}/lib/00-depcheck.func.sh ## this should be called like, VERYYYY first thing, right after sanity/safety checks and such.
|
||||
source ${BASEDIR}/lib/01-mk.chroot.func.sh ## this is called automatically and only if no chroot exists
|
||||
source ${BASEDIR}/lib/02-holla_atcha_boi.func.sh
|
||||
source ${BASEDIR}/lib/03-release_me.func.sh
|
||||
source ${BASEDIR}/lib/04-facehugger.func.sh
|
||||
source ${BASEDIR}/lib/05-chroot_wrapper.func.sh
|
||||
source ${BASEDIR}/lib/06-jenny_craig.func.sh
|
||||
source ${BASEDIR}/lib/07-centos_is_stupid.func.sh
|
||||
source ${BASEDIR}/lib/08-will_it_blend.func.sh
|
||||
source ${BASEDIR}/lib/09-stuffy.func.sh
|
||||
source ${BASEDIR}/lib/10-yo_dj.func.sh
|
||||
source ${BASEDIR}/lib/11-mentos.func.sh
|
||||
|
||||
## The Business-End(TM) ##
|
||||
|
||||
CHROOTDIR="${CHROOTDIR_GLOB}"
|
||||
BUILDDIR="${BUILDDIR_GLOB}"
|
||||
holla_atcha_boi
|
||||
|
||||
rm -rf ${TEMPDIR}/*
|
||||
release_me 64 > /dev/null 2>&1
|
||||
release_me 32 > /dev/null 2>&1
|
||||
|
||||
# do we need to perform any updates?
|
||||
if [[ ${1} == "update" ]];
|
||||
then
|
||||
mentos
|
||||
centos_is_stupid
|
||||
will_it_blend 32
|
||||
will_it_blend 64
|
||||
yo_dj
|
||||
fi
|
||||
|
||||
# or do we want to just chroot in?
|
||||
if [[ ${1} == "chroot" ]];
|
||||
then
|
||||
chroot_wrapper 64
|
||||
chroot_wrapper 32
|
||||
rm -f ${LOCKFILE}
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# implement for future, needs tweaking- JUST rebuild the ISO.
|
||||
#if [[ ${1} == "respin" ]];
|
||||
#then
|
||||
# if [[ "${MULTIARCH}" == "y" ]];
|
||||
# then
|
||||
# centos_is_stupid
|
||||
# yo_dj any
|
||||
# else
|
||||
# centos_is_stupid
|
||||
# yo_dj 64
|
||||
# centos_is_stupid
|
||||
# yo_dj 32
|
||||
# fi
|
||||
#fi
|
||||
#
|
||||
|
||||
# or are we just building?
|
||||
if [[ ${1} == "build" || -z ${1} || ${1} == "all" ]];
|
||||
then
|
||||
if [[ "${MULTIARCH}" == "y" ]];
|
||||
then
|
||||
centos_is_stupid
|
||||
will_it_blend 64
|
||||
will_it_blend 32
|
||||
yo_dj any
|
||||
else
|
||||
centos_is_stupid
|
||||
will_it_blend 64
|
||||
yo_dj 64
|
||||
centos_is_stupid
|
||||
will_it_blend 32
|
||||
yo_dj 32
|
||||
fi
|
||||
fi
|
||||
|
||||
# clean up, clean up, everybody, everywhere
|
||||
echo "Cleaning up some stuff leftover from the build..."
|
||||
#rm -rf ${TEMPDIR}/*
|
||||
#rm -rf ${SRCDIR}/*
|
||||
cd ${BASEDIR}
|
||||
|
||||
if [[ "${GIT}" == "yes" ]];
|
||||
then
|
||||
echo "Committing changes to git..."
|
||||
git add --all .
|
||||
git commit -m "post-build at $(date)"
|
||||
fi
|
||||
|
||||
# yay! we're done!
|
||||
rm -f ${LOCKFILE}
|
||||
echo "Finished successfully at $(date)!"
|
||||
88
bin/clean.sh
88
bin/clean.sh
@@ -1,88 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Started at $(date)..."
|
||||
|
||||
## Import settings
|
||||
if [ -f "build.conf" ];
|
||||
then
|
||||
echo "Now importing settings/variables."
|
||||
set -e
|
||||
source extra/build.conf.sample
|
||||
source build.conf
|
||||
set +e
|
||||
else
|
||||
echo "You have not configured a build.conf OR you are not running from the project's root directory (the git repository's working directory).
|
||||
echo "If you are indeed in the correct directory, you may copy the sample at ../extra/build.conf.sample,
|
||||
echo "edit it for appropriate values, and copy to <PROJECT ROOT>/build.conf"
|
||||
echo
|
||||
echo 'This error is fatal. Dying.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ${EUID} -ne 0 ]];
|
||||
then
|
||||
#echo "This script must be run as root" 1>&2
|
||||
echo "This script must be run as root."
|
||||
echo
|
||||
exit 1
|
||||
elif [ -f ${LOCKFILE} ];
|
||||
then
|
||||
echo "Script already running, stale lockfile present, or an error occurred during last run."
|
||||
echo "Please clear ${LOCKFILE} by hand before attempting another build."
|
||||
echo -n "Timestamp of lockfile is: "
|
||||
ls -l ${LOCKFILE} | awk '{print $6" "$7" "$8}'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Creating lockfile at ${LOCKFILE}..."
|
||||
touch ${LOCKFILE}
|
||||
|
||||
if [[ "${1}" == "all" ]];
|
||||
then
|
||||
DIRS="${CHROOTDIR}root.i686 ${CHROOTDIR}root.x86_64 ${BUILDDIR}32 ${BUILDDIR}64 ${ISODIR} ${TEMPDIR} ${ARCHBOOT} ${SRCDIR} ${TFTPDIR} ${HTTPDIR} ${BASEDIR}/logs"
|
||||
FILES="latest.32.tar.gz latest.64.tar.gz"
|
||||
elif [[ "${1}" == "chroot" ]];
|
||||
then
|
||||
DIRS="${CHROOTDIR}root.i686 ${CHROOTDIR}root.x86_64 ${BUILDDIR}32 ${BUILDDIR}64 ${ISODIR} ${TEMPDIR} ${ARCHBOOT} ${SRCDIR} ${TFTPDIR} ${HTTPDIR}"
|
||||
FILES=""
|
||||
elif [[ "${1}" == "squash" ]];
|
||||
then
|
||||
DIRS="${BUILDDIR}32 ${BUILDDIR}64 ${ISODIR} ${TEMPDIR} ${ARCHBOOT} ${SRCDIR} ${TFTPDIR} ${HTTPDIR}"
|
||||
FILES=""
|
||||
else
|
||||
DIRS="${ISODIR} ${TEMPDIR} ${ARCHBOOT} ${SRCDIR} ${TFTPDIR} ${HTTPDIR}"
|
||||
FILES=""
|
||||
fi
|
||||
|
||||
echo "I will be deleting the contents of: ${DIRS}"
|
||||
echo "I will be deleting the files: ${FILES}"
|
||||
read -p 'Do you wish to continue? [Y/n] ' CONFIRM
|
||||
|
||||
if [ -z "${CONFIRM}" ];
|
||||
then
|
||||
CONFIRM="y"
|
||||
fi
|
||||
|
||||
CONFIRM=${CONFIRM:0:1}
|
||||
CONFIRM=$(echo ${CONFIRM} | tr [[:upper:]] [[:lower:]])
|
||||
|
||||
if [[ "${CONFIRM}" != "y" ]];
|
||||
then
|
||||
echo 'Exiting.'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
for i in "${DIRS}";
|
||||
do
|
||||
rm -rf ${i}/*
|
||||
done
|
||||
|
||||
for i in "${FILES}";
|
||||
do
|
||||
rm -f ${i}
|
||||
done
|
||||
|
||||
rm -f ${LOCKFILE}
|
||||
|
||||
echo "Finished successfully at $(date)!"
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
curl -s -o /tmp/mirrorlist.tmp "https://www.archlinux.org/mirrorlist/?country=US&protocol=http&protocol=https&ip_version=4&use_mirror_status=on"
|
||||
sed -i -e 's/^#Server/Server/' /tmp/mirrorlist.tmp
|
||||
rankmirrors -n 6 /tmp/mirrorlist.tmp > extra/mirrorlist
|
||||
sed -i -e '/^##/d' extra/mirrorlist
|
||||
0
default.cfg
Normal file
0
default.cfg
Normal file
54
docs/README
54
docs/README
@@ -16,9 +16,6 @@ It should be fine over ethernet, since hardware switches are much faster and eff
|
||||
Future versions, once this project has a dumping ground, will fetch highly compressed snapshotted chroot filesystems instead
|
||||
of dynamically building the entire install chroots (both x86_64 and i686) instead (with the option of building fresh locally,
|
||||
disabled by default).
|
||||
|
||||
Maybe.
|
||||
|
||||
Till then, sorry for the inconvenience.
|
||||
!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
@@ -59,6 +56,11 @@ All commands below should be issued in the root working directory of this git re
|
||||
but also disk space for working, the finished ISO(s), etc.)
|
||||
|
||||
-The following packages installed on the build host:
|
||||
(NOTE: future versions will have dependencies checked automatically and installed if necessary,
|
||||
depending on distro your host build machine is. the OS detection and package installation component of that isn't
|
||||
done yet though. 2014.10.31)
|
||||
(NOTE2: Make sure all the packages you specify are valid package names. A mistyped package name will cause the chroot creation to
|
||||
break and everything else will break as a result.)
|
||||
|
||||
curl
|
||||
dosfstools
|
||||
@@ -70,24 +72,9 @@ squashfs-tools
|
||||
xorriso (in RPMForge repo for CentOS 7)
|
||||
xz
|
||||
|
||||
and maybe a few others. The scripts run with set -e for the most part, so if something's missed, you'll know.
|
||||
and *probably* a few others. The scripts run with set -e for the most part, so if something's missed, you'll know.
|
||||
Oh, you will know.
|
||||
|
||||
If these packages are missing, they will be automatically installed. Currently, the following distros as host build systems
|
||||
are supported (assumes most recent release):
|
||||
|
||||
Antergos
|
||||
Arch
|
||||
CentOS
|
||||
Debian
|
||||
Fedora
|
||||
Gentoo
|
||||
Mageia
|
||||
Manjaro
|
||||
openSUSE
|
||||
RHEL
|
||||
SUSE
|
||||
Ubuntu
|
||||
|
||||
## Configuration ##
|
||||
See extra/build.conf.sample. Copy to <PROJECT ROOT>/build.conf if you wish to modify any of the values, otherwise the defaults
|
||||
@@ -118,18 +105,6 @@ Also note the following files/paths:
|
||||
--/mirror.lst.sh:
|
||||
Builds a fresh mirror list. Note that it is US based.
|
||||
|
||||
-docs:
|
||||
Documentation for BDisk.
|
||||
--/COPYING:
|
||||
See LICENSE.
|
||||
--/README:
|
||||
This file.
|
||||
--/LICENSE:
|
||||
The license file.
|
||||
--/FAQ:
|
||||
Several quick questions you might have.
|
||||
--/TODO:
|
||||
Some features, bug fixes, etc. I have planned.
|
||||
-examples:
|
||||
Included recommendation for how to lay things out, etc.
|
||||
--/HTTP:
|
||||
@@ -137,7 +112,7 @@ Also note the following files/paths:
|
||||
-extra:
|
||||
Supporting files for the base building system (mirrorlist, etc.).
|
||||
--/${UXNAME}.png:
|
||||
L A 640x480 8-bit RGBA colour PNG which will be used as the background for the bootsplash (if booting via BIOS and not UEFI)
|
||||
A 640x480 8-bit RGBA colour PNG which will be used as the background for the bootsplash (if booting via BIOS and not UEFI)
|
||||
--/bootstrap/apacman-*.tar.xz:
|
||||
An AUR-enabled package manager. Necessary for AUR support.
|
||||
--/build.conf.sample:
|
||||
@@ -155,8 +130,6 @@ L A 640x480 8-bit RGBA colour PNG which will be used as the background for the b
|
||||
--/pre-build.d:
|
||||
Contains files injected into the system. Both 64-bit and 32-bit environments. Note: be sure to place them in hierarchical order
|
||||
(e.g. if you wish to have a file at /usr/foo/bar, you will need to place it in <PROJECT ROOT>/extra/pre-build.d/usr/foo/bar)
|
||||
(NOTE: Make sure all the packages you specify are valid package names. A mistyped or nonexistent package name will cause the chroot
|
||||
creation to break and everything else will break as a result.)
|
||||
--/pre-build.d/32:
|
||||
Same as above, but only for 32-bit environments.
|
||||
--/pre-build.d/64:
|
||||
@@ -170,6 +143,8 @@ L A 640x480 8-bit RGBA colour PNG which will be used as the background for the b
|
||||
Here you can find full output of the runs. They are prefixed with run's PID number, and named after the function they occur in.
|
||||
-overlay:
|
||||
These files are applied AFTER the initial setup of the chroots. Same hierarchy rules as extra/pre-build.d.
|
||||
-README:
|
||||
This file.
|
||||
-src:
|
||||
Supporting source code/source code from other projects.
|
||||
--ipxe/:
|
||||
@@ -178,12 +153,14 @@ L A 640x480 8-bit RGBA colour PNG which will be used as the background for the b
|
||||
Various patches and supporting configs to tweak the iPXE build.
|
||||
-tftpboot:
|
||||
Files to be served via TFTP for PXE booting. This directory is wiped out during any bin/clean.sh operation.
|
||||
-TODO:
|
||||
This is just what I'm using to track stuff I want to add.
|
||||
|
||||
|
||||
You may notice other files come and go; they're mostly there for extra goodies/used to determine other things.
|
||||
|
||||
## (Re)Building ##
|
||||
Building must be done as root, and on a supported distro (see Prerequisites for a list).
|
||||
Building must be done as root, and on an Arch x86_64 system (future versions will allow for non-Arch distros).
|
||||
|
||||
# bin/build.sh
|
||||
|
||||
@@ -191,10 +168,3 @@ Yeah. It's that easy. The finished product is in iso/.
|
||||
|
||||
|
||||
If you want more verbosity, check out the logs/ directory.
|
||||
|
||||
|
||||
## Submitting Patches ##
|
||||
If you have a fix or feature you'd like added, please follow the same pull request process for the kernel
|
||||
(https://www.kernel.org/doc/Documentation/SubmittingPatches) and email to bts@square-r00t.net
|
||||
|
||||
Alternatively, file a bug at https://bugs.square-r00t.net/index.php?project=2 with a patch attached.
|
||||
|
||||
BIN
extra/bootstrap/apacman-1.9-1-any.pkg.tar.xz
Normal file
BIN
extra/bootstrap/apacman-1.9-1-any.pkg.tar.xz
Normal file
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
# Server list generated by rankmirrors on 2016-07-09
|
||||
Server = http://mirror.us.leaseweb.net/archlinux/$repo/os/$arch
|
||||
# Server list generated by rankmirrors on 2015-02-26
|
||||
Server = http://mirrors.advancedhosters.com/archlinux/$repo/os/$arch
|
||||
Server = http://ftp.osuosl.org/pub/archlinux/$repo/os/$arch
|
||||
Server = http://mirrors.rutgers.edu/archlinux/$repo/os/$arch
|
||||
Server = http://mirror.umd.edu/archlinux/$repo/os/$arch
|
||||
Server = http://mirror.vtti.vt.edu/archlinux/$repo/os/$arch
|
||||
Server = http://mirror.jmu.edu/pub/archlinux/$repo/os/$arch
|
||||
Server = http://arch.mirrors.ionfish.org/$repo/os/$arch
|
||||
Server = http://mirror.es.its.nyu.edu/archlinux/$repo/os/$arch
|
||||
Server = http://mirrors.rutgers.edu/archlinux/$repo/os/$arch
|
||||
|
||||
@@ -43,7 +43,7 @@ cpio
|
||||
cpuburn
|
||||
cpupower
|
||||
crackpkcs12
|
||||
cryptcat
|
||||
#cryptcat
|
||||
cryptsetup
|
||||
csync2
|
||||
customizepkg-scripting
|
||||
@@ -54,7 +54,7 @@ dd_rescue
|
||||
dd_rhelp
|
||||
debianutils
|
||||
debootstrap
|
||||
#dialog #giving a weird dependency issue
|
||||
dialog
|
||||
diffutils
|
||||
djohn
|
||||
dmidecode
|
||||
@@ -107,7 +107,6 @@ gptfdisk
|
||||
gst-libav
|
||||
gst-plugins-ugly
|
||||
hashcat
|
||||
hashdeep
|
||||
hddtemp
|
||||
hdparm
|
||||
hexcurse
|
||||
@@ -141,38 +140,23 @@ keyutils
|
||||
kismet-allplugins
|
||||
lftp
|
||||
links
|
||||
#logkeys-git # requires a /dev/input, which apparently isn't included in the chroots
|
||||
#logkeys
|
||||
logkeys-keymaps
|
||||
lm_sensors
|
||||
lrzsz
|
||||
lshw
|
||||
#lsiutil # giving intermittent errors when trying to fetch source
|
||||
lsiutil
|
||||
lsof
|
||||
lsscsi
|
||||
#lxde # apacman currently doesn't like package groups, so...
|
||||
gpicview
|
||||
lxappearance
|
||||
lxappearance-obconf
|
||||
lxde-common
|
||||
lxde-icon-theme
|
||||
lxdm
|
||||
lxinput
|
||||
lxlauncher
|
||||
lxmusic
|
||||
lxpanel
|
||||
lxrandr
|
||||
lxsession
|
||||
lxtask
|
||||
lxterminal
|
||||
openbox
|
||||
pcmanfm
|
||||
# end lxde
|
||||
lxde
|
||||
lynx
|
||||
#lzip
|
||||
macchanger
|
||||
#magicrescue # no longer maintained, upstream down
|
||||
magicrescue
|
||||
mbr
|
||||
mbuffer
|
||||
mcelog
|
||||
md5deep
|
||||
mdadm
|
||||
mdcrack
|
||||
# superseded by storcli
|
||||
@@ -180,10 +164,11 @@ mdcrack
|
||||
memtester
|
||||
mfoc
|
||||
minicom
|
||||
#mondo # mindi-busybox fails to build 09.23.2016
|
||||
mondo
|
||||
mtd-utils
|
||||
mtr
|
||||
mtree
|
||||
#mtx
|
||||
multipath-tools
|
||||
myrescue
|
||||
nbd
|
||||
@@ -223,19 +208,20 @@ php
|
||||
php-fpm
|
||||
php-gd
|
||||
php-mcrypt
|
||||
phrasendrescher
|
||||
#phrasendrescher
|
||||
pigz
|
||||
pkgfile
|
||||
pkgtools
|
||||
ppp
|
||||
pptpclient
|
||||
prebootloader
|
||||
procinfo-ng
|
||||
procps-ng
|
||||
progsreiserfs
|
||||
psmisc
|
||||
pwgen
|
||||
pixz
|
||||
pyrit
|
||||
pyrit-svn
|
||||
python2-gnuplot
|
||||
python2-pyx
|
||||
rarcrack
|
||||
@@ -253,7 +239,6 @@ rsnapshot
|
||||
rygel
|
||||
safecopy
|
||||
samba
|
||||
scalpel-git
|
||||
scapy
|
||||
screen
|
||||
scrounge-ntfs
|
||||
@@ -269,7 +254,7 @@ smartmontools
|
||||
smbclient
|
||||
s-nail
|
||||
socat
|
||||
#star ## do people even USE tape backups anymore?
|
||||
#star ## do people even USE tape packups anymore?
|
||||
storcli
|
||||
strace
|
||||
stress
|
||||
@@ -286,7 +271,7 @@ thttpd
|
||||
tmon
|
||||
tmux
|
||||
tre
|
||||
truecrack-git
|
||||
truecrack-svn
|
||||
truecrypt
|
||||
tor
|
||||
udftools
|
||||
@@ -311,7 +296,7 @@ vncrack
|
||||
vnstat
|
||||
vpnc
|
||||
weplab
|
||||
#whdd #currently depends on dialog, which is broke as shit
|
||||
whdd
|
||||
whois
|
||||
wifite-mod-pixiewps-git
|
||||
wipe
|
||||
|
||||
@@ -11,26 +11,27 @@
|
||||
#buildonly=1
|
||||
#cachevcs=1
|
||||
#ignorearch=1
|
||||
#keepkeys=1
|
||||
needed=1
|
||||
#noaur=1
|
||||
#needed=1
|
||||
noconfirm=1
|
||||
noedit=1
|
||||
nofail=1
|
||||
#noaur=1
|
||||
#noconfirm=1
|
||||
#noedit=1
|
||||
#nofail=1
|
||||
#preview=1
|
||||
progress=1
|
||||
purgebuild=1
|
||||
#purgebuild=1
|
||||
#quiet=1
|
||||
skipcache=1
|
||||
#skipinteg=1
|
||||
#skipcache=1
|
||||
skipinteg=1
|
||||
#skiptest=1
|
||||
#warn=1
|
||||
#tmpdir=/var/tmp/apacman
|
||||
#TMPDIR=/var/tmp/apacman
|
||||
|
||||
#
|
||||
# CONFIGURATION
|
||||
#
|
||||
|
||||
#builddir="/tmp/pkgbuild-$UID"
|
||||
#tmpdir="/tmp/apacmantmp-$UID"
|
||||
#makepkgconf="/etc/makepkg.conf"
|
||||
#usermakepkgconf="$HOME/.makepkg.conf"
|
||||
@@ -38,21 +39,19 @@ skipcache=1
|
||||
#downdir="/var/cache/pacman/pkg"
|
||||
#savedir="/var/cache/apacman/pkg"
|
||||
#editor="nano -w"
|
||||
#pager="less -R"
|
||||
editor="vim"
|
||||
#RPCURL="https://aur.archlinux.org/rpc.php?type"
|
||||
#PKGURL="https://aur.archlinux.org"
|
||||
#WEBURL="https://www.archlinux.org"
|
||||
#ABSURL="rsync.archlinux.org"
|
||||
|
||||
#
|
||||
# COLORIZATION
|
||||
#
|
||||
|
||||
#COLOR1='\e[1;39m'
|
||||
#COLOR2='\e[1;32m'
|
||||
#COLOR3='\e[1;35m'
|
||||
#COLOR4='\e[1;36m'
|
||||
#COLOR5='\e[1;34m'
|
||||
#COLOR6='\e[1;33m'
|
||||
#COLOR7='\e[1;31m'
|
||||
|
||||
COLOR1='\e[1;39m'
|
||||
COLOR2='\e[1;32m'
|
||||
COLOR3='\e[1;35m'
|
||||
COLOR4='\e[1;36m'
|
||||
COLOR5='\e[1;34m'
|
||||
COLOR6='\e[1;33m'
|
||||
COLOR7='\e[1;31m'
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# original URL at sourceforge chokes out
|
||||
sed -re 's@^(source=\(").*$@\1ftp://ftp.gnome.org/mirror/temp/sf2015/a/au/autopsy/autopsy/2.24/autopsy-2.24.tar.gz")@g' ${1}
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
sed -i -re 's/^(url=)\((.*)\)$/\1\2/g' ${1}
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
sed -i -re 's/^(url=)\((.*)\)$/\1\2/g' ${1}
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
sed -i -re 's/^(url=)\((.*)\)$/\1\2/g' ${1}
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# original URL at sourceforge chokes out
|
||||
sed -re 's@^(source=\(").*$@\1http://fossies.org/linux/privat/${pkgname}-${pkgver}.tar.gz")@g' ${1}
|
||||
@@ -64,4 +64,4 @@ COMPRESSION="xz"
|
||||
|
||||
# COMPRESSION_OPTIONS
|
||||
# Additional options for the compressor
|
||||
COMPRESSION_OPTIONS="-9"
|
||||
#COMPRESSION_OPTIONS=""
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
Server = http://mirrors.advancedhosters.com/archlinux/$repo/os/$arch
|
||||
Server = http://mirrors.gigenet.com/archlinux/$repo/os/$arch
|
||||
Server = http://il.mirrors.linaxe.net/archlinux/$repo/os/$arch
|
||||
Server = http://mirror.grig.io/archlinux/$repo/os/$arch
|
||||
Server = http://arch.mirrors.ionfish.org/$repo/os/$arch
|
||||
Server = http://cosmos.cites.illinois.edu/pub/archlinux/$repo/os/$arch
|
||||
# Server list generated by rankmirrors on 2014-11-10
|
||||
Server = http://mirror.rit.edu/archlinux/$repo/os/$arch
|
||||
Server = http://mirror.cc.columbia.edu/pub/linux/archlinux/$repo/os/$arch
|
||||
Server = http://mirrors.acm.wpi.edu/archlinux/$repo/os/$arch
|
||||
Server = http://mirror.jmu.edu/pub/archlinux/$repo/os/$arch
|
||||
Server = http://mirror.cs.pitt.edu/archlinux/$repo/os/$arch
|
||||
Server = http://mirror.vtti.vt.edu/archlinux/$repo/os/$arch
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function so_check_me_out {
|
||||
|
||||
FUNCNAME="depcheck"
|
||||
|
||||
if [[ -n ${HOST_DIST} ]];
|
||||
then
|
||||
if [[ ! -f ${BASEDIR}/lib/prereqs/${HOST_DIST}/meta || ! -f ${BASEDIR}/lib/prereqs/${HOST_DIST}/pkgs ]];
|
||||
then
|
||||
echo "ERROR: You have specified ${HOST_DIST} as your host system's distro, but it is missing a meta and/or pkgs profile."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
set +e
|
||||
if [[ -z "${HOST_DIST}" ]];
|
||||
then
|
||||
for dist_profile in $(find "${BASEDIR}"/lib/prereqs -type f -name 'meta');
|
||||
do
|
||||
source ${dist_profile}
|
||||
if [[ "${SUPPORTED}" != "yes" ]];
|
||||
then
|
||||
continue
|
||||
fi
|
||||
eval "${CHECK_METHOD}" > /dev/null 2>&1
|
||||
if [[ "${?}" == "0" ]];
|
||||
then
|
||||
export HOST_DIST="${NAME}"
|
||||
echo "Detected distro as ${HOST_DIST}."
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
fi
|
||||
set -e
|
||||
|
||||
# Sanity is important.
|
||||
if [[ -z "${HOST_DIST}" ]];
|
||||
then
|
||||
echo "ERROR: Your distro was not found/detected, or is flagged as unsupported."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# So we've validated the distro. Here, check for packages and install if necessary. maybe use an array, but it'd be better to soft-fail if one of the packages is missing.
|
||||
|
||||
DISTRO_DIR="${BASEDIR}/lib/prereqs/${HOST_DIST}"
|
||||
META="${DISTRO_DIR}/meta"
|
||||
PKGLIST="${DISTRO_DIR}/pkgs"
|
||||
|
||||
# And once more, just to be safe.
|
||||
source ${META}
|
||||
|
||||
## TWEAKS GET RUN HERE.
|
||||
distro_specific_tweaks
|
||||
|
||||
if [[ "${PRE_RUN}" != 'none' ]];
|
||||
then
|
||||
echo "Now updating your local package cache..."
|
||||
set +e
|
||||
eval "${PRE_RUN}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
if [[ "${?}" != "0" ]];
|
||||
then
|
||||
echo "ERROR: Syncing your local package cache via ${PRE_RUN} command failed."
|
||||
echo "Please ensure you are connected to the Internet/have repositories configured correctly."
|
||||
exit 1
|
||||
fi
|
||||
set -e
|
||||
fi
|
||||
|
||||
set +e
|
||||
while read pkgname;
|
||||
do
|
||||
eval "${PKG_CHK}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
if [[ "${?}" != "0" ]];
|
||||
then
|
||||
echo "Installing ${pkgname}..."
|
||||
eval "${PKG_MGR}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
if [[ "${?}" != "0" ]];
|
||||
then
|
||||
echo "ERROR: ${pkgname} was not found to be installed and we can't install it."
|
||||
echo "This usually means you aren't connected to the Internet or your package repositories"
|
||||
echo "are not configured correctly. Review the list of packages in ${PKGLIST} and ensure"
|
||||
echo "they are all available to be installed."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done < ${PKGLIST}
|
||||
set -e
|
||||
|
||||
rm -f "${LOCKFILE}"
|
||||
}
|
||||
|
||||
so_check_me_out
|
||||
@@ -1,380 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function mkchroot {
|
||||
|
||||
# just in case we don't inherit.
|
||||
if [[ -z "${FUNCNAME}" ]];
|
||||
then
|
||||
FUNCNAME='mkchroot-standalone'
|
||||
fi
|
||||
|
||||
## Import settings
|
||||
if [ -f "build.conf" ];
|
||||
then
|
||||
echo "Now importing settings/variables."
|
||||
set -e
|
||||
source build.conf
|
||||
set +e
|
||||
else
|
||||
echo "You have not configured a build.conf OR you are not running from the project's root directory (the git repository's working directory)."
|
||||
echo "If you are indeed in the correct directory, you may copy the sample at ../extra/build.conf.sample,"
|
||||
echo "edit it for appropriate values, and copy to <PROJECT ROOT>/build.conf"
|
||||
echo 'This error is fatal. Dying.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ${EUID} -ne 0 ]];
|
||||
then
|
||||
#echo "This script must be run as root" 1>&2
|
||||
echo "This script must be run as root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${BASEDIR}" ];
|
||||
then
|
||||
echo 'You need to export the directory ("$BASEDIR") which will hold the chroots and the git project directory.'
|
||||
echo "(don't worry, there's a .gitignore for the chroots)"
|
||||
echo "e.g. export BASEDIR=\"/opt/dev/work/client-diag-disc/\""
|
||||
echo 'Dying.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "${BASEDIR}" ];
|
||||
then
|
||||
echo "You need to make sure ${BASEDIR} is a valid, existing directory. This script does not automatically create it as a sanity measure."
|
||||
echo 'Dying.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${EUID}" != "0" ]];
|
||||
then
|
||||
echo "This script must be run as root."
|
||||
echo 'Dying.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f ${LOCKFILE} ];
|
||||
then
|
||||
echo "Script already running, stale lockfile present, or an error occurred during last run."
|
||||
echo "Please clear ${LOCKFILE} by hand before attempting another build."
|
||||
echo -n "Timestamp of lockfile is: "
|
||||
ls -l ${LOCKFILE} | awk '{print $6" "$7" "$8}'
|
||||
exit 1
|
||||
else
|
||||
touch ${LOCKFILE}
|
||||
fi
|
||||
|
||||
if [ -f "/usr/bin/systemd-nspawn" ];
|
||||
then
|
||||
CHROOTCMD="systemd-nspawn -D"
|
||||
else
|
||||
CHROOTCMD="${CHROOTDIR64}/bin/arch-chroot"
|
||||
fi
|
||||
|
||||
cd "${BASEDIR}"
|
||||
|
||||
## Set some vars.
|
||||
#MIRROR='http://mirrors.kernel.org/archlinux'
|
||||
MIRROR='http://mirror.us.leaseweb.net/archlinux'
|
||||
RLSDIR="${MIRROR}/iso/latest"
|
||||
|
||||
CURRLS64=$(curl -s ${RLSDIR}/sha1sums.txt | grep bootstrap | awk '{print $2}' | grep 'x86_64')
|
||||
CKSUM64=$(curl -s ${RLSDIR}/sha1sums.txt | grep bootstrap | grep x86_64 | awk '{print $1}')
|
||||
CURRLS32=$(curl -s ${RLSDIR}/sha1sums.txt | grep bootstrap | awk '{print $2}' | grep 'i686')
|
||||
CKSUM32=$(curl -s ${RLSDIR}/sha1sums.txt | grep bootstrap | grep i686 | awk '{print $1}')
|
||||
|
||||
## Fetch latest tarball release
|
||||
echo "Checking/fetching snapshots..."
|
||||
if [ -f "latest.64.tar.gz" ];
|
||||
then
|
||||
LOCSUM64=$(sha1sum latest.64.tar.gz | awk '{print $1}')
|
||||
if [[ "${CKSUM64}" != "${LOCSUM64}" ]];
|
||||
then
|
||||
echo "WARNING: CHECKSUMS DON'T MATCH."
|
||||
echo "Local: ${LOCSUM64}"
|
||||
echo "Remote: ${CKSUM64}"
|
||||
echo "Fetching fresh copy."
|
||||
curl -o latest.64.tar.gz "${RLSDIR}/${CURRLS64}"
|
||||
fi
|
||||
else
|
||||
curl -o latest.64.tar.gz "${RLSDIR}/${CURRLS64}"
|
||||
fi
|
||||
|
||||
if [ -f "latest.32.tar.gz" ];
|
||||
then
|
||||
LOCSUM32=$(sha1sum latest.32.tar.gz | awk '{print $1}')
|
||||
if [[ "${CKSUM32}" != "${LOCSUM32}" ]];
|
||||
then
|
||||
echo "WARNING: CHECKSUMS DON'T MATCH."
|
||||
echo "Local: ${LOCSUM32}"
|
||||
echo "Remote: ${CKSUM32}"
|
||||
echo "Fetching fresh copy."
|
||||
curl -o latest.32.tar.gz "${RLSDIR}/${CURRLS32}"
|
||||
fi
|
||||
else
|
||||
curl -o latest.32.tar.gz "${RLSDIR}/${CURRLS32}"
|
||||
fi
|
||||
|
||||
if [ ! -f "${CHROOTDIR32}/etc/pacman.d/gnupg/trustdb.gpg" ] || [ ! -f "${CHROOTDIR64}/etc/pacman.d/gnupg/trustdb.gpg" ];
|
||||
then
|
||||
# Now let's ${BASEDIR}/extract that shit
|
||||
echo "Extracting snapshots. This will take a while..."
|
||||
## 64-bit
|
||||
tar -xpzf latest.64.tar.gz
|
||||
## 32-bit
|
||||
tar -xpzf latest.32.tar.gz
|
||||
|
||||
# And configure the package manager
|
||||
echo "Configuring snapshots..."
|
||||
touch ${LOCKFILE}
|
||||
sleep 2
|
||||
find ${BASEDIR}/extra/pre-build.d/ -exec touch '{}' \;
|
||||
rsync -a --exclude '/32' --exclude '/64' ${BASEDIR}/extra/pre-build.d/. ${BASEDIR}/root.x86_64/.
|
||||
rsync -a --exclude '/32' --exclude '/64' ${BASEDIR}/extra/pre-build.d/. ${BASEDIR}/root.i686/.
|
||||
rsync -a ${BASEDIR}/extra/pre-build.d/64/. ${BASEDIR}/root.x86_64/.
|
||||
rsync -a ${BASEDIR}/extra/pre-build.d/32/. ${BASEDIR}/root.i686/.
|
||||
chmod -f 755 ${BASEDIR}/extra/pre-build.d/{32/,64/,}etc/customizepkg.d/*
|
||||
find ${BASEDIR}/root.x86_64/ -newer ${LOCKFILE} -exec chown -R root:root '{}' \;
|
||||
find ${BASEDIR}/root.i686/ -newer ${LOCKFILE} -exec chown -R root:root '{}' \;
|
||||
for i in i686 x86_64;
|
||||
do
|
||||
cat > ${BASEDIR}/root.${i}/etc/os-release << EOF
|
||||
NAME="Arch Linux"
|
||||
ID=arch
|
||||
PRETTY_NAME="Arch Linux"
|
||||
ANSI_COLOR="0;36"
|
||||
HOME_URL="https://www.archlinux.org/"
|
||||
SUPPORT_URL="https://bbs.archlinux.org/"
|
||||
BUG_REPORT_URL="https://bugs.archlinux.org/"
|
||||
EOF
|
||||
cp ${BASEDIR}/VERSION_INFO.txt ${BASEDIR}/root.${i}/.
|
||||
done
|
||||
|
||||
# And make it usable.
|
||||
echo "Initializing chroots..."
|
||||
|
||||
for i in ${CHROOTDIR32} ${CHROOTDIR64};
|
||||
do
|
||||
# Disable NetworkManager. Fuck that shit.
|
||||
ln -s /dev/null ${i}/etc/systemd/system/NetworkManager.service
|
||||
ln -s /dev/null ${i}/etc/systemd/system/NetworkManager-dispatcher.service
|
||||
# Remove the machine-id file so it's automatically generated.
|
||||
# NOTE: this kind of fucks things up presently.
|
||||
#rm -f ${i}/etc/machine-id
|
||||
# Prep pacman
|
||||
echo "Prepping ${i}. This will take a while..."
|
||||
echo -n "...Key initializing..."
|
||||
${CHROOTCMD} ${i}/ pacman-key --init >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
echo "Done."
|
||||
echo -n "...Importing keys..."
|
||||
${CHROOTCMD} ${i}/ pacman-key --populate archlinux >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
${CHROOTCMD} ${i}/ pacman-key -r 93481F6B >> "${LOGFILE}.${FUNCNAME}" 2>&1 # add developer's keys
|
||||
echo "Done."
|
||||
# Prep base building system
|
||||
echo -n "...Installing base packages..."
|
||||
#${CHROOTCMD} ${i}/ pacstrap -dGcM base
|
||||
# if that doesn't work,
|
||||
${CHROOTCMD} ${i}/ pacman -Syy >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%%.pacorig} ; done
|
||||
${CHROOTCMD} ${i}/ pacman -S --noconfirm --needed base syslinux wget rsync unzip jshon sed sudo abs xmlto bc docbook-xsl git >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%%.pacorig} ; done
|
||||
echo "Done."
|
||||
echo -n "...Upgrading any outdated packages..."
|
||||
${CHROOTCMD} ${i}/ pacman -Syyu --force --noconfirm >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
${CHROOTCMD} ${i}/ pacman-key --refresh-keys >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%%.pacorig} ; done
|
||||
echo "Done. Finishing/cleaning up..."
|
||||
${CHROOTCMD} ${i}/ pacman -S --noconfirm --needed base-devel >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%%.pacorig} ; done
|
||||
# Yaourt is busted because Arch Pacman devs are fucking neasighted closed-minded jackasses.
|
||||
# If they ever fix their crap, checkout extra/pre-build.d/etc/yaourtrc from git (commit 583a5df84af415990b8c49d7e4ac11dd7b23e0e0)
|
||||
## https://github.com/archlinuxfr/yaourt/issues/67
|
||||
## https://projects.archlinux.org/pacman.git/tree/NEWS#n54
|
||||
## https://bugs.archlinux.org/task/43302
|
||||
#${CHROOTCMD} ${i}/ pacman -S --noconfirm --needed yaourt >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
mkdir -p ${i}/var/tmp/pkg
|
||||
cp ${BASEDIR}/extra/bootstrap/apacman* ${i}/var/tmp/pkg/apacman.tar.xz
|
||||
#${CHROOTCMD} ${i} "pacman --noconfirm -U /var/tmp/pkg/apacman.tar.xz" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
${CHROOTCMD} ${i} bash -c "pacman --noconfirm -U /var/tmp/pkg/apacman.tar.xz && mkdir /var/tmp/apacman && chmod 0750 /var/tmp/apacman && chown root:aurbuild /var/tmp/apacman " >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%%.pacorig} ; done
|
||||
${CHROOTCMD} ${i} bash -c "apacman -S --noconfirm --noedit --skipinteg -S apacman apacman-deps expac" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
${CHROOTCMD} ${i} bash -c "apacman --gendb" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
#rm -rf ${i}/var/tmp/pkg
|
||||
#${CHROOTCMD} ${i}/ pacman -S --noconfirm --needed yaourt >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%%.pacorig} ; done
|
||||
done
|
||||
${CHROOTCMD} ${CHROOTDIR64}/ 'pacman --noconfirm -R gcc-libs libtool' >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
${CHROOTCMD} ${CHROOTDIR64}/ 'pacman --noconfirm -S multilib-devel' >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
fi
|
||||
|
||||
# And let's do some more optimization.
|
||||
if [[ "${I_AM_A_RACECAR}" == "y" ]];
|
||||
then
|
||||
CPUCNT=$(grep processor /proc/cpuinfo | wc -l)
|
||||
((CPUCNT++))
|
||||
sed -i -e "/^[[:space:]]*#*MAKEFLAGS=.*$/aMAKEFLAGS=\"-j${CPUCNT}\"" ${CHROOTDIR64}/etc/makepkg.conf
|
||||
sed -i -e "/^[[:space:]]*#*MAKEFLAGS=.*$/aMAKEFLAGS=\"-j${CPUCNT}\"" ${CHROOTDIR32}/etc/makepkg.conf
|
||||
fi
|
||||
|
||||
# Baseline packages
|
||||
echo "Installing baseline packages..."
|
||||
PKGLIST=$(sed -e '/^[[:space:]]*#/d ; /^[[:space:]]*$/d' ${BASEDIR}/lib/prereqs/iso.pkgs.lst | tr '\n' ' ')
|
||||
for i in ${CHROOTDIR32} ${CHROOTDIR64};
|
||||
do
|
||||
set +e
|
||||
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%%.pacorig} ; done
|
||||
set -e
|
||||
${CHROOTCMD} ${i}/ bash -c "yes '' | apacman --noconfirm --noedit --skipinteg -S --needed ${PKGLIST}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
${CHROOTCMD} ${i}/ "apacman --gendb" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
set +e
|
||||
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%%.pacorig} ; done
|
||||
set -e
|
||||
done
|
||||
# 32-bit
|
||||
PKGLIST=$(sed -e '/^[[:space:]]*#/d ; /^[[:space:]]*$/d' ${BASEDIR}/lib/prereqs/iso.pkgs.lst.32 | tr '\n' ' ')
|
||||
if [ -n "${PKGLIST}" ];
|
||||
then
|
||||
${CHROOTCMD} ${CHROOTDIR32}/ /usr/bin/bash -c "apacman --noconfirm --noedit --skipinteg -S --needed ${PKGLIST}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
${CHROOTCMD} ${CHROOTDIR32}/ "apacman --gendb" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
fi
|
||||
set +e
|
||||
for x in $(find ${CHROOTDIR32}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%.pacorig} ; done
|
||||
set -e
|
||||
# 64-bit
|
||||
PKGLIST=$(sed -e '/^[[:space:]]*#/d ; /^[[:space:]]*$/d' ${BASEDIR}/lib/prereqs/iso.pkgs.lst.64 | tr '\n' ' ')
|
||||
if [ -n "${PKGLIST}" ];
|
||||
then
|
||||
${CHROOTCMD} ${CHROOTDIR64}/ /usr/bin/bash -c "apacman --noconfirm --noedit --skipinteg -S --needed ${PKGLIST}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
${CHROOTCMD} ${CHROOTDIR64}/ "apacman --gendb" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
fi
|
||||
set +e
|
||||
for x in $(find ${CHROOTDIR64}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%.pacorig} ; done
|
||||
set -e
|
||||
|
||||
# extra packages
|
||||
sed -i -e '/base-devel/d ; /multilib-devel/d' ${BASEDIR}/extra/packages.{both,64}
|
||||
# both
|
||||
echo "Installing extra common packages..."
|
||||
PKGLIST=$(sed -e '/^[[:space:]]*#/d ; /^[[:space:]]*$/d' ${BASEDIR}/extra/packages.both | tr '\n' ' ')
|
||||
for i in ${CHROOTDIR32} ${CHROOTDIR64};
|
||||
do
|
||||
echo "Running post-build tasks in ${i}..."
|
||||
chmod 700 ${i}/root/post-build.sh
|
||||
${CHROOTCMD} ${i}/ "/root/post-build.sh" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%%.pacorig} ; done
|
||||
set +e
|
||||
${CHROOTCMD} ${i}/ /usr/bin/bash -c "apacman --noconfirm --noedit --skipinteg -S --needed linux" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
${CHROOTCMD} ${i}/ "apacman --gendb" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
cp -a ${i}/boot/vmlinuz-linux ${i}/boot/vmlinuz-linux-${DISTNAME}
|
||||
cp -af ${i}/boot/initramfs-linux.img ${i}/boot/initramfs-linux-${DISTNAME}.img
|
||||
set -e
|
||||
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%%.pacorig} ; done
|
||||
# Uncomment if you wish to use the mkpasswd binary from within the chroot...
|
||||
#${CHROOTCMD} ${i}/ bash -c "apacman --noconfirm --noedit --skipinteg -S --needed debian-whois-mkpasswd" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
#for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%%.pacorig} ; done
|
||||
echo -n "Regular packages..."
|
||||
${CHROOTCMD} ${i}/ bash -c "yes '' | apacman --noconfirm --noedit --skipinteg -S --needed ${PKGLIST}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
${CHROOTCMD} ${i}/ "apacman --gendb" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
set +e
|
||||
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%%.pacorig} ; done
|
||||
set -e
|
||||
# User creation
|
||||
echo -n "...Creating ${REGUSR} user..."
|
||||
${CHROOTCMD} ${i}/ useradd -m -s /bin/bash -c "Default user" ${REGUSR} >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
${CHROOTCMD} ${i}/ usermod -aG users,games,video,audio ${REGUSR} >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
${CHROOTCMD} ${i}/ passwd -d ${REGUSR} >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
mkdir -p ${i}/etc/sudoers.d ; chmod 750 ${i}/etc/sudoers.d
|
||||
printf "Defaults:${REGUSR} \041lecture\n${REGUSR} ALL=(ALL) ALL\n" >> ${i}/etc/sudoers.d/${REGUSR}
|
||||
if [[ -n "${REGUSR_PASS}" && "${REGUSR_PASS}" != '{[BLANK]}' ]];
|
||||
then
|
||||
#${CHROOTCMD} ${i}/ "/usr/bin/echo ${REGUSR}:${REGUSR_PASS} | chpasswd -e" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
sed -i -e "s|^${REGUSR}::|${REGUSR}:${REGUSR_PASS}:|g" ${i}/etc/shadow
|
||||
elif [[ "${REGUSR_PASS}" == '{[BLANK]}' ]];
|
||||
then
|
||||
${CHROOTCMD} ${i}/ passwd -d ${REGUSR} >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
else
|
||||
${CHROOTCMD} ${i}/ usermod -L ${REGUSR} >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
fi
|
||||
if [[ -n "${ROOT_PASS}" && "${ROOT_PASS}" != '{[BLANK]}' ]];
|
||||
then
|
||||
#${CHROOTCMD} ${i}/ "/usr/bin/echo root:${ROOT_PASS} | chpasswd -e" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
sed -i -e "s|^root::|root:${ROOT_PASS}:|g" ${i}/etc/shadow
|
||||
elif [[ "${ROOT_PASS}" == '{[BLANK]}' ]];
|
||||
then
|
||||
${CHROOTCMD} ${i}/ passwd -d root >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
else
|
||||
${CHROOTCMD} ${i}/ usermod -L root >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
fi
|
||||
# The following is supposed to do the same as the above, but "cleaner". However, it currently fails with "execv() failed: No such file or directory"
|
||||
##${CHROOTCMD} ${i}/ usermod -L root >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
echo "Done."
|
||||
done
|
||||
|
||||
for i in ${CHROOTDIR32} ${CHROOTDIR64};
|
||||
do
|
||||
set +e
|
||||
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%.pacorig} ; done
|
||||
${CHROOTCMD} ${i}/ /usr/bin/bash -c "mkinitcpio -p linux" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
cp -af ${i}/boot/initramfs-linux.img ${i}/boot/initramfs-linux-${DISTNAME}.img
|
||||
set -e
|
||||
done
|
||||
|
||||
# 32-bit
|
||||
echo "Installing extra packages for 32-bit..."
|
||||
PKGLIST=$(sed -e '/^[[:space:]]*#/d ; /^[[:space:]]*$/d' ${BASEDIR}/extra/packages.32 | tr '\n' ' ')
|
||||
if [ -n "${PKGLIST}" ];
|
||||
then
|
||||
${CHROOTCMD} ${CHROOTDIR32}/ /usr/bin/bash -c "apacman --noconfirm --noedit --skipinteg -S --needed ${PKGLIST}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
fi
|
||||
set +e
|
||||
for x in $(find ${CHROOTDIR32}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%.pacorig} ; done
|
||||
set -e
|
||||
echo "Done."
|
||||
|
||||
# 64-bit
|
||||
echo "Installing estra packages for 64-bit..."
|
||||
PKGLIST=$(sed -e '/^[[:space:]]*#/d ; /^[[:space:]]*$/d' ${BASEDIR}/extra/packages.64 | tr '\n' ' ')
|
||||
if [ -n "${PKGLIST}" ];
|
||||
then
|
||||
${CHROOTCMD} ${CHROOTDIR64}/ /usr/bin/bash -c "apacman --noconfirm --noedit --skipinteg -S --needed ${PKGLIST}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
fi
|
||||
set +e
|
||||
for x in $(find ${CHROOTDIR64}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%.pacorig} ; done
|
||||
set -e
|
||||
echo "Done."
|
||||
|
||||
echo "Syncing overlay..."
|
||||
touch ${LOCKFILE}
|
||||
sleep 2
|
||||
find ${BASEDIR}/overlay -exec touch '{}' \;
|
||||
rsync -a --exclude '/32' --exclude '/64' ${BASEDIR}/overlay/. ${CHROOTDIR64}/.
|
||||
rsync -a --exclude '/32' --exclude '/64' ${BASEDIR}/overlay/. ${CHROOTDIR32}/.
|
||||
rsync -a ${BASEDIR}/overlay/32/. ${CHROOTDIR32}/.
|
||||
rsync -a ${BASEDIR}/overlay/64/. ${CHROOTDIR64}/.
|
||||
find ${CHROOTDIR64}/ -newer ${LOCKFILE} -exec chown -R root:root '{}' \;
|
||||
find ${CHROOTDIR32}/ -newer ${LOCKFILE} -exec chown -R root:root '{}' \;
|
||||
chown -R 1000:1000 ${CHROOTDIR32}/home/${REGUSR}
|
||||
chown -R 1000:1000 ${CHROOTDIR64}/home/${REGUSR}
|
||||
find ${CHROOTDIR64}/home/${REGUSR}/ -type d -exec chmod 700 '{}' \;
|
||||
find ${CHROOTDIR64}/home/${REGUSR}/ -type f -exec chmod 600 '{}' \;
|
||||
find ${CHROOTDIR32}/home/${REGUSR}/ -type d -exec chmod 700 '{}' \;
|
||||
find ${CHROOTDIR32}/home/${REGUSR}/ -type f -exec chmod 600 '{}' \;
|
||||
find ${CHROOTDIR64}/root/ -type d -exec chmod 700 '{}' \;
|
||||
find ${CHROOTDIR64}/root/ -type f -exec chmod 600 '{}' \;
|
||||
find ${CHROOTDIR32}/root/ -type d -exec chmod 700 '{}' \;
|
||||
find ${CHROOTDIR32}/root/ -type f -exec chmod 600 '{}' \;
|
||||
chmod 600 ${CHROOTDIR64}/etc/ssh/*
|
||||
chmod 600 ${CHROOTDIR32}/etc/ssh/*
|
||||
echo "Done."
|
||||
|
||||
|
||||
#rm -f ${LOCKFILE}
|
||||
|
||||
echo "Chroot setup complete."
|
||||
|
||||
}
|
||||
|
||||
if [[ ! -f "${BASEDIR}/root.x86_64/VERSION_INFO.txt" && ! -f "${BASEDIR}/root.x86_64/VERSION_INFO.txt" ]];
|
||||
then
|
||||
mkchroot
|
||||
fi
|
||||
@@ -1,23 +0,0 @@
|
||||
function holla_atcha_boi {
|
||||
|
||||
FUNCNAME="holla_atcha_boi"
|
||||
|
||||
if [[ "${I_AM_A_RACECAR}" == "y" ]];
|
||||
then
|
||||
RACECAR_CHK='nice -n -19 '
|
||||
else
|
||||
RACECAR_CHK=""
|
||||
fi
|
||||
|
||||
so_check_me_out
|
||||
|
||||
# Do we have an existing chroot set up yet? If not, create.
|
||||
if [[ ! -d "root.x86_64/root" || ! -d "root.i686/root" ]];
|
||||
then
|
||||
echo "No existing chroot environment found. Creating..."
|
||||
rm -f ${LOCKFILE}
|
||||
${RACECAR_CHK} ${BASEDIR}/lib/01-mk.chroot.func.sh
|
||||
touch ${LOCKFILE}
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
function release_me () {
|
||||
|
||||
FUNCNAME="release_me"
|
||||
|
||||
## check for mountpoints from a manual chroot and umount them if they're still mounted.
|
||||
## NOTE: you can use findmnt(8) to view a tree of mountpoints, including bindmounts etc.
|
||||
# Is there an active chroot?
|
||||
set +e
|
||||
if [[ "${1}" == "64" ]];
|
||||
then
|
||||
local CHROOTDIR="${CHROOTDIR}root.x86_64"
|
||||
local BUILDDIR="${BUILDDIR}64"
|
||||
elif [[ "${1}" == "32" ]];
|
||||
then
|
||||
local CHROOTDIR="${CHROOTDIR}root.i686"
|
||||
local BUILDDIR="${BUILDDIR}32"
|
||||
else
|
||||
echo "WHOOPS. We hit an error that makes no logical sense."
|
||||
echo 'Dying.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking for and cleaning up mountpoints from the chroot environment..."
|
||||
for i in tmp run dev/shm dev/pts dev
|
||||
do
|
||||
umount -l ${CHROOTDIR}/${i}
|
||||
done
|
||||
# and is it using efivars?
|
||||
if [ -d ${CHROOTDIR}/sys/firmware/efi/efivars ];
|
||||
then
|
||||
umount -l ${CHROOTDIR}/sys/firmware/efi/efivars
|
||||
fi
|
||||
# and finish cleaning up normal chroots
|
||||
for i in sys proc
|
||||
do
|
||||
umount -l ${CHROOTDIR}/${i}
|
||||
done
|
||||
# and is it mounted via two mountpoints a la arch-chroot?
|
||||
mount | awk '{print $3}' | grep -q ${MOUNTPT}
|
||||
if [[ ${?} == "0" ]];
|
||||
then
|
||||
umount ${MOUNTPT}
|
||||
fi
|
||||
if [ -d ${SRCDIR}/efiboot ];
|
||||
then
|
||||
umount -l ${SRCDIR}/efiboot
|
||||
fi
|
||||
rm -rf ${SRCDIR}/efiboot
|
||||
#rm -rf ${TEMPDIR}/*
|
||||
set -e # and go back to failing on non-0 exit status.
|
||||
CHROOTDIR="${CHROOTDIR_GLOB}"
|
||||
BUILDDIR="${BUILDDIR_GLOB}"
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
function facehugger () {
|
||||
|
||||
FUNCNAME="facehugger"
|
||||
|
||||
local ARCHSUFFIX="${1}"
|
||||
if [[ "${1}" == "64" ]];
|
||||
then
|
||||
local CHROOTDIR="${CHROOTDIR}root.x86_64"
|
||||
local BUILDDIR="${BUILDDIR}64"
|
||||
elif [[ "${1}" == "32" ]];
|
||||
then
|
||||
local CHROOTDIR="${CHROOTDIR}root.i686"
|
||||
local BUILDDIR="${BUILDDIR}32"
|
||||
else
|
||||
echo "WHOOPS. We hit an error that makes no logical sense."
|
||||
echo 'Dying.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Creating manual chroot mountpoints."
|
||||
# Latch on and inject ourself into the environment. Get it?
|
||||
mount -t proc -o nosuid,noexec,nodev proc ${CHROOTDIR}/proc &&
|
||||
mount -t sysfs -o nosuid,noexec,nodev,ro sys ${CHROOTDIR}/sys &&
|
||||
if [ -d /sys/firmware/efi/efivars ];
|
||||
then
|
||||
mount -t efivarfs -o nosuid,noexec,nodev efivarfs ${CHROOTDIR}/sys/firmware/efi/efivars
|
||||
fi &&
|
||||
mount -t devtmpfs -o mode=0755,nosuid udev ${CHROOTDIR}/dev &&
|
||||
mount -t devpts -o mode=0620,gid=5,nosuid,noexec devpts ${CHROOTDIR}/dev/pts &&
|
||||
mount -t tmpfs -o mode=1777,nosuid,nodev shm ${CHROOTDIR}/dev/shm &&
|
||||
mount -t tmpfs -o nosuid,nodev,mode=0755 run ${CHROOTDIR}/run &&
|
||||
mount -t tmpfs -o mode=1777,strictatime,nodev,nosuid tmp ${CHROOTDIR}/tmp
|
||||
echo "======================"
|
||||
echo "NOW ENTERING CHROOT..."
|
||||
echo "======================"
|
||||
chroot ${CHROOTDIR} /bin/bash
|
||||
rm -f ${CHROOTDIR}/root/chroot
|
||||
CHROOTDIR="${CHROOTDIR_GLOB}"
|
||||
BUILDDIR="${BUILDDIR_GLOB}"
|
||||
release_me ${ARCHSUFFIX}
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
function chroot_wrapper () {
|
||||
|
||||
FUNCNAME="chroot_wrapper"
|
||||
|
||||
local ARCHSUFFIX="${1}"
|
||||
if [[ "${1}" == "64" ]];
|
||||
then
|
||||
local CHROOTDIR="${CHROOTDIR}root.x86_64"
|
||||
local BUILDDIR="${BUILDDIR}64"
|
||||
elif [[ "${1}" == "32" ]];
|
||||
then
|
||||
local CHROOTDIR="${CHROOTDIR}root.i686"
|
||||
local BUILDDIR="${BUILDDIR}32"
|
||||
else
|
||||
echo "WHOOPS. We hit an error that makes no logical sense."
|
||||
echo 'Dying.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f "/usr/bin/systemd-nspawn" ];
|
||||
then
|
||||
CHROOTCMD="systemd-nspawn -D ${CHROOTDIR}"
|
||||
else
|
||||
CHROOTCMD="facehugger ${ARCHSUFFIX}"
|
||||
fi
|
||||
|
||||
echo "NOW ENTERING ${CHROOTDIR}...."
|
||||
echo "_____________________________"
|
||||
${CHROOTCMD}
|
||||
CHROOTDIR="${CHROOTDIR_GLOB}"
|
||||
BUILDDIR="${BUILDDIR_GLOB}"
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
function jenny_craig () {
|
||||
|
||||
FUNCNAME="jenny_craig"
|
||||
|
||||
BUILDDIR="${BUILDDIR_GLOB}"
|
||||
if [[ "${1}" == "64" ]];
|
||||
then
|
||||
local CHROOTDIR="${CHROOTDIR}root.x86_64"
|
||||
local BUILDDIR="${BUILDDIR}64"
|
||||
elif [[ "${1}" == "32" ]];
|
||||
then
|
||||
local CHROOTDIR="${CHROOTDIR}root.i686"
|
||||
local BUILDDIR="${BUILDDIR}32"
|
||||
else
|
||||
echo "WHOOPS. We hit an error that makes no logical sense."
|
||||
echo 'Dying.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local _CURDIR=$(pwd)
|
||||
echo "Syncing important files to ${BUILDDIR} for building the squashed filesystem (this may take some time)..."
|
||||
|
||||
# we have to do this or else the package management from LIVE doesn't really work too hot.
|
||||
cd ${CHROOTDIR}/var/lib/pacman
|
||||
echo "Compressing the package DB..."
|
||||
#rm -f ${CHROOTDIR}/usr/local/pacman.db.tar.xz
|
||||
tar -cf - local | xz -c9 > ../../../usr/local/pacman.db.tar.xz
|
||||
cd ${_CURDIR}
|
||||
|
||||
# sync over new changes and trim out the fat
|
||||
rsync -a --delete ${CHROOTDIR}/. ${BUILDDIR}/.
|
||||
set +e
|
||||
cp -af ${BUILDDIR}/usr/share/zoneinfo/EST5EDT ${BUILDDIR}/etc/localtime > /dev/null 2>&1
|
||||
cp -af ${CHROOTDIR}/usr/share/zoneinfo/EST5EDT ${CHROOTDIR}/etc/localtime > /dev/null 2>&1
|
||||
set -e
|
||||
cp -af ${BUILDDIR}/usr/share/locale/locale.alias ${BUILDDIR}/tmp/.
|
||||
echo "Cleaning up unnecessary cruft in ${BUILDDIR}..."
|
||||
|
||||
rm -f ${BUILDDIR}/root/.bash_history
|
||||
rm -f ${BUILDDIR}/root/.viminfo
|
||||
#rm -f ${BUILDDIR}/etc/localtime
|
||||
rm -f ${BUILDDIR}/root/.bashrc
|
||||
# DISABLE when no longer building custom kernel
|
||||
#find ${BUILDDIR}/usr/lib/modules/ -maxdepth 1 -iname "*-ARCH" -exec rm -rf '{}' \;
|
||||
for i in $(ls -1t ${BUILDDIR}/usr/lib/modules | tail -n "+2") ; do rm -rf ${BUILDDIR}/usr/lib/modules/${i} ; done
|
||||
find ${BUILDDIR}/ -type f -name "*.pacnew" -exec rm -rf '{}' \;
|
||||
sed -i -e '/^MAKEFLAGS=.*$/d' ${BUILDDIR}/etc/makepkg.conf
|
||||
rm -rf ${BUILDDIR}/usr/share/locale/*
|
||||
mv -f ${BUILDDIR}/tmp/locale.alias ${BUILDDIR}/usr/share/locale/.
|
||||
rm -rf ${BUILDDIR}/var/cache/pacman/*
|
||||
rm -rf ${BUILDDIR}/var/cache/pkgfile/*
|
||||
rm -rf ${BUILDDIR}/var/cache/apacman/pkg/*
|
||||
rm -rf ${BUILDDIR}/var/lib/pacman/*
|
||||
mkdir -p ${BUILDDIR}/var/lib/pacman/local
|
||||
rm -rf ${BUILDDIR}/var/abs/local/yaourtbuild/*
|
||||
rm -rf ${BUILDDIR}/usr/share/zoneinfo
|
||||
rm -rf ${BUILDDIR}/tmp/*
|
||||
rm -rf ${BUILDDIR}/var/tmp/*
|
||||
rm -rf ${BUILDDIR}/var/abs/*
|
||||
rm -rf ${BUILDDIR}/run/*
|
||||
rm -rf ${BUILDDIR}/boot/*
|
||||
#rm -rf ${BUILDDIR}/root/*
|
||||
rm -rf ${BUILDDIR}/root/post-build.sh
|
||||
rm -rf ${BUILDDIR}/usr/src/*
|
||||
rm -rf ${BUILDDIR}/var/log/*
|
||||
rm -rf ${BUILDDIR}/.git
|
||||
CHROOTDIR="${CHROOTDIR_GLOB}"
|
||||
BUILDDIR="${BUILDDIR_GLOB}"
|
||||
}
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
function centos_is_stupid {
|
||||
|
||||
FUNCNAME="centos_is_stupid"
|
||||
|
||||
if [[ "${HOST_DIST}" == "CentOS" || "${HOST_DIST}" == "RHEL" ]];
|
||||
then
|
||||
if [[ "$(rpm -qa | egrep -q '^xorriso-[0-9]')" != "0" ]];
|
||||
then
|
||||
# Download/install the proper xorriso
|
||||
EL_VER="$(rpm -qa coreutils | sed -re 's/^coreutils-[0-9.-]*el([0-9])*.*$/\1/g')"
|
||||
if (("${EL_VER}" < "7"));
|
||||
then
|
||||
echo "Wow. Your CentOS/RHEL is too old. Sorry; this is only supported on CentOS/RHEL 7 and up."
|
||||
exit 1
|
||||
fi
|
||||
XORRISO_RPM=$(curl -s http://pkgs.repoforge.org/xorriso/ | egrep "\"xorriso-[0-9.-]*el${EL_VER}.rf.x86_64.rpm\"" | sed -re "s/^.*\"(xorriso[0-9.-]*el${EL_VER}.rf.x86_64.rpm).*$/\1/g")
|
||||
echo "Since you're using either CentOS or RHEL, we need to install xorriso directly from an RPM. Please wait while we do this..."
|
||||
curl -sLo /tmp/${XORRISO_RPM} http://pkgs.repoforge.org/xorriso/${XORRISO_RPM}
|
||||
set +e
|
||||
yum -y install /tmp/${XORRISO_RPM} >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
set -e
|
||||
echo "Done."
|
||||
echo
|
||||
fi
|
||||
# We used to fetch and compile mksquashfs from source here, but no longer- because a new enough version is *finally* in CentOS repos as of CentOS 7.
|
||||
# This also lets us cut out the crufty version check and replace it with the one above.
|
||||
fi
|
||||
|
||||
# UGH. And you know what? Fuck SUSE too.
|
||||
if [[ "${HOST_DIST}" == "openSUSE" || "${HOST_DIST}" == "SUSE" ]];
|
||||
then
|
||||
if [[ "$(rpm -qa | egrep -q '^xorriso-[0-9]')" != "0" ]];
|
||||
then
|
||||
# Download/install the proper xorriso
|
||||
source /etc/os-release
|
||||
SUSE_VER="${VERSION_ID}"
|
||||
XORRISO_RPM=$(curl -s "http://software.opensuse.org/download.html?project=home%3AKnolleblau&package=xorriso" | egrep "/openSUSE_${SUSE_VER}/x86_64/xorriso-[0-9.-]" | tail -n1 | sed -re 's|^.*x86_64/(xorriso-[0-9.-]*.x86_64.rpm).*$|\1|g')
|
||||
echo "Since you're using openSUSE or SLED/SLES, we need to install xorriso directly from an RPM. Please wait while we do this..."
|
||||
curl -sLo /tmp/${XORRISO_RPM} "http://download.opensuse.org/repositories/home:/Knolleblau/openSUSE_${SUSE_VER}/x86_64/${XORRISO_RPM}"
|
||||
cp /etc/zypp/zypp.conf /etc/zypp/zypp.conf_BAK."${$}"
|
||||
echo 'pkg_gpgcheck = no' >> /etc/zypp/zypp.conf
|
||||
zypper install --no-confirm -l /tmp/${XORRISO_RPM} >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
mv -f /etc/zypp/zypp.conf_BAK."${$}" /etc/zypp/zypp.conf
|
||||
echo "Done."
|
||||
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
|
||||
# And a double fuck-you to SLED/SLES.
|
||||
if [[ "${HOST_DIST}" == "SUSE" ]];
|
||||
then
|
||||
source /etc/os-release
|
||||
source ${BASEDIR}/lib/prereqs/SUSE/meta
|
||||
SUSE_VER="${VERSION_ID}"
|
||||
SUSE_REL="${ID}"
|
||||
SDK_PKGS=(binutils-devel git xz-devel xz-devel-32bit zlib-devel zlib-devel-32bit)
|
||||
|
||||
if [[ "${PRE_RUN}" != 'none' ]];
|
||||
then
|
||||
echo "Now updating your local package cache..."
|
||||
set +e
|
||||
eval "${PRE_RUN}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
if [[ "${?}" != "0" ]];
|
||||
then
|
||||
echo "ERROR: Syncing your local package cache via ${PRE_RUN} command failed."
|
||||
echo "Please ensure you are connected to the Internet/have repositories configured correctly."
|
||||
exit 1
|
||||
fi
|
||||
set -e
|
||||
fi
|
||||
|
||||
zypper search binutils-devel | egrep -q '^[[:space:]]*|[[:space:]]*binutils-devel[[:space:]]*'
|
||||
if [[ "${?}" != "0" ]];
|
||||
then
|
||||
echo
|
||||
echo "In order to install some of the necessary packages on the host, you will need to add the SLE SDK repository."
|
||||
echo "It can be downloaded by visiting http://download.suse.com/ and search for 'SUSE Linux Enterprise Software Development Kit'"
|
||||
echo "(or add it to your subscriptions)."
|
||||
echo "See https://www.suse.com/documentation/${SUSE_REL}-${SUSE_VER}/book_sle_deployment/data/sec_add-ons_sdk.html for more information."
|
||||
exit 1
|
||||
else
|
||||
for pkgname in "${SDK_PKGS[@]}";
|
||||
do
|
||||
eval "${PKG_CHK}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
if [[ "${?}" != "0" ]];
|
||||
then
|
||||
echo "Installing ${pkgname}..."
|
||||
eval "${PKG_MGR}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
if [[ "${?}" != "0" ]];
|
||||
then
|
||||
echo "ERROR: ${pkgname} was not found to be installed and we can't install it."
|
||||
echo "This usually means you aren't connected to the Internet or your package repositories"
|
||||
echo "are not configured correctly. Review the list of packages in ${PKGLIST} and ensure"
|
||||
echo "they are all available to be installed."
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
function will_it_blend () {
|
||||
|
||||
FUNCNAME="will_it_blend"
|
||||
|
||||
SQUASH_CMD="mksquashfs"
|
||||
SQUASH_OPTS="-noappend -comp xz"
|
||||
|
||||
local ARCHSUFFIX="${1}"
|
||||
if [[ "${1}" == "64" ]];
|
||||
then
|
||||
local CHROOTDIR="${CHROOTDIR}root.x86_64"
|
||||
local BUILDDIR="${BUILDDIR}64"
|
||||
local AIROOT="x86_64"
|
||||
_CHROOT=${CHROOTDIR}
|
||||
_BUILD=${BUILDDIR}
|
||||
_AIROOT=${AIROOT}
|
||||
elif [[ "${1}" == "32" ]];
|
||||
then
|
||||
local CHROOTDIR="${CHROOTDIR}root.i686"
|
||||
local BUILDDIR="${BUILDDIR}32"
|
||||
local AIROOT="i686"
|
||||
_CHROOT=${CHROOTDIR}
|
||||
_BUILD=${BUILDDIR}
|
||||
_AIROOT=${AIROOT}
|
||||
else
|
||||
echo "WHOOPS. We hit an error that makes no logical sense."
|
||||
echo 'Dying.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${I_AM_A_RACECAR}" == "y" ]];
|
||||
then
|
||||
RACECAR_CHK='nice -n -19 '
|
||||
else
|
||||
RACECAR_CHK=""
|
||||
fi
|
||||
|
||||
if [ "${CHROOTDIR}/root/.bash_history" -nt "${ARCHBOOT}/${AIROOT}/airootfs.sfs" ] || [ ! -d "${BUILDDIR}/root/" ];
|
||||
then
|
||||
echo "Data is not sync'd to buildroot; syncing..."
|
||||
CHROOTDIR="${CHROOTDIR_GLOB}"
|
||||
BUILDDIR="${BUILDDIR_GLOB}"
|
||||
jenny_craig ${ARCHSUFFIX}
|
||||
CHROOTDIR="${_CHROOT}"
|
||||
BUILDDIR="${_BUILD}"
|
||||
fi
|
||||
echo "[${ARCHSUFFIX}-bit] Now generating the squashed image (if we need to) and hashes. This may take some time."
|
||||
BUILDDIR="${BUILDDIR_GLOB}"
|
||||
local BUILDDIR="${BUILDDIR}${ARCHSUFFIX}"
|
||||
|
||||
# now let's build the squashed image... and generate some checksums as well to verify download integrity.
|
||||
# are we building split-arch ISOs? do we need the below?
|
||||
#if [[ "${MULTIARCH}" == "n" ]];
|
||||
#then
|
||||
# rm -rf ${ARCHBOOT}
|
||||
#fi
|
||||
mkdir -p ${ARCHBOOT}/${AIROOT}
|
||||
|
||||
if [ ! -f "${ARCHBOOT}/${AIROOT}/airootfs.sfs" ] || [ "${CHROOTDIR}/root/.bash_history" -nt "${ARCHBOOT}/${AIROOT}/airootfs.sfs" ];
|
||||
then
|
||||
echo "[${ARCHSUFFIX}-bit] Squashing filesystem. This can take a while depending on the size of your chroot(s)."
|
||||
${RACECAR_CHK}${SQUASH_CMD} ${BUILDDIR} ${ARCHBOOT}/${AIROOT}/airootfs.sfs ${SQUASH_OPTS} >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
cd ${ARCHBOOT}/${AIROOT}
|
||||
${RACECAR_CHK}sha256sum airootfs.sfs >> airootfs.sha256
|
||||
${RACECAR_CHK}md5sum airootfs.sfs >> airootfs.md5
|
||||
cd ${BASEDIR}
|
||||
else
|
||||
cd ${BASEDIR}
|
||||
fi
|
||||
|
||||
# Generate the mtree spec.
|
||||
# Not really necessary anymore.
|
||||
#mtree -c -p ${BASEDIR}/chroot -K flags,gid,mode,nlink,uid,link,time,type > ${BASEDIR}/extra/mtree.spec
|
||||
|
||||
# and now we copy stuff into the live directories
|
||||
echo "[${ARCHSUFFIX}-bit] Copying files for PXE, and ISO building, please be patient."
|
||||
#rm -rf ${TEMPDIR}/*
|
||||
if [ ! -f ${BASEDIR}/extra/${UXNAME}.png ];
|
||||
then
|
||||
cat ${BASEDIR}/extra/bdisk.png > ${BASEDIR}/extra/${UXNAME}.png
|
||||
fi
|
||||
cp -af ${BASEDIR}/extra/${UXNAME}.png ${TEMPDIR}/.
|
||||
cp -af ${BASEDIR}/extra/${UXNAME}.png ${TFTPDIR}/.
|
||||
mkdir -p ${TEMPDIR}/boot
|
||||
cp -af ${CHROOTDIR}/boot/initramfs-linux-${DISTNAME}.img ${TEMPDIR}/boot/${UXNAME}.${ARCHSUFFIX}.img
|
||||
cp -af ${CHROOTDIR}/boot/vmlinuz-linux-${DISTNAME} ${TEMPDIR}/boot/${UXNAME}.${ARCHSUFFIX}.kern
|
||||
cp -af ${CHROOTDIR}/boot/initramfs-linux-${DISTNAME}.img ${TFTPDIR}/${UXNAME}.${ARCHSUFFIX}.img
|
||||
cp -af ${CHROOTDIR}/boot/vmlinuz-linux-${DISTNAME} ${TFTPDIR}/${UXNAME}.${ARCHSUFFIX}.kern
|
||||
cp -af ${ARCHBOOT}/* ${HTTPDIR}/${DISTNAME}/.
|
||||
cp -af ${TFTPDIR}/* ${HTTPDIR}/.
|
||||
chown -R ${HTTPUSR}:${HTTPGRP} ${HTTPDIR}
|
||||
chown ${TFTPUSR}:${TFTPGRP} ${TFTPDIR}/${UXNAME}.*
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
function stuffy {
|
||||
|
||||
FUNCNAME="stuffy"
|
||||
|
||||
cp -f ${BASEDIR}/VERSION_INFO.txt ${TEMPDIR}/.
|
||||
|
||||
if [[ "${I_AM_A_RACECAR}" == "y" ]];
|
||||
then
|
||||
RACECAR_CHK='nice -n -19 '
|
||||
else
|
||||
RACECAR_CHK=""
|
||||
fi
|
||||
|
||||
echo "Setting up EFI stuff..."
|
||||
|
||||
mkdir -p ${TEMPDIR}/{EFI/{${DISTNAME},boot},loader/entries}
|
||||
# this stuff comes from the prebootloader pkg and systemd-boot. lets us boot on UEFI machines with secureboot still enabled.
|
||||
# the signed prebootloader binaries, however, have been replaced by non-signed ones. so we need to fetch them.
|
||||
# fetched from http://blog.hansenpartnership.com/linux-foundation-secure-boot-system-released/
|
||||
curl -so ${TEMPDIR}/EFI/boot/bootx64.efi "http://blog.hansenpartnership.com/wp-uploads/2013/PreLoader.efi" # MD5: 4f7a4f566781869d252a09dc84923a82 TODO: implement checksumming check
|
||||
curl -so ${TEMPDIR}/EFI/boot/HashTool.efi http://blog.hansenpartnership.com/wp-uploads/2013/HashTool.efi
|
||||
#cp ${BASEDIR}/root.x86_64/usr/lib/prebootloader/PreLoader.efi ${TEMPDIR}/EFI/boot/bootx64.efi
|
||||
#cp ${BASEDIR}/root.x86_64/usr/lib/prebootloader/HashTool.efi ${TEMPDIR}/EFI/boot/.
|
||||
cp ${BASEDIR}/root.x86_64/usr/lib/systemd/boot/efi/systemd-bootx64.efi ${TEMPDIR}/EFI/boot/loader.efi # TODO: can i use syslinux.efi instead?
|
||||
|
||||
echo "Checking/fetching UEFI shells..."
|
||||
if [ ! -f "${TEMPDIR}/EFI/shellx64_v2.efi" ];
|
||||
then
|
||||
# EFI Shell 2.0 for UEFI 2.3+ ( http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=UEFI_Shell )
|
||||
curl -o ${TEMPDIR}/EFI/shellx64_v2.efi "https://github.com/tianocore/edk2/blob/master/ShellBinPkg/UefiShell/X64/Shell.efi?raw=true" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
fi
|
||||
if [ ! -f "${TEMPDIR}/EFI/shellx64_v1.efi" ];
|
||||
then
|
||||
# EFI Shell 1.0 for non UEFI 2.3+ ( http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Efi-shell )
|
||||
curl -o ${TEMPDIR}/EFI/shellx64_v1.efi "https://github.com/tianocore/edk2/blob/master/EdkShellBinPkg/FullShell/X64/Shell_Full.efi?raw=true" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
fi
|
||||
|
||||
# now for setting up loader config/entries. maybe add memtest or something in the future? i dunno.
|
||||
cat > ${TEMPDIR}/loader/loader.conf << EOF
|
||||
timeout 3
|
||||
default ${UXNAME}
|
||||
EOF
|
||||
cat > ${TEMPDIR}/loader/entries/${UXNAME}_ram.conf << EOF
|
||||
title ${PNAME} (RAM)
|
||||
linux /boot/${UXNAME}.kern
|
||||
initrd /boot/${UXNAME}.img
|
||||
options copytoram archisobasedir=${DISTNAME} archisolabel=${DISTNAME}
|
||||
EOF
|
||||
cat > ${TEMPDIR}/loader/entries/${UXNAME}.conf << EOF
|
||||
title ${PNAME} (Media)
|
||||
linux /boot/${UXNAME}.kern
|
||||
initrd /boot/${UXNAME}.img
|
||||
options archisobasedir=${DISTNAME} archisolabel=${DISTNAME}
|
||||
EOF
|
||||
cat > ${TEMPDIR}/loader/entries/uefi2.conf << EOF
|
||||
title UEFI Shell (v2)
|
||||
efi /EFI/shellx64_v2.efi
|
||||
EOF
|
||||
cat > ${TEMPDIR}/loader/entries/uefi1.conf << EOF
|
||||
title UEFI Shell (v1)
|
||||
efi /EFI/shellx64_v1.efi
|
||||
EOF
|
||||
|
||||
|
||||
# create the embedded efiboot FAT stuff
|
||||
# how big should we make the disk?
|
||||
echo "Generating the EFI embedded FAT filesystem..."
|
||||
# are we building split-arch ISOs?
|
||||
if [[ "${MULTIARCH}" == "n" ]];
|
||||
then
|
||||
rm -f ${TEMPDIR}/EFI/${DISTNAME}/efiboot.img
|
||||
fi
|
||||
# now we need to calculate the space for various files we're going to include...
|
||||
FATSIZE=$(stat --format="%s" ${TEMPDIR}/boot/${UXNAME}.64.kern) # EFI/BDISK/bdisk.efi
|
||||
FATSIZE=$((${FATSIZE} + $(stat --format="%s" ${TEMPDIR}/boot/${UXNAME}.64.img))) # EFI/BDISK/bdisk.img
|
||||
#FATSIZE=$((${FATSIZE} + $(stat --format="%s" ${BASEDIR}/root.x86_64/usr/lib/prebootloader/PreLoader.efi))) # EFI/boot/bootx64.efi
|
||||
FATSIZE=$((${FATSIZE} + $(stat --format="%s" ${TEMPDIR}/EFI/boot/bootx64.efi))) # EFI/boot/bootx64.efi
|
||||
FATSIZE=$((${FATSIZE} + $(stat --format="%s" ${TEMPDIR}/EFI/boot/HashTool.efi))) # EFI/boot/HashTool.efi
|
||||
FATSIZE=$((${FATSIZE} + $(stat --format="%s" ${BASEDIR}/root.x86_64/usr/lib/systemd/boot/efi/systemd-bootx64.efi))) # EFI/boot/loader.efi
|
||||
FATSIZE=$((${FATSIZE} + $(stat --format="%s" ${TEMPDIR}/EFI/shellx64_v1.efi)))
|
||||
FATSIZE=$((${FATSIZE} + $(stat --format="%s" ${TEMPDIR}/EFI/shellx64_v2.efi)))
|
||||
FATSIZE=$((${FATSIZE} + $(du -sb ${TEMPDIR}/loader | tail -n1 | awk '{print $1}'))) # loader/* (okay so i cheated a little here.)
|
||||
FATSIZE=$((${FATSIZE} + 786432)) # let's give a little wiggle room; 768k should do it. -_-
|
||||
${RACECAR_CHK}truncate -s "${FATSIZE}" ${TEMPDIR}/EFI/${DISTNAME}/efiboot.img
|
||||
${RACECAR_CHK}mkfs.vfat -F 32 -n ${DISTNAME}_EFI ${TEMPDIR}/EFI/${DISTNAME}/efiboot.img >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
mkdir -p ${SRCDIR}/efiboot
|
||||
mount ${TEMPDIR}/EFI/${DISTNAME}/efiboot.img ${SRCDIR}/efiboot
|
||||
mkdir -p ${SRCDIR}/efiboot/EFI/${DISTNAME}
|
||||
cp ${TEMPDIR}/boot/${UXNAME}.64.kern ${SRCDIR}/efiboot/EFI/${DISTNAME}/${UXNAME}.efi
|
||||
cp ${TEMPDIR}/boot/${UXNAME}.64.img ${SRCDIR}/efiboot/EFI/${DISTNAME}/${UXNAME}.img
|
||||
mkdir -p ${SRCDIR}/efiboot/{EFI/boot,loader/entries}
|
||||
# GETTING DEJA VU HERE.
|
||||
cat > ${SRCDIR}/efiboot/loader/loader.conf << EOF
|
||||
timeout 3
|
||||
default ${UXNAME}
|
||||
EOF
|
||||
cat > ${SRCDIR}/efiboot/loader/entries/${UXNAME}_ram.conf << EOF
|
||||
title ${PNAME} (RAM)
|
||||
linux /EFI/${DISTNAME}/${UXNAME}.efi
|
||||
initrd /EFI/${DISTNAME}/${UXNAME}.img
|
||||
options copytoram archisobasedir=${DISTNAME} archisolabel=${DISTNAME}
|
||||
EOF
|
||||
cat > ${SRCDIR}/efiboot/loader/entries/${UXNAME}.conf << EOF
|
||||
title ${PNAME} (Media)
|
||||
linux /EFI/${DISTNAME}/${UXNAME}.efi
|
||||
initrd /EFI/${DISTNAME}/${UXNAME}.img
|
||||
options archisobasedir=${DISTNAME} archisolabel=${DISTNAME}
|
||||
EOF
|
||||
cat > ${SRCDIR}/efiboot/loader/entries/uefi2.conf << EOF
|
||||
title UEFI Shell (v2)
|
||||
efi /EFI/shellx64_v2.efi
|
||||
EOF
|
||||
cat > ${SRCDIR}/efiboot/loader/entries/uefi1.conf << EOF
|
||||
title UEFI Shell (v1)
|
||||
efi /EFI/shellx64_v1.efi
|
||||
EOF
|
||||
|
||||
cp ${TEMPDIR}/EFI/boot/bootx64.efi ${SRCDIR}/efiboot/EFI/boot/bootx64.efi
|
||||
cp ${TEMPDIR}/EFI/boot/HashTool.efi ${SRCDIR}/efiboot/EFI/boot/.
|
||||
cp ${BASEDIR}/root.x86_64/usr/lib/systemd/boot/efi/systemd-bootx64.efi ${SRCDIR}/efiboot/EFI/boot/loader.efi # TODO: can i use syslinux.efi instead?
|
||||
cp ${TEMPDIR}/EFI/shellx64_v{1,2}.efi ${SRCDIR}/efiboot/EFI/.
|
||||
umount ${SRCDIR}/efiboot
|
||||
echo "EFI configuration complete..."
|
||||
|
||||
}
|
||||
|
||||
@@ -1,436 +0,0 @@
|
||||
function yo_dj () {
|
||||
|
||||
FUNCNAME="yo_dj"
|
||||
|
||||
ARCH="${1}"
|
||||
echo "Building the actual .iso image. This may take a while."
|
||||
#im_batman ## WHYTF IS THIS HERE?!
|
||||
ISOFILENAME="${UXNAME}-${BUILDVERSION}.iso"
|
||||
#MINIFILENAME="${UXNAME}-${BUILDVERSION}-mini.iso"
|
||||
MINIFILENAME="${UXNAME}-mini.iso"
|
||||
USBFILENAME="${UXNAME}-mini.usb.img"
|
||||
if [[ "${MULTIARCH}" == "y" ]];
|
||||
then
|
||||
ISOFILENAME="${UXNAME}-${BUILDVERSION}-any.iso"
|
||||
else
|
||||
ISOFILENAME="${UXNAME}-${BUILDVERSION}-${ARCH}.iso"
|
||||
fi
|
||||
|
||||
if [[ "${I_AM_A_RACECAR}" == "y" ]];
|
||||
then
|
||||
RACECAR_CHK='nice -n -19 '
|
||||
else
|
||||
RACECAR_CHK=""
|
||||
fi
|
||||
|
||||
# and why not? generate the ISO.
|
||||
## we need to generate the isolinux.cfg
|
||||
mkdir -p ${TEMPDIR}/isolinux
|
||||
if [[ "${MULTIARCH}" == "y" ]];
|
||||
then
|
||||
## MULTIARCH ISO
|
||||
cat > ${TEMPDIR}/isolinux/isolinux.cfg << EOF
|
||||
UI vesamenu.c32
|
||||
DEFAULT check
|
||||
PROMPT 0
|
||||
TIMEOUT 50
|
||||
MENU HIDDEN
|
||||
#ONTIMEOUT ${UXNAME}_ram
|
||||
ONTIMEOUT check
|
||||
MENU TABMSG Press [TAB] to edit options
|
||||
#MENU TITLE ${PNAME} (ISO edition)
|
||||
MENU ROWS 16
|
||||
MENU TIMEOUTROW 22
|
||||
MENU TABMSGROW 24
|
||||
MENU CMDLINEROW 24
|
||||
MENU HELPMSGROW 26
|
||||
MENU WIDTH 78
|
||||
MENU MARGIN 6
|
||||
MENU IMMEDIATE
|
||||
# http://www.colorpicker.com/
|
||||
MENU color border 0 #00000000 #00000000 none
|
||||
MENU color title 0 #FFF5B800 #00000000 std
|
||||
MENU color sel 7;37;40 #FF000000 #FFFFFFFF all
|
||||
MENU color hotsel 1;7;37;40 #FFFF0000 #FFC0C0C0 all
|
||||
MENU color hotkey 1;7;37;40 #FF0000CC #FFC0C0C0 all
|
||||
MENU color tabmsg 1;31;40 #FF808080 #00000000 std
|
||||
MENU color help 1;31;40 #FFFFFFFF #FF000000 none
|
||||
MENU color timeout_msg 0 #FFFFB300 #00000000 none
|
||||
MENU color timeout 0 #FFFF0000 #FF000000 none
|
||||
MENU color cmdline 0 #FFFFFFFF #FF000000 none
|
||||
MENU color cmdmark 1;36;40 #C000FFFF #FF000000 std
|
||||
MENU color scrollbar 30;44 #FF00FF00 #FF000000 std
|
||||
MENU color msg07 0 #FF000000 #00FFFFFF none
|
||||
MENU BACKGROUND /${UXNAME}.png
|
||||
|
||||
LABEL check
|
||||
MENU LABEL Your best supported kernel should be detected automatically.
|
||||
COM32 ifcpu64.c32
|
||||
APPEND ${UXNAME}_64 -- ${UXNAME}_32
|
||||
MENU DEFAULT
|
||||
|
||||
|
||||
|
||||
LABEL local_override
|
||||
MENU LABEL Local ^Boot
|
||||
localboot 0
|
||||
TEXT HELP
|
||||
Boot from the local system instead.
|
||||
ENDTEXT
|
||||
|
||||
LABEL reboot
|
||||
MENU LABEL ^Reboot
|
||||
COM32 reboot.c32
|
||||
TEXT HELP
|
||||
Reboot the machine
|
||||
ENDTEXT
|
||||
|
||||
MENU SEPARATOR
|
||||
|
||||
## 64 BIT
|
||||
MENU BEGIN 64BIT
|
||||
MENU LABEL ^1) 64-Bit ...
|
||||
ONTIMEOUT ${UXNAME}_64
|
||||
|
||||
LABEL ${UXNAME}_ram_64
|
||||
MENU LABEL ^1) ${PNAME} (run from RAM)
|
||||
LINUX /boot/${UXNAME}.64.kern
|
||||
INITRD /boot/${UXNAME}.64.img
|
||||
APPEND copytoram archisobasedir=${DISTNAME} archisolabel=${DISTNAME}
|
||||
TEXT HELP
|
||||
64-bit, run from RAM
|
||||
ENDTEXT
|
||||
MENU DEFAULT
|
||||
|
||||
LABEL ${UXNAME}_64
|
||||
MENU LABEL ^1) ${PNAME} (Default)
|
||||
LINUX /boot/${UXNAME}.64.kern
|
||||
INITRD /boot/${UXNAME}.64.img
|
||||
APPEND archisobasedir=${DISTNAME} archisolabel=${DISTNAME}
|
||||
TEXT HELP
|
||||
Same as the above, except run directly from the CD-
|
||||
don't copy the image to RAM. (Best for lower-memory boxes)
|
||||
ENDTEXT
|
||||
|
||||
MENU END
|
||||
|
||||
MENU BEGIN 32BIT
|
||||
MENU LABEL ^2) 32-Bit ...
|
||||
ONTIMEOUT ${UXNAME}_32
|
||||
|
||||
## 32 BIT
|
||||
LABEL ${UXNAME}_ram_32
|
||||
MENU LABEL ^1) ${PNAME} (run from RAM)
|
||||
LINUX /boot/${UXNAME}.32.kern
|
||||
INITRD /boot/${UXNAME}.32.img
|
||||
APPEND copytoram archisobasedir=${DISTNAME} archisolabel=${DISTNAME}
|
||||
TEXT HELP
|
||||
32-bit, run from RAM
|
||||
ENDTEXT
|
||||
MENU DEFAULT
|
||||
|
||||
LABEL ${UXNAME}_32
|
||||
MENU LABEL ^2) ${PNAME} (Default)
|
||||
LINUX /boot/${UXNAME}.32.kern
|
||||
INITRD /boot/${UXNAME}.32.img
|
||||
APPEND archisobasedir=${DISTNAME} archisolabel=${DISTNAME}
|
||||
TEXT HELP
|
||||
Same as the above, except run directly from the CD-
|
||||
don't copy the image to RAM. (Best for lower-memory boxes)
|
||||
ENDTEXT
|
||||
|
||||
MENU END
|
||||
EOF
|
||||
else
|
||||
## ARCH-SPECIFIC ISO
|
||||
cat > ${TEMPDIR}/isolinux/isolinux.cfg << EOF
|
||||
UI vesamenu.c32
|
||||
DEFAULT check
|
||||
PROMPT 0
|
||||
TIMEOUT 50
|
||||
MENU HIDDEN
|
||||
ONTIMEOUT ${UXNAME}_ram_${ARCH}
|
||||
MENU TABMSG Press [TAB] to edit options
|
||||
#MENU TITLE ${PNAME} (ISO edition)
|
||||
MENU ROWS 16
|
||||
MENU TIMEOUTROW 22
|
||||
MENU TABMSGROW 24
|
||||
MENU CMDLINEROW 24
|
||||
MENU HELPMSGROW 26
|
||||
MENU WIDTH 78
|
||||
MENU MARGIN 6
|
||||
MENU IMMEDIATE
|
||||
# http://www.colorpicker.com/
|
||||
MENU color border 0 #00000000 #00000000 none
|
||||
MENU color title 0 #FFF5B800 #00000000 std
|
||||
MENU color sel 7;37;40 #FF000000 #FFFFFFFF all
|
||||
MENU color hotsel 1;7;37;40 #FFFF0000 #FFC0C0C0 all
|
||||
MENU color hotkey 1;7;37;40 #FF0000CC #FFC0C0C0 all
|
||||
MENU color tabmsg 1;31;40 #FF808080 #00000000 std
|
||||
MENU color help 1;31;40 #FFFFFFFF #FF000000 none
|
||||
MENU color timeout_msg 0 #FFFFB300 #00000000 none
|
||||
MENU color timeout 0 #FFFF0000 #FF000000 none
|
||||
MENU color cmdline 0 #FFFFFFFF #FF000000 none
|
||||
MENU color cmdmark 1;36;40 #C000FFFF #FF000000 std
|
||||
MENU color scrollbar 30;44 #FF00FF00 #FF000000 std
|
||||
MENU color msg07 0 #FF000000 #00FFFFFF none
|
||||
MENU BACKGROUND /${UXNAME}.png
|
||||
|
||||
LABEL local_override
|
||||
MENU LABEL Local ^Boot
|
||||
localboot 0
|
||||
TEXT HELP
|
||||
Boot from the local system instead.
|
||||
ENDTEXT
|
||||
|
||||
LABEL reboot
|
||||
MENU LABEL ^Reboot
|
||||
COM32 reboot.c32
|
||||
TEXT HELP
|
||||
Reboot the machine
|
||||
ENDTEXT
|
||||
|
||||
MENU SEPARATOR
|
||||
|
||||
MENU BEGIN ${ARCH}BIT
|
||||
MENU LABEL ^1) ${ARCH}-Bit ...
|
||||
ONTIMEOUT ${UXNAME}_${ARCH}
|
||||
|
||||
LABEL ${UXNAME}_ram_${ARCH}
|
||||
MENU LABEL ^1) ${PNAME} (run from RAM)
|
||||
LINUX /boot/${UXNAME}.${ARCH}.kern
|
||||
INITRD /boot/${UXNAME}.${ARCH}.img
|
||||
APPEND copytoram archisobasedir=${DISTNAME} archisolabel=${DISTNAME}
|
||||
TEXT HELP
|
||||
${ARCH}-bit, run from RAM
|
||||
ENDTEXT
|
||||
MENU DEFAULT
|
||||
|
||||
LABEL ${UXNAME}_${ARCH}
|
||||
MENU LABEL ^1) ${PNAME} (Default)
|
||||
LINUX /boot/${UXNAME}.${ARCH}.kern
|
||||
INITRD /boot/${UXNAME}.${ARCH}.img
|
||||
APPEND archisobasedir=${DISTNAME} archisolabel=${DISTNAME}
|
||||
TEXT HELP
|
||||
Same as the above, except run directly from the CD-
|
||||
don't copy the image to RAM. (Best for lower-memory boxes)
|
||||
ENDTEXT
|
||||
|
||||
MENU END
|
||||
EOF
|
||||
fi
|
||||
|
||||
stuffy
|
||||
|
||||
rm -f ${ISOFILENAME}
|
||||
if [ "${ARCHBOOT}" != "${TEMPDIR}/${DISTNAME}" ];
|
||||
then
|
||||
mkdir -p ${TEMPDIR}/${DISTNAME}
|
||||
rsync -a --delete ${ARCHBOOT}/. ${TEMPDIR}/${DISTNAME}/.
|
||||
fi
|
||||
cp -af ${BASEDIR}/root.x86_64/usr/lib/syslinux/bios/isolinux.bin ${TEMPDIR}/isolinux
|
||||
#cp -af ${BASEDIR}/root.x86_64/usr/lib/syslinux/bios/isolinux-debug.bin ${TEMPDIR}/isolinux/isolinux.bin #debugging
|
||||
#cp -af ${BASEDIR}/root.x86_64/usr/lib/syslinux/bios/* ${TEMPDIR}/isolinux/. #debugging
|
||||
cp -af ${BASEDIR}/root.x86_64/usr/lib/syslinux/bios/vesamenu.c32 ${TEMPDIR}/isolinux
|
||||
cp -af ${BASEDIR}/root.x86_64/usr/lib/syslinux/bios/linux.c32 ${TEMPDIR}/isolinux
|
||||
cp -af ${BASEDIR}/root.x86_64/usr/lib/syslinux/bios/reboot.c32 ${TEMPDIR}/isolinux
|
||||
if [ -f ${BASEDIR}/root.x86_64/usr/lib/syslinux/bios/ldlinux.c32 ];
|
||||
then
|
||||
cp -af ${BASEDIR}/root.x86_64/usr/lib/syslinux/bios/ldlinux.c32 ${TEMPDIR}/isolinux
|
||||
fi
|
||||
if [ -f ${BASEDIR}/root.x86_64/usr/lib/syslinux/bios/libcom32.c32 ];
|
||||
then
|
||||
cp -af ${BASEDIR}/root.x86_64/usr/lib/syslinux/bios/libcom32.c32 ${TEMPDIR}/isolinux
|
||||
fi
|
||||
if [ -f ${BASEDIR}/root.x86_64/usr/lib/syslinux/bios/libutil.c32 ];
|
||||
then
|
||||
cp -af ${BASEDIR}/root.x86_64/usr/lib/syslinux/bios/libutil.c32 ${TEMPDIR}/isolinux
|
||||
fi
|
||||
if [ -f ${BASEDIR}/root.x86_64/usr/lib/syslinux/bios/ifcpu64.c32 ];
|
||||
then
|
||||
cp -af ${BASEDIR}/root.x86_64/usr/lib/syslinux/bios/ifcpu64.c32 ${TEMPDIR}/isolinux
|
||||
fi
|
||||
cd ${TEMPDIR}
|
||||
|
||||
cd ..
|
||||
${RACECAR_CHK}xorriso -as mkisofs \
|
||||
`#-quiet` \
|
||||
`#-joliet` \
|
||||
`#-rock` \
|
||||
`#-omit-version-number` \
|
||||
`#-disable-deep-relocation` \
|
||||
-iso-level 3 \
|
||||
-full-iso9660-filenames \
|
||||
-volid "${DISTNAME}" \
|
||||
-appid "${DISTDESC}" \
|
||||
-publisher "${DISTPUB}" \
|
||||
`#-preparer "prepared by ${0}"` \
|
||||
-preparer "prepared by ${DISTPUB}" \
|
||||
-eltorito-boot isolinux/isolinux.bin \
|
||||
-eltorito-catalog isolinux/boot.cat \
|
||||
`#-isohybrid-mbr ${BASEDIR}/root.x86_64/usr/lib/syslinux/bios/isohdpfx.bin` \
|
||||
-no-emul-boot \
|
||||
-boot-load-size 4 \
|
||||
-boot-info-table \
|
||||
-isohybrid-mbr ${BASEDIR}/root.x86_64/usr/lib/syslinux/bios/isohdpfx.bin \
|
||||
-eltorito-alt-boot \
|
||||
-e EFI/${DISTNAME}/efiboot.img \
|
||||
-no-emul-boot \
|
||||
`#--efi-boot EFI/${DISTNAME}/efiboot.img` \
|
||||
-isohybrid-gpt-basdat \
|
||||
-output "${ISODIR}/${ISOFILENAME}" "${TEMPDIR}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
|
||||
## Build the mini-ISO ##
|
||||
if [[ "${BUILDMINI}" == "y" ]];
|
||||
then
|
||||
echo "Now generating the iPXE images; please wait..."
|
||||
## Get the latest version of ipxe from git.
|
||||
git submodule init >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
git submodule update >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
cd ${BASEDIR}/src/ipxe/src
|
||||
git checkout master .
|
||||
git clean -xdf > /dev/null 2>&1
|
||||
git reset --hard HEAD >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
git checkout master >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
git pull >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
git checkout master >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
# It will not build if we don't do this. Apparently we *need* libiberty.
|
||||
# ...or do we?
|
||||
#git revert -n 40a9a0f0
|
||||
## Apply our patches.
|
||||
# This replaces the 0003 and 0004 patches.
|
||||
# curl -s https://patch-diff.githubusercontent.com/raw/ipxe/ipxe/pull/49.patch > ${BASEDIR}/src/ipxe_local/patches/ipxe-0003-no-PIE.patch 2>/dev/null # this isn't really necessary, I think? If you're dying right around this step, uncomment.
|
||||
curl -s https://patch-diff.githubusercontent.com/raw/ipxe/ipxe/pull/50.patch > ${BASEDIR}/src/ipxe_local/patches/ipxe-0004-eiso.patch 2>/dev/null
|
||||
for i in $(find ${BASEDIR}/src/ipxe_local/patches/ -type f -iname "*.patch" -printf '%P\n' | sort);
|
||||
do
|
||||
patch --verbose -Np2 < ${BASEDIR}/src/ipxe_local/patches/${i} >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
done
|
||||
## SSL
|
||||
SSLDIR="${BASEDIR}/src/ipxe_local/ssl"
|
||||
mkdir -p ${SSLDIR}/{keys,crts,txt}
|
||||
chmod 000 ${SSLDIR}/keys
|
||||
chown root:root ${SSLDIR}/keys
|
||||
if [[ -z "${IPXE_SSL_CA}" && -z "${IPXE_SSL_KEY}" ]];
|
||||
then
|
||||
# Generate SSL CA
|
||||
#rm -rf ${SSLDIR}/*
|
||||
cd "${SSLDIR}"
|
||||
IPXE_SSL_CA="${SSLDIR}/crts/ca.crt"
|
||||
IPXE_SSL_CAKEY="${SSLDIR}/keys/ca.key"
|
||||
IPXE_DOMAIN=$(echo ${IPXE_URI} | sed -re 's/^(f|ht)tps?:\/\/// ; s/\/.*//')
|
||||
if [[ ! -f "${SSLDIR}/txt/ca.srl" ]];
|
||||
then
|
||||
echo 01 > ${SSLDIR}/txt/ca.srl
|
||||
fi
|
||||
touch ${SSLDIR}/txt/ca.idx
|
||||
openssl req -days 3650 -subj "/CN=${IPXE_DOMAIN}/O=${PNAME}/C=NA" -x509 -newkey rsa:4096 -nodes -out ${IPXE_SSL_CA} -keyout ${IPXE_SSL_CAKEY} -sha512 >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
openssl req -days 3650 -subj "/CN=${IPXE_DOMAIN}/O=${PNAME}/C=NA" -newkey rsa:4096 -keyout ${SSLDIR}/keys/server.key -nodes -out ${SSLDIR}/crts/server.csr -sha512 >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
openssl ca -days 3650 -batch -config ${SSLDIR}/openssl.cnf -keyfile ${IPXE_SSL_CAKEY} -in ${SSLDIR}/crts/server.csr -out ${SSLDIR}/crts/server.crt >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
#cat crts/server.crt crts/ca.crt > crts/server_chained.crt
|
||||
elif [[ -z "${IPXE_SSL_CA}" && -e "${IPXE_SSL_CAKEY}" ]];
|
||||
then
|
||||
echo "ERROR: You specified IPXE_SSL_CAKEY but not IPXE_SSL_CA. If one is specified, the other must be also."
|
||||
exit 1
|
||||
elif [[ -z "${IPXE_SSL_CAKEY}" && -e "${IPXE_SSL_CA}" ]];
|
||||
then
|
||||
echo "ERROR: You specified IPXE_SSL_CA but not IPXE_SSL_CAKEY. If one is specified, the other must be also."
|
||||
exit 1
|
||||
elif [[ ! -e "${IPXE_SSL_CA}" || ! -e "${IPXE_SSL_CAKEY}" ]];
|
||||
then
|
||||
echo "ERROR: You have specified both IPXE_SSL_CA and IPXE_SSL_CAKEY but one (or both) are not valid paths/files."
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "${IPXE_SSL_KEY}" && -z "${IPXE_SSL_CRT}" ]];
|
||||
then
|
||||
IPXE_SSL_KEY="${SSLDIR}/keys/client.key"
|
||||
IPXE_SSL_CRT="${SSLDIR}/crts/client.crt"
|
||||
IPXE_DOMAIN=$(echo ${IPXE_URI} | sed -re 's/^(f|ht)tps?:\/\/// ; s/\/.*//')
|
||||
# Generate SSL client key.
|
||||
openssl req -days 3650 -subj "/CN=${IPXE_DOMAIN}/O=${PNAME}/C=NA" -newkey rsa:4096 -keyout ${IPXE_SSL_KEY} -nodes -out ${SSLDIR}/crts/client.csr -sha512 >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
# Sign the crt.
|
||||
openssl ca -days 3650 -batch -config ${SSLDIR}/openssl.cnf -keyfile ${IPXE_SSL_CAKEY} -in ${SSLDIR}/crts/client.csr -out ${IPXE_SSL_CRT} >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
elif [[ -z "${IPXE_SSL_CRT}" && -e "${IPXE_SSL_KEY}" ]];
|
||||
then
|
||||
echo "ERROR: You specified IPXE_SSL_KEY but not IPXE_SSL_CRT. If one is specified, the other must be also."
|
||||
exit 1
|
||||
elif [[ -z "${IPXE_SSL_KEY}" && -e "${IPXE_SSL_CRT}" ]];
|
||||
then
|
||||
echo "ERROR: You specified IPXE_SSL_CRT but not IPXE_SSL_KEY. If one is specified, the other must be also."
|
||||
exit 1
|
||||
elif [[ ! -e "${IPXE_SSL_CRT}" || ! -e "${IPXE_SSL_KEY}" ]];
|
||||
then
|
||||
echo "ERROR: You have specified both IPXE_SSL_CRT and IPXE_SSL_KEY but one (or both) are not valid paths/files."
|
||||
exit 1
|
||||
fi
|
||||
cd ${BASEDIR}/src/ipxe/src
|
||||
# Generate the iPXE EMBED script...
|
||||
sed -re "s,^(chain\ ).*$,\1${IPXE_URI},g" \
|
||||
-e 's/%%COMMA%%/,/g' ${BASEDIR}/src/ipxe_local/EMBED > ${SRCDIR}/EMBED
|
||||
# And now we build!
|
||||
#make everything EMBED="${SRCDIR}/EMBED" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
make bin-i386-efi/ipxe.efi bin-x86_64-efi/ipxe.efi \
|
||||
EMBED="${SRCDIR}/EMBED" \
|
||||
TRUST="${IPXE_SSL_CA}" \
|
||||
CERT="${IPXE_SSL_CA},${IPXE_SSL_CRT}" \
|
||||
PRIVKEY="${IPXE_SSL_KEY}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
make bin/ipxe.eiso bin/ipxe.usb \
|
||||
EMBED="${SRCDIR}/EMBED" \
|
||||
TRUST="${IPXE_SSL_CA}" \
|
||||
CERT="${IPXE_SSL_CA},${IPXE_SSL_CRT}" \
|
||||
PRIVKEY="${IPXE_SSL_KEY}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
# Change this to USB-only...
|
||||
#make all EMBED="${BASEDIR}/src/ipxe_local/EMBED" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
mv -f ${BASEDIR}/src/ipxe/src/bin/ipxe.usb ${ISODIR}/${USBFILENAME}
|
||||
mv -f ${BASEDIR}/src/ipxe/src/bin/ipxe.eiso ${ISODIR}/${MINIFILENAME}
|
||||
make clean >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
cd ${BASEDIR}/src/ipxe
|
||||
git checkout master . > /dev/null 2>&1
|
||||
git clean -xdf > /dev/null 2>&1
|
||||
git reset --hard >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
#git reset --hard HEAD > /dev/null 2>&1
|
||||
echo
|
||||
fi
|
||||
|
||||
#isohybrid ${ISOFILENAME}
|
||||
cd ${ISODIR}
|
||||
${RACECAR_CHK}sha256sum ${ISOFILENAME} > ${ISOFILENAME}.sha256
|
||||
if [[ "${BUILDMINI}" == "y" ]];
|
||||
then
|
||||
${RACECAR_CHK}sha256sum ${MINIFILENAME} > ${MINIFILENAME}.sha256
|
||||
${RACECAR_CHK}sha256sum ${USBFILENAME} > ${USBFILENAME}.sha256
|
||||
fi
|
||||
cd ..
|
||||
echo "=ISO="
|
||||
echo "Size: $(ls -lh ${ISODIR}/${ISOFILENAME} | awk '{print $5}')"
|
||||
echo "SHA256: $(awk '{print $1}' ${ISODIR}/${ISOFILENAME}.sha256)"
|
||||
echo "Location: ${ISODIR}/${ISOFILENAME}"
|
||||
if [[ "${BUILDMINI}" == "y" ]];
|
||||
then
|
||||
echo "=Mini="
|
||||
echo "Size: $(ls -lh ${ISODIR}/${MINIFILENAME} | awk '{print $5}')"
|
||||
echo "SHA256: $(awk '{print $1}' ${ISODIR}/${MINIFILENAME}.sha256)"
|
||||
echo "Location: ${ISODIR}/${MINIFILENAME}"
|
||||
echo "=Mini USB="
|
||||
echo "Size: $(ls -lh ${ISODIR}/${USBFILENAME} | awk '{print $5}')"
|
||||
echo "SHA256: $(awk '{print $1}' ${ISODIR}/${USBFILENAME}.sha256)"
|
||||
echo "Location: ${ISODIR}/${USBFILENAME}"
|
||||
fi
|
||||
#rm -rf ${TEMPDIR}/*
|
||||
|
||||
# are we rsyncing?
|
||||
if [ -n "${RSYNC_HOST}" ];
|
||||
then
|
||||
echo
|
||||
echo "Now sending to ${RSYNC_HOST} via rsync. This may take a while..."
|
||||
echo "Sending TFTP files..."
|
||||
rsync -az --info=progress2 ${TFTPDIR} ${RSYNC_HOST}:${RSYNC_DEST}/.
|
||||
echo "Sending HTTP files..."
|
||||
rsync -az --info=progress2 ${HTTPDIR} ${RSYNC_HOST}:${RSYNC_DEST}/.
|
||||
# rsync -a ${TEMPDIR}/boot/${UXNAME}.* ${RSYNC_HOST}:${RSYNC_DEST}/http/.
|
||||
echo "Sending the image files..."
|
||||
rsync -az --info=progress2 ${ISODIR} ${RSYNC_HOST}:${RSYNC_DEST}/.
|
||||
echo "Sending extra files..."
|
||||
rsync -az --info=progress2 ${BASEDIR}/extra/packages.* ${RSYNC_HOST}:${RSYNC_DEST}/.
|
||||
rsync -az --info=progress2 ${BASEDIR}/VERSION_INFO.txt ${RSYNC_HOST}:${RSYNC_DEST}/.
|
||||
fi
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
function mentos {
|
||||
|
||||
FUNCNAME="mentos"
|
||||
|
||||
# Freshen up the chroots to git's HEAD. Package lists, overlay, etc.
|
||||
sed -i -e '/base-devel/d ; /multilib-devel/d' ${BASEDIR}/extra/packages.*
|
||||
# both
|
||||
echo "Installing common packages..."
|
||||
PKGLIST=$(sed -e '/^[[:space:]]*#/d ; /^[[:space:]]*$/d' ${BASEDIR}/extra/packages.both | tr '\n' ' ')
|
||||
|
||||
if [ -f "/usr/bin/systemd-nspawn" ];
|
||||
then
|
||||
CHROOTCMD="systemd-nspawn -D"
|
||||
else
|
||||
CHROOTCMD="${CHROOTDIR64}/bin/arch-chroot"
|
||||
fi
|
||||
|
||||
if [[ "${I_AM_A_RACECAR}" == "y" ]];
|
||||
then
|
||||
RACECAR_CHK='nice -n -19 '
|
||||
else
|
||||
RACECAR_CHK=""
|
||||
fi
|
||||
|
||||
if [[ -n $(find ${BASEDIR}/extra/pre-build.d/ -type f -newer ${BASEDIR}/root.x86_64/boot/vmlinuz-linux-${DISTNAME}) ]];
|
||||
then
|
||||
touch ${LOCKFILE}
|
||||
sleep 2
|
||||
find ${BASEDIR}/extra/pre-build.d/ -exec touch '{}' \;
|
||||
rsync -a ${BASEDIR}/extra/pre-build.d/64/. ${BASEDIR}/root.x86_64/.
|
||||
rsync -a ${BASEDIR}/extra/pre-build.d/32/. ${BASEDIR}/root.i686/.
|
||||
find ${BASEDIR}/root.x86_64/ -newer ${LOCKFILE} -exec chown -R root:root '{}' \;
|
||||
find ${BASEDIR}/root.i686/ -newer ${LOCKFILE} -exec chown -R root:root '{}' \;
|
||||
fi
|
||||
|
||||
for i in ${CHROOTDIR32} ${CHROOTDIR64};
|
||||
do
|
||||
echo -n "...Packages installing/upgrading to ${i}..."
|
||||
local INSTKERN=$(file ${i}/boot/vmlinuz-linux-${DISTNAME} | awk '{print $9}' | cut -f1 -d"-")
|
||||
local MIRROR=$(egrep '^Server' ${i}/etc/pacman.d/mirrorlist | head -n1 | sed -e 's/^Server\ =\ //g ; s#$repo.*#core/os/x86_64/#g')
|
||||
local NEWKERN=$(curl -s "${MIRROR}" | grep linux | awk '{print $3}' | cut -f2 -d\" | egrep '^linux-[0-9].*pkg.tar.xz$' | cut -f2 -d"-")
|
||||
|
||||
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%.pacorig} ; done
|
||||
${CHROOTCMD} ${i}/ bash -c "${RACECAR_CHK}apacman --noconfirm --noedit --skipinteg -S --needed --purgebuild --ignore linux ${PKGLIST}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%.pacorig} ; done
|
||||
${CHROOTCMD} ${i}/ /usr/bin/bash -c "mkinitcpio -p linux" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
#${CHROOTCMD} ${i}/ bash -c "apacman --noconfirm --noedit --skipinteg -S --needed ${PKGLIST}"
|
||||
cp -a ${i}/boot/vmlinuz-linux ${i}/boot/vmlinuz-linux-${DISTNAME}
|
||||
cp -a ${i}/boot/initramfs-linux.img ${i}/boot/initramfs-linux-${DISTNAME}.img
|
||||
echo "Done."
|
||||
done
|
||||
|
||||
# we need to set -e for the following as they may fail.
|
||||
# 32-bit
|
||||
echo "Installing packages for 32-bit..."
|
||||
PKGLIST=$(sed -e '/^[[:space:]]*#/d ; /^[[:space:]]*$/d' ${BASEDIR}/extra/packages.32 | tr '\n' ' ')
|
||||
if [ -n "${PKGLIST}" ];
|
||||
then
|
||||
${CHROOTCMD} ${CHROOTDIR32}/ bash -c "yes '' | ${RACECAR_CHK}apacman --noconfirm --noedit --skipinteg -S --needed --purgebuild ${PKGLIST}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
fi
|
||||
for x in $(find ${CHROOTDIR32}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%.pacorig} ; done
|
||||
|
||||
# 64-bit
|
||||
echo "Installing packages for 64-bit..."
|
||||
PKGLIST=$(sed -e '/^[[:space:]]*#/d ; /^[[:space:]]*$/d' ${BASEDIR}/extra/packages.64 | tr '\n' ' ')
|
||||
if [ -n "${PKGLIST}" ];
|
||||
then
|
||||
${CHROOTCMD} ${CHROOTDIR64}/ bash -c "yes '' | ${RACECAR_CHK}apacman --noconfirm --noedit --skipinteg -S --needed --purgebuild ${PKGLIST}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
fi
|
||||
for x in $(find ${CHROOTDIR64}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%.pacorig} ; done
|
||||
#${CHROOTCMD} ${CHROOTDIR64}/ bash -c "apacman --noconfirm --noedit --skipinteg -S --needed ${PKGLIST}"
|
||||
echo "Syncing overlay..."
|
||||
rsync -a ${BASEDIR}/overlay/64/. ${CHROOTDIR64}/.
|
||||
echo "Done."
|
||||
|
||||
echo "Syncing overlay..."
|
||||
touch ${LOCKFILE}
|
||||
sleep 2
|
||||
find ${BASEDIR}/overlay -exec touch '{}' \;
|
||||
rsync -a --exclude '/32' --exclude '/64' ${BASEDIR}/overlay/. ${CHROOTDIR64}/.
|
||||
rsync -a --exclude '/32' --exclude '/64' ${BASEDIR}/overlay/. ${CHROOTDIR32}/.
|
||||
rsync -a ${BASEDIR}/overlay/32/. ${CHROOTDIR32}/.
|
||||
rsync -a ${BASEDIR}/overlay/64/. ${CHROOTDIR64}/.
|
||||
find ${CHROOTDIR64}/ -newer ${LOCKFILE} -exec chown -R root:root '{}' \;
|
||||
find ${CHROOTDIR32}/ -newer ${LOCKFILE} -exec chown -R root:root '{}' \;
|
||||
chown -R 1000:1000 ${CHROOTDIR32}/home/${REGUSR}
|
||||
chown -R 1000:1000 ${CHROOTDIR64}/home/${REGUSR}
|
||||
find ${CHROOTDIR64}/home/${REGUSR}/ -type d -exec chmod 700 '{}' \;
|
||||
find ${CHROOTDIR64}/home/${REGUSR}/ -type f -exec chmod 600 '{}' \;
|
||||
find ${CHROOTDIR32}/home/${REGUSR}/ -type d -exec chmod 700 '{}' \;
|
||||
find ${CHROOTDIR32}/home/${REGUSR}/ -type f -exec chmod 600 '{}' \;
|
||||
chown -R 0:0 ${CHROOTDIR32}/root
|
||||
chown -R 0:0 ${CHROOTDIR64}/root
|
||||
find ${CHROOTDIR64}/root/ -type d -exec chmod 700 '{}' \;
|
||||
find ${CHROOTDIR64}/root/ -type f -exec chmod 600 '{}' \;
|
||||
find ${CHROOTDIR32}/root/ -type d -exec chmod 700 '{}' \;
|
||||
find ${CHROOTDIR32}/root/ -type f -exec chmod 600 '{}' \;
|
||||
chmod 600 ${CHROOTDIR64}/etc/ssh/*
|
||||
chmod 600 ${CHROOTDIR32}/etc/ssh/*
|
||||
echo "Done."
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
NAME='Antergos'
|
||||
SUPPORTED='yes'
|
||||
CHECK_METHOD='egrep "^NAME=\"Antergos Linux\"$" /etc/os-release'
|
||||
PKG_MGR='pacman -S --needed --noconfirm ${pkgname}'
|
||||
PRE_RUN='pacman -Syyy'
|
||||
PKG_CHK='pacman -Q ${pkgname}'
|
||||
URL='http://antergos.com/'
|
||||
|
||||
function distro_specific_tweaks {
|
||||
# For some reason, I can't get "yes y | " to parse correctly with eval. And Arch isn't smart enough
|
||||
# to figure out that if I enable the multilib repos, *I want multilib gcc*. Fuck it. We'll just remove it first.
|
||||
|
||||
pacman -S --needed --noconfirm haveged >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
haveged
|
||||
|
||||
set +e
|
||||
for pkg_override in gcc gcc-libs;
|
||||
do
|
||||
pacman -Q ${pkg_override} >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
if [[ "${?}" == "0" ]];
|
||||
then
|
||||
pacman -Rdd --noconfirm ${pkg_override} >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
fi
|
||||
done
|
||||
set -e
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
../Arch/pkgs
|
||||
@@ -1,27 +0,0 @@
|
||||
NAME='Arch'
|
||||
SUPPORTED='yes'
|
||||
CHECK_METHOD='egrep "^NAME=\"Arch Linux\"$" /etc/os-release'
|
||||
PKG_MGR='pacman -S --needed --noconfirm ${pkgname}'
|
||||
PRE_RUN='pacman -Syyy'
|
||||
PKG_CHK='pacman -Q ${pkgname}'
|
||||
URL='https://www.archlinux.org/'
|
||||
|
||||
function distro_specific_tweaks {
|
||||
# For some reason, I can't get "yes y | " to parse correctly with eval. And Arch isn't smart enough
|
||||
# to figure out that if I enable the multilib repos, *I want multilib gcc*. Fuck it. We'll just remove it first.
|
||||
|
||||
pacman -S --needed --noconfirm haveged >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
haveged
|
||||
|
||||
set +e
|
||||
for pkg_override in gcc gcc-libs;
|
||||
do
|
||||
pacman -Q ${pkg_override} >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
if [[ "${?}" == "0" ]];
|
||||
then
|
||||
pacman -Rdd --noconfirm ${pkg_override} >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
fi
|
||||
done
|
||||
set -e
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
binutils
|
||||
curl
|
||||
dosfstools
|
||||
findutils
|
||||
gcc-libs-multilib
|
||||
gcc-multilib
|
||||
git
|
||||
libisoburn
|
||||
lynx
|
||||
make
|
||||
mtools
|
||||
patch
|
||||
perl
|
||||
rsync
|
||||
sed
|
||||
squashfs-tools
|
||||
syslinux
|
||||
xz
|
||||
zlib
|
||||
@@ -1,17 +0,0 @@
|
||||
NAME='CentOS'
|
||||
# Currently fails on installing software *inside* the chroot. Will troubleshoot and restore when figured out.
|
||||
SUPPORTED='yes'
|
||||
CHECK_METHOD='egrep "^CentOS" /etc/redhat-release'
|
||||
PKG_MGR='yum -y install ${pkgname}'
|
||||
PRE_RUN='none'
|
||||
PKG_CHK='rpm -q ${pkgname} | egrep "^${pkgname}-[0-9]"'
|
||||
URL='http://centos.org/'
|
||||
|
||||
function distro_specific_tweaks {
|
||||
# NOTE: we handle installing of squashfs-tools (maybe) and xorriso in centos_is_stupid function.
|
||||
# because they *suck*. Seriously. I need to install tk just to install xorriso. I mean, what?
|
||||
# You need EPEL enabled, by the way.
|
||||
|
||||
echo "No tweaks found."
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
../RHEL/pkgs
|
||||
@@ -1,13 +0,0 @@
|
||||
NAME='Debian'
|
||||
SUPPORTED='yes'
|
||||
CHECK_METHOD='egrep "^NAME=\"Debian\ GNU/Linux\"$" /etc/os-release'
|
||||
PKG_MGR='apt-get -y install ${pkgname}'
|
||||
PRE_RUN='apt-get update'
|
||||
PKG_CHK='dpkg-query -l ${pkgname} | egrep "^ii[[:space:]]*${pkgname}"'
|
||||
URL='http://www.debian.org/'
|
||||
|
||||
function distro_specific_tweaks {
|
||||
|
||||
echo "No tweaks found."
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
binutils
|
||||
binutils-dev
|
||||
curl
|
||||
dosfstools
|
||||
gcc
|
||||
gcc-multilib
|
||||
git
|
||||
isolinux
|
||||
libiberty-dev
|
||||
libisoburn1
|
||||
lynx
|
||||
liblzma5
|
||||
liblzma-dev
|
||||
make
|
||||
mtools
|
||||
patch
|
||||
perl
|
||||
rsync
|
||||
sed
|
||||
squashfs-tools
|
||||
syslinux
|
||||
syslinux-efi
|
||||
xorriso
|
||||
xz-utils
|
||||
zlib1g
|
||||
zlib1g-dev
|
||||
@@ -1,14 +0,0 @@
|
||||
NAME='Devuan'
|
||||
SUPPORTED='no'
|
||||
CHECK_METHOD='egrep "^NAME=\"Devuan\ GNU/Linux\"$" /etc/os-release'
|
||||
PKG_MGR='apt-get -y install ${pkgname}'
|
||||
PRE_RUN='apt-get update'
|
||||
PKG_CHK='dpkg-query -l ${pkgname} | egrep "^ii[[:space:]]*${pkgname}"'
|
||||
URL='http://www.debian.org/'
|
||||
|
||||
function distro_specific_tweaks {
|
||||
|
||||
echo "No tweaks found."
|
||||
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../Debian/pkgs
|
||||
@@ -1,14 +0,0 @@
|
||||
NAME='Fedora'
|
||||
SUPPORTED='yes'
|
||||
CHECK_METHOD='egrep '^Fedora' /etc/redhat-release'
|
||||
PKG_MGR='dnf -y install ${pkgname}'
|
||||
PRE_RUN='none'
|
||||
PKG_CHK='rpm -q ${pkgname} | egrep "^${pkgname}-[0-9]"'
|
||||
URL='https://getfedora.org/'
|
||||
|
||||
function distro_specific_tweaks {
|
||||
|
||||
echo "No tweaks found."
|
||||
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
binutils
|
||||
binutils-devel
|
||||
curl
|
||||
dosfstools
|
||||
gcc
|
||||
git
|
||||
libisofs
|
||||
lynx
|
||||
make
|
||||
mtools
|
||||
patch
|
||||
perl
|
||||
rsync
|
||||
sed
|
||||
squashfs-tools
|
||||
syslinux
|
||||
syslinux-devel
|
||||
tar
|
||||
xorriso
|
||||
xz
|
||||
xz-devel
|
||||
zlib
|
||||
zlib-devel
|
||||
@@ -1,20 +0,0 @@
|
||||
NAME='Gentoo'
|
||||
SUPPORTED='yes'
|
||||
CHECK_METHOD='egrep "^Gentoo\ Base\ System" /etc/gentoo-release'
|
||||
PKG_MGR='emerge -q1Dn ${pkgname}'
|
||||
PRE_RUN='emerge -q --sync'
|
||||
PKG_CHK='emerge -qp @installed 2>/dev/null | egrep -E "/${pkgname}-[0-9.]+"'
|
||||
URL='https://www.gentoo.org/'
|
||||
|
||||
function distro_specific_tweaks {
|
||||
# WHY IS THIS EVEN MASKED?!
|
||||
|
||||
set +e
|
||||
grep -q 'app-arch/lzma' /etc/portage/package.accept_keywords
|
||||
if [[ "${?}" != "0" ]];
|
||||
then
|
||||
echo 'app-arch/lzma' >> /etc/portage/package.accept_keywords
|
||||
fi
|
||||
set -e
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
sys-devel/binutils
|
||||
net-misc/curl
|
||||
sys-fs/dosfstools
|
||||
sys-devel/gcc
|
||||
dev-vcs/git
|
||||
dev-libs/libisoburn
|
||||
www-client/lynx
|
||||
app-arch/lzma
|
||||
sys-devel/make
|
||||
sys-fs/mtools
|
||||
sys-devel/patch
|
||||
dev-lang/perl
|
||||
net-misc/rsync
|
||||
sys-apps/sed
|
||||
sys-fs/squashfs-tools
|
||||
sys-boot/syslinux
|
||||
app-arch/xz-utils
|
||||
sys-libs/zlib
|
||||
@@ -1,19 +0,0 @@
|
||||
This directory is used to enable cross-distro support and set baseline ISO packages needed for it to boot. A list of packages is needed for the *host* to build the ISO as well, which you'll find detailed below. Adding distro support is easy; there simply needs to be the following added:
|
||||
|
||||
<basedir>/lib/prereqs/<Distro>/{meta,pkgs}
|
||||
|
||||
"pkgs" should contain a list of the specific package names needed to install for that specific distro (as this isn't always standardized).
|
||||
|
||||
"meta" is a file consisting of the following variables (enclosed in single or double quotes, please:
|
||||
|
||||
NAME=<Distro - this should match the name of the directory this file is in!>
|
||||
SUPPORTED=<yes or no- yes by default>
|
||||
CHECK_METHOD=<a command that will be run that should return '0' (success) on *only* this specific distro
|
||||
(or fully compatible derivatives, i.e. CentOS/RHEL)>
|
||||
PKG_MGR=<a command used to prefix installation of packages e.g. for RHEL, "yum -y install">
|
||||
PRE_RUN=<a command to be run before PKG_MGR (e.g. on Ubuntu, "apt-get update"). commonly used to update package caches/metadata.
|
||||
if your distro does not require this, set PRE_RUN=none >
|
||||
PKG_CHK=<a command that will be run that should return '0' (success) *only* if any given package in the pkgs file is installed. e.g. for RHEL, "rpm -q">
|
||||
URL=<the URL for the distro. optional, as it isn't really used as any active part of the scripts- at least not presently.>
|
||||
|
||||
Oh- and your distro *must be able to install the package*. That means if you need to enable/add additional repositories, be sure to do so ahead of time.
|
||||
@@ -1,14 +0,0 @@
|
||||
NAME='Mageia'
|
||||
SUPPORTED='yes'
|
||||
CHECK_METHOD='egrep "^Mageia\ release\ " /etc/mageia-release'
|
||||
PKG_MGR='urpmi --force --auto ${pkgname}'
|
||||
PRE_RUN='urpmi.update -a'
|
||||
PKG_CHK='rpm -q ${pkgname} | egrep "^${pkgname}-[0-9]"'
|
||||
URL='https://www.mageia.org/'
|
||||
|
||||
function distro_specific_tweaks {
|
||||
|
||||
echo "No tweaks found."
|
||||
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
binutils
|
||||
binutils-devel
|
||||
curl
|
||||
gcc
|
||||
git
|
||||
lib64isofs6
|
||||
lib64apr1_0
|
||||
lib64apr-util1_0
|
||||
lib64lzma5
|
||||
lib64lzma-devel
|
||||
lib64lzmalib1
|
||||
lib64lzmalib-devel
|
||||
libstdc++-devel
|
||||
lynx
|
||||
make
|
||||
mtools
|
||||
patch
|
||||
perl
|
||||
rsync
|
||||
sed
|
||||
squashfs-tools
|
||||
syslinux
|
||||
syslinux-devel
|
||||
xorriso
|
||||
xz
|
||||
zlib
|
||||
zlib-devel
|
||||
@@ -1,28 +0,0 @@
|
||||
NAME='Manjaro'
|
||||
SUPPORTED='yes'
|
||||
CHECK_METHOD='egrep "^NAME=\"Manjaro Linux\"$" /etc/os-release'
|
||||
PKG_MGR='pacman -S --needed --noconfirm ${pkgname}'
|
||||
PRE_RUN='pacman -Syyy --noconfirm'
|
||||
PKG_CHK='pacman -Q ${pkgname}'
|
||||
URL='https://manjaro.org/'
|
||||
|
||||
function distro_specific_tweaks {
|
||||
# For some reason, I can't get "yes y | " to parse correctly with eval. And Arch isn't smart enough
|
||||
# to figure out that if I enable the multilib repos, *I want multilib gcc*. Fuck it. We'll just remove it first.
|
||||
|
||||
pacman -S --needed --noconfirm haveged >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
haveged
|
||||
|
||||
set +e
|
||||
for pkg_override in gcc gcc-libs;
|
||||
do
|
||||
pacman -Q ${pkg_override} >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
if [[ "${?}" == "0" ]];
|
||||
then
|
||||
pacman -Rdd --noconfirm ${pkg_override} >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
pacman -S --noconfirm ${pkg_override}-multilib >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||
fi
|
||||
done
|
||||
set -e
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
../Arch/pkgs
|
||||
@@ -1,14 +0,0 @@
|
||||
NAME='Mint'
|
||||
SUPPORTED='no'
|
||||
# Needs non-systemd chroot method
|
||||
CHECK_METHOD='egrep "^DESCRIPTION=\"Linux\ Mint" /etc/linuxmint/info'
|
||||
PKG_MGR='apt-get -y install ${pkgname}'
|
||||
PRE_RUN='apt-get -y update'
|
||||
PKG_CHK='dpkg-query -l ${pkgname}'
|
||||
URL='http://www.linuxmint.com/'
|
||||
|
||||
function distro_specific_tweaks {
|
||||
|
||||
echo "No tweaks found."
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
../Ubuntu/pkgs
|
||||
@@ -1,15 +0,0 @@
|
||||
NAME='RHEL'
|
||||
SUPPORTED='yes'
|
||||
# Red Hat Enterprise Linux Server release 6.5 (Santiago)
|
||||
CHECK_METHOD='egrep "^Red\ Hat\ Enterprise\ Linux" /etc/redhat-release'
|
||||
PKG_MGR='yum -y install'
|
||||
PRE_RUN='none'
|
||||
PKG_CHK='rpm -q ${pkgname} | egrep "^${pkgname}-[0-9]"'
|
||||
URL='http://www.redhat.com/en/technologies/linux-platforms/enterprise-linux'
|
||||
|
||||
function distro_specific_tweaks {
|
||||
|
||||
echo "No tweaks found."
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
binutils
|
||||
binutils-devel
|
||||
curl
|
||||
dosfstools
|
||||
gcc
|
||||
git
|
||||
libisofs
|
||||
lynx
|
||||
make
|
||||
mtools
|
||||
patch
|
||||
perl
|
||||
rsync
|
||||
sed
|
||||
squashfs-tools
|
||||
syslinux
|
||||
syslinux-devel
|
||||
xz
|
||||
xz-devel
|
||||
zlib
|
||||
zlib-devel
|
||||
@@ -1,16 +0,0 @@
|
||||
NAME='SUSE'
|
||||
SUPPORTED='yes'
|
||||
# Both SLED and SLES. We can probably safely combine them.
|
||||
CHECK_METHOD='egrep "^NAME=\"SLE(D|S)\"$" /etc/os-release'
|
||||
PKG_MGR='zypper install --no-confirm -l ${pkgname}'
|
||||
PRE_RUN='zypper refresh'
|
||||
PKG_CHK='rpm -q ${pkgname} | egrep "^${pkgname}-[0-9]"'
|
||||
URL='https://www.suse.com/'
|
||||
|
||||
function distro_specific_tweaks {
|
||||
# See the centos_is_stupid function. we do some tweaks there since -devel pkgs require the SDK on SLES/SLED.
|
||||
|
||||
echo "No tweaks found."
|
||||
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../openSUSE/pkgs
|
||||
@@ -1,14 +0,0 @@
|
||||
NAME='Ubuntu'
|
||||
SUPPORTED='yes'
|
||||
CHECK_METHOD='egrep "^DISTRIB_ID=Ubuntu$" /etc/lsb-release'
|
||||
PKG_MGR='apt-get -y install ${pkgname}'
|
||||
PRE_RUN='apt-get -y update'
|
||||
PKG_CHK='dpkg-query -l ${pkgname} | egrep "^ii[[:space:]]*${pkgname}"'
|
||||
URL='http://www.ubuntu.com/'
|
||||
|
||||
function distro_specific_tweaks {
|
||||
|
||||
echo "No tweaks found."
|
||||
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
binutils
|
||||
binutils-dev
|
||||
curl
|
||||
dosfstools
|
||||
gcc
|
||||
gcc-multilib
|
||||
git
|
||||
isolinux
|
||||
libiberty-dev
|
||||
libisoburn1
|
||||
lynx
|
||||
liblzma5
|
||||
liblzma-dev
|
||||
make
|
||||
mtools
|
||||
patch
|
||||
perl
|
||||
rsync
|
||||
sed
|
||||
squashfs-tools
|
||||
syslinux
|
||||
xorriso
|
||||
xz-utils
|
||||
zlib1g
|
||||
zlib1g-dev
|
||||
@@ -1,14 +0,0 @@
|
||||
NAME='elementaryOS'
|
||||
SUPPORTED='no'
|
||||
CHECK_METHOD='egrep "^DISTRIB_ID=\"elementary OS\"$" /etc/lsb-release'
|
||||
PKG_MGR='apt-get -y install ${pkgname}'
|
||||
PRE_RUN='apt-get -y update'
|
||||
PKG_CHK='dpkg-query -l ${pkgname} | egrep "^ii[[:space:]]*${pkgname}"'
|
||||
URL='https://elementary.io/'
|
||||
|
||||
function distro_specific_tweaks {
|
||||
|
||||
echo "No tweaks found."
|
||||
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../Ubuntu/pkgs
|
||||
@@ -1,39 +0,0 @@
|
||||
arch-install-scripts
|
||||
archiso
|
||||
bzip2
|
||||
coreutils
|
||||
cronie
|
||||
dhclient
|
||||
dhcp
|
||||
dhcpcd
|
||||
dosfstools
|
||||
efibootmgr
|
||||
efitools
|
||||
efivar
|
||||
ethtool
|
||||
file
|
||||
findutils
|
||||
iproute2
|
||||
iputils
|
||||
libisoburn
|
||||
localepurge
|
||||
lz4
|
||||
lzo
|
||||
lzop
|
||||
mkinitcpio-nfs-utils
|
||||
ms-sys
|
||||
mtools
|
||||
net-tools
|
||||
netctl
|
||||
networkmanager
|
||||
openssh
|
||||
openvpn
|
||||
pv
|
||||
rsync
|
||||
sed
|
||||
shorewall
|
||||
squashfs-tools
|
||||
sudo
|
||||
sysfsutils
|
||||
syslinux
|
||||
traceroute
|
||||
@@ -1 +0,0 @@
|
||||
# This can be used for 32-bit only packages
|
||||
@@ -1 +0,0 @@
|
||||
# This can be used for 64-bit only packages
|
||||
@@ -1,15 +0,0 @@
|
||||
NAME='openSUSE'
|
||||
SUPPORTED='yes'
|
||||
# Default doesn't have the quotes around the value, but I have a feeling that's a bug that will get "fixed" soon.
|
||||
CHECK_METHOD='egrep "^NAME=\"?openSUSE\"?$" /etc/os-release'
|
||||
PKG_MGR='zypper install --no-confirm -l ${pkgname}'
|
||||
PRE_RUN='zypper refresh'
|
||||
PKG_CHK='rpm -q ${pkgname} | egrep "^${pkgname}-[0-9]"'
|
||||
URL='https://www.opensuse.org/'
|
||||
|
||||
function distro_specific_tweaks {
|
||||
|
||||
echo "No tweaks found."
|
||||
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
binutils
|
||||
binutils-devel
|
||||
binutils-devel-32bit
|
||||
curl
|
||||
dosfstools
|
||||
gcc
|
||||
gcc-32bit
|
||||
git
|
||||
libisoburn1
|
||||
libisofs6
|
||||
lynx
|
||||
make
|
||||
mtools
|
||||
patch
|
||||
perl
|
||||
rsync
|
||||
sed
|
||||
squashfs
|
||||
syslinux
|
||||
xz
|
||||
xz-devel
|
||||
xz-devel-32bit
|
||||
2
src/ipxe
2
src/ipxe
Submodule src/ipxe updated: 827dd1bfee...0a4805bf94
@@ -1,8 +1,6 @@
|
||||
diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c
|
||||
index e93b015..758e187 100644
|
||||
--- a/src/usr/autoboot.c
|
||||
+++ b/src/usr/autoboot.c
|
||||
@@ -71,6 +71,7 @@ static int ( * is_autoboot_device ) ( struct net_device *netdev );
|
||||
--- a/src/usr/autoboot.c 2015-06-29 04:18:17.055394598 -0400
|
||||
+++ b/src/usr/autoboot.c 2015-06-29 22:04:28.692916217 -0400
|
||||
@@ -71,6 +71,7 @@
|
||||
#define NORMAL "\033[0m"
|
||||
#define BOLD "\033[1m"
|
||||
#define CYAN "\033[36m"
|
||||
@@ -10,27 +8,16 @@ index e93b015..758e187 100644
|
||||
|
||||
/** The "scriptlet" setting */
|
||||
const struct setting scriptlet_setting __setting ( SETTING_MISC, scriptlet ) = {
|
||||
@@ -521,7 +522,6 @@ static int shell_banner ( void ) {
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
int ipxe ( struct net_device *netdev ) {
|
||||
- struct feature *feature;
|
||||
struct image *image;
|
||||
char *scriptlet;
|
||||
int rc;
|
||||
@@ -538,11 +538,11 @@ int ipxe ( struct net_device *netdev ) {
|
||||
@@ -560,9 +561,9 @@
|
||||
* do so.
|
||||
*
|
||||
*/
|
||||
- printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD PRODUCT_SHORT_NAME " %s"
|
||||
+ printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD PRODUCT_SHORT_NAME
|
||||
NORMAL " -- " PRODUCT_TAG_LINE " -- "
|
||||
- NORMAL " -- " PRODUCT_TAG_LINE " -- "
|
||||
- CYAN PRODUCT_URI NORMAL "\nFeatures:", product_version );
|
||||
- for_each_table_entry ( feature, FEATURES )
|
||||
- printf ( " %s", feature->name );
|
||||
+ CYAN PRODUCT_URI NORMAL "\n"
|
||||
+ BOLD "BDisk" BLUE "LiveDistro" NORMAL " -- Welp, Yer Boned!(TM) -- "
|
||||
+ BOLD BLUE "https://bdisk.square-r00t.net/" NORMAL "\n" );
|
||||
+ printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD PRODUCT_SHORT_NAME
|
||||
+ CYAN PRODUCT_URI NORMAL "\n"
|
||||
+ BOLD BLUE "http://bdisk.square-r00t.net/" NORMAL "\n" );
|
||||
for_each_table_entry ( feature, FEATURES )
|
||||
printf ( " %s", feature->name );
|
||||
printf ( "\n" );
|
||||
|
||||
/* Boot system */
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
From 189652b03032305a2db860e76fb58e81e3420c4d Mon Sep 17 00:00:00 2001
|
||||
From d2092664b3cf866b2ab338fe056149d3266d0acc Mon Sep 17 00:00:00 2001
|
||||
From: Christian Hesse <mail@eworm.de>
|
||||
Date: Wed, 24 Feb 2016 09:16:51 +0100
|
||||
Subject: [PATCH] allow to build ISO image with EFI support (ipxe.eiso)
|
||||
Date: Sun, 19 Apr 2015 13:16:09 +0200
|
||||
Subject: [PATCH 1/1] allow to build ISO image with EFI support (ipxe.eiso)
|
||||
|
||||
Signed-off-by: Christian Hesse <mail@eworm.de>
|
||||
---
|
||||
src/arch/x86/Makefile.pcbios | 6 +++++
|
||||
src/util/geniso | 52 ++++++++++++++++++++++++++++++++++----------
|
||||
src/arch/i386/Makefile.pcbios | 6 +++++
|
||||
src/util/geniso | 52 +++++++++++++++++++++++++++++++++----------
|
||||
2 files changed, 46 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/arch/x86/Makefile.pcbios b/src/arch/x86/Makefile.pcbios
|
||||
index f8c2253..1e01636 100644
|
||||
--- a/src/arch/x86/Makefile.pcbios
|
||||
+++ b/src/arch/x86/Makefile.pcbios
|
||||
@@ -86,6 +86,12 @@ NON_AUTO_MEDIA += iso
|
||||
$(Q)ISOLINUX_BIN=$(ISOLINUX_BIN) LDLINUX_C32=$(LDLINUX_C32) \
|
||||
VERSION="$(VERSION)" bash util/geniso -o $@ $<
|
||||
diff --git a/src/arch/i386/Makefile.pcbios b/src/arch/i386/Makefile.pcbios
|
||||
index ff82373..c7a58eb 100644
|
||||
--- a/src/arch/i386/Makefile.pcbios
|
||||
+++ b/src/arch/i386/Makefile.pcbios
|
||||
@@ -59,6 +59,12 @@ NON_AUTO_MEDIA += iso
|
||||
$(QM)$(ECHO) " [GENISO] $@"
|
||||
$(Q)ISOLINUX_BIN=$(ISOLINUX_BIN) VERSION="$(VERSION)" bash util/geniso -o $@ $<
|
||||
|
||||
+# rule to make a non-emulation ISO boot image with EFI support
|
||||
+NON_AUTO_MEDIA += eiso
|
||||
+%eiso: %lkrn bin-i386-efi/ipxe.efi bin-x86_64-efi/ipxe.efi util/geniso
|
||||
+NON_AUTO_MEDIA += eiso
|
||||
+%eiso: %lkrn bin-i386-efi/ipxe.efi bin-x86_64-efi/ipxe.efi util/geniso
|
||||
+ $(QM)$(ECHO) " [GENISO] $@"
|
||||
+ $(Q)ISOLINUX_BIN=$(ISOLINUX_BIN) VERSION="$(VERSION)" bash util/geniso -e -o $@ $<
|
||||
+
|
||||
@@ -26,7 +27,7 @@ index f8c2253..1e01636 100644
|
||||
NON_AUTO_MEDIA += liso
|
||||
%liso: %lkrn util/geniso
|
||||
diff --git a/src/util/geniso b/src/util/geniso
|
||||
index ff090d4..7694036 100755
|
||||
index 521c929..9e8588c 100755
|
||||
--- a/src/util/geniso
|
||||
+++ b/src/util/geniso
|
||||
@@ -6,16 +6,21 @@ function help() {
|
||||
@@ -88,7 +89,7 @@ index ff090d4..7694036 100755
|
||||
fi
|
||||
|
||||
dir=$(mktemp -d bin/iso.dir.XXXXXX)
|
||||
@@ -122,13 +135,28 @@ case "${LEGACY}" in
|
||||
@@ -122,6 +135,21 @@ case "${LEGACY}" in
|
||||
# copy isolinux bootloader
|
||||
cp ${ISOLINUX_BIN} ${dir}
|
||||
|
||||
@@ -108,8 +109,9 @@ index ff090d4..7694036 100755
|
||||
+ fi
|
||||
+
|
||||
# syslinux 6.x needs a file called ldlinux.c32
|
||||
if [ -n "${LDLINUX_C32}" -a -s "${LDLINUX_C32}" ]; then
|
||||
cp ${LDLINUX_C32} ${dir}
|
||||
LDLINUX_C32=$(dirname ${ISOLINUX_BIN})/ldlinux.c32
|
||||
if [ -s ${LDLINUX_C32} ]; then
|
||||
@@ -129,7 +157,7 @@ case "${LEGACY}" in
|
||||
fi
|
||||
|
||||
# generate the iso image
|
||||
@@ -118,3 +120,6 @@ index ff090d4..7694036 100755
|
||||
|
||||
# isohybrid will be used if available
|
||||
if isohybrid --version >/dev/null 2>/dev/null; then
|
||||
--
|
||||
2.3.5
|
||||
|
||||
34
src/ipxe_local/patches/ipxe-0004-fix-no-pie-workaround.patch
Normal file
34
src/ipxe_local/patches/ipxe-0004-fix-no-pie-workaround.patch
Normal file
@@ -0,0 +1,34 @@
|
||||
From a4f7e3ba395af4cd0a706df635309d4ef837ecf8 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Hesse <mail@eworm.de>
|
||||
Date: Wed, 8 Apr 2015 09:51:41 +0200
|
||||
Subject: [PATCH 2/2] Fix no-PIE workaround for i386 builds
|
||||
|
||||
This workaround did not work for my version of gcc (4.9.2 20150304) as
|
||||
no option -nopie exists.
|
||||
|
||||
We take another way: Let's check whether or not the macro __PIE__ is defined
|
||||
and add -fno-PIE if it is.
|
||||
|
||||
Signed-off-by: Christian Hesse <mail@eworm.de>
|
||||
---
|
||||
src/arch/i386/Makefile | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/arch/i386/Makefile b/src/arch/i386/Makefile
|
||||
index 99f8753..897081b 100644
|
||||
--- a/src/arch/i386/Makefile
|
||||
+++ b/src/arch/i386/Makefile
|
||||
@@ -75,8 +75,8 @@ CFLAGS += -Ui386
|
||||
# output on stderr instead of checking the exit status.
|
||||
#
|
||||
ifeq ($(CCTYPE),gcc)
|
||||
-PIE_TEST = [ -z "`$(CC) -fno-PIE -nopie -x c -c /dev/null -o /dev/null 2>&1`" ]
|
||||
-PIE_FLAGS := $(shell $(PIE_TEST) && $(ECHO) '-fno-PIE -nopie')
|
||||
+PIE_TEST = $(CC) -dM -E - < /dev/null | grep -q '__PIE__'
|
||||
+PIE_FLAGS := $(shell $(PIE_TEST) && $(ECHO) '-fno-PIE')
|
||||
WORKAROUND_CFLAGS += $(PIE_FLAGS)
|
||||
endif
|
||||
|
||||
--
|
||||
2.3.5
|
||||
|
||||
Reference in New Issue
Block a user