initial commit
This commit is contained in:
commit
cf603e5265
25
.gitignore
vendored
Normal file
25
.gitignore
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# We don't want local build settings
|
||||||
|
/build.conf
|
||||||
|
|
||||||
|
# The chroots should be generated locally ONLY. The perms/ownership would get futzed up anyways if checked into git.
|
||||||
|
/root.x86_64
|
||||||
|
/root.i686
|
||||||
|
|
||||||
|
# We don't want the copied/stripped/compressed chroots
|
||||||
|
/build64
|
||||||
|
/build32
|
||||||
|
|
||||||
|
# We don't need these in git. They should be generated dynamically.
|
||||||
|
/http
|
||||||
|
/iso
|
||||||
|
/temp
|
||||||
|
/TMPBOOT
|
||||||
|
/tftpboot
|
||||||
|
/latest.64.tar.gz
|
||||||
|
/latest.32.tar.gz
|
||||||
|
/lockfile.lck
|
||||||
|
/VERSION_INFO.txt
|
||||||
|
/BUILDNO
|
||||||
|
/screenlog*
|
||||||
|
/logs
|
||||||
|
*.swp
|
142
README
Normal file
142
README
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
######################################################################################################################################
|
||||||
|
##### BDisk #####
|
||||||
|
##### #####
|
||||||
|
##### Written by Brent Saner #####
|
||||||
|
##### <bts@square-r00t.net> #####
|
||||||
|
##### Built upon my (Brent's) 'BDisk' ISO-building framework (http://bdisk.square-r00t.net) #####
|
||||||
|
######################################################################################################################################
|
||||||
|
|
||||||
|
## Why Arch? ##
|
||||||
|
Because it's a largely easy-to-use, well-documented (https://wiki.archlinux.org/) distro. It's no-frills and incredibly
|
||||||
|
flexible/customizable, and can be made rather slim. It's also very friendly to run as a chroot inside any other distro.
|
||||||
|
|
||||||
|
All commands below should be issued in the root working directory of this git repository. (For me, this is
|
||||||
|
/opt/dev/work/BDisk but this may be entirely different for you, depending on where you cloned the repository to.)
|
||||||
|
|
||||||
|
!!!!!! WARNING !!!!!!!
|
||||||
|
I do NOT recommend running this on a machine that is using wireless, as it will download a LOT of data.
|
||||||
|
If you ignore this warning, be prepared to explain to anyone you share your wifi with why Facebook takes 20 seconds to load,
|
||||||
|
because they WILL ask.
|
||||||
|
|
||||||
|
It should be fine over ethernet, since hardware switches are much faster and efficient than a single duplex wireless radio.
|
||||||
|
|
||||||
|
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).
|
||||||
|
Till then, sorry for the inconvenience.
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
## Prerequisites ##
|
||||||
|
-At least ~20Gb disk space free (remember, you need room for not only four chroots (one developing and one staging for i686/x86_64),
|
||||||
|
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)
|
||||||
|
|
||||||
|
curl
|
||||||
|
dosfstools
|
||||||
|
libisoburn ("libisofs" on CentOS)
|
||||||
|
lynx
|
||||||
|
rsync
|
||||||
|
sed
|
||||||
|
squashfs-tools
|
||||||
|
xorriso (in RPMForge repo for CentOS 7)
|
||||||
|
xz
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
## (Re)Building ##
|
||||||
|
$ sudo bin/build.sh
|
||||||
|
|
||||||
|
Yeah. It's that easy. The finished product is in iso/.
|
||||||
|
|
||||||
|
Build output should look something like this:
|
||||||
|
|
||||||
|
|
||||||
|
[root@dawid BDisk]# time nice -n "-19" bin/build.sh
|
||||||
|
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
|
||||||
|
For now, though, I am copying over the default.
|
||||||
|
Checking directory structure and creating lockfile at /opt/dev/work/BDisk/lockfile.lck...
|
||||||
|
/opt/dev/work/BDisk/root.i686 does not exist - creating.
|
||||||
|
/opt/dev/work/BDisk/root.x86_64 does not exist - creating.
|
||||||
|
/opt/dev/work/BDisk/build32 does not exist - creating.
|
||||||
|
/opt/dev/work/BDisk/build64 does not exist - creating.
|
||||||
|
/opt/dev/work/BDisk/iso does not exist - creating.
|
||||||
|
/opt/dev/work/BDisk/temp/bdisk does not exist - creating.
|
||||||
|
/opt/dev/work/BDisk/temp/FPOS does not exist - creating.
|
||||||
|
/opt/dev/work/BDisk/src does not exist - creating.
|
||||||
|
/opt/dev/work/BDisk/tftpboot does not exist - creating.
|
||||||
|
/opt/dev/work/BDisk/http/FPOS does not exist - creating.
|
||||||
|
/opt/dev/work/BDisk/logs does not exist - creating.
|
||||||
|
No existing chroot environment found. Creating...
|
||||||
|
Now importing settings/variables.
|
||||||
|
Checking/fetching snapshots...
|
||||||
|
Extracting snapshots. This will take a while...
|
||||||
|
Configuring snapshots...
|
||||||
|
Initializing chroots...
|
||||||
|
Prepping /opt/dev/work/BDisk/root.i686. This will take a while...
|
||||||
|
...Key initializing...Done.
|
||||||
|
...Importing keys...Done.
|
||||||
|
...Installing base packages...Done.
|
||||||
|
...Upgrading any outdated packages...Done. Finishing/cleaning up...
|
||||||
|
Prepping /opt/dev/work/BDisk/root.x86_64. This will take a while...
|
||||||
|
...Key initializing...Done.
|
||||||
|
...Importing keys...Done.
|
||||||
|
...Installing base packages...Done.
|
||||||
|
...Upgrading any outdated packages...Done. Finishing/cleaning up...
|
||||||
|
Installing common packages...
|
||||||
|
...Packages installing to /opt/dev/work/BDisk/root.i686...Compiling kernel sources...Regular packages......Creating bdisk user...Done.
|
||||||
|
Done.
|
||||||
|
...Packages installing to /opt/dev/work/BDisk/root.x86_64...Compiling kernel sources...Regular packages......Creating bdisk user...Done.
|
||||||
|
Done.
|
||||||
|
Installing packages for 32-bit...
|
||||||
|
Done.
|
||||||
|
Installing packages for 64-bit...
|
||||||
|
Done.
|
||||||
|
Syncing overlay...
|
||||||
|
Done.
|
||||||
|
Chroot setup complete.
|
||||||
|
Checking for appropriate kernel version and mksquashfs version...
|
||||||
|
Data is not sync'd to buildroot; syncing...
|
||||||
|
Syncing important files to /opt/dev/work/BDisk/build64 for building the squashed filesystem (this may take some time)...
|
||||||
|
Compressing the package DB...
|
||||||
|
cp: ‘/opt/dev/work/BDisk/build64/usr/share/zoneinfo/EST5EDT’ and ‘/opt/dev/work/BDisk/build64/etc/localtime’ are the same file
|
||||||
|
cp: ‘/opt/dev/work/BDisk/root.x86_64/usr/share/zoneinfo/EST5EDT’ and ‘/opt/dev/work/BDisk/root.x86_64/etc/localtime’ are the same file
|
||||||
|
Cleaning up unnecessary cruft in /opt/dev/work/BDisk/build64...
|
||||||
|
[64-bit] Now generating the squashed image (if we need to) and hashes. This may take some time.
|
||||||
|
[64-bit] Squashing filesystem. This can take a while depending on the size of your chroot(s).
|
||||||
|
[64-bit] Copying files for PXE, and ISO building, please be patient.
|
||||||
|
Data is not sync'd to buildroot; syncing...
|
||||||
|
Syncing important files to /opt/dev/work/BDisk/build32 for building the squashed filesystem (this may take some time)...
|
||||||
|
Compressing the package DB...
|
||||||
|
cp: ‘/opt/dev/work/BDisk/build32/usr/share/zoneinfo/EST5EDT’ and ‘/opt/dev/work/BDisk/build32/etc/localtime’ are the same file
|
||||||
|
cp: ‘/opt/dev/work/BDisk/root.i686/usr/share/zoneinfo/EST5EDT’ and ‘/opt/dev/work/BDisk/root.i686/etc/localtime’ are the same file
|
||||||
|
Cleaning up unnecessary cruft in /opt/dev/work/BDisk/build32...
|
||||||
|
[32-bit] Now generating the squashed image (if we need to) and hashes. This may take some time.
|
||||||
|
[32-bit] Squashing filesystem. This can take a while depending on the size of your chroot(s).
|
||||||
|
[32-bit] Copying files for PXE, and ISO building, please be patient.
|
||||||
|
Building the actual .iso image. This may take a while.
|
||||||
|
Setting up EFI stuff...
|
||||||
|
Checking/fetching UEFI shells...
|
||||||
|
Generating the EFI embedded FAT filesystem...
|
||||||
|
EFI configuration complete...
|
||||||
|
ISO generated; size is 1.3G.
|
||||||
|
You can find it at /opt/dev/work/BDisk/iso/bdisk-v1.04-a8666bd-any.iso
|
||||||
|
Cleaning up some stuff leftover from the build...
|
||||||
|
Finished successfully!
|
||||||
|
|
||||||
|
real 250m48.104s
|
||||||
|
user 163m6.046s
|
||||||
|
sys 8m26.573s
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If you want more verbosity, check out the logs/ directory.
|
38
TODO
Normal file
38
TODO
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
## General ##
|
||||||
|
|
||||||
|
-include WinMTR, build Mac OS X MTR for dist/tools on CD
|
||||||
|
|
||||||
|
|
||||||
|
## NETWORKING ##
|
||||||
|
|
||||||
|
-shorewall/some other firewall?
|
||||||
|
-WISH: locked-down VPN?
|
||||||
|
-autodetection/configuration of network. DHCP is currently running by default, but does it need to support IPv6? if so, how would the user configure their network?
|
||||||
|
-WISH: support iPXE? would save on ISO file size (letting us create MUCH bigger squash systems), but the downside is we lose EFI support and it requires a working network configuration- which defeats the purpose of a diagnostic disc.
|
||||||
|
|
||||||
|
|
||||||
|
## Building ##
|
||||||
|
|
||||||
|
-WISH: Better logging[0]
|
||||||
|
-use manual chrooting functions ONLY if distro not detected as arch. if /usr/bin/systemd-nspawn exists, use that instead
|
||||||
|
--does arch-chroot work across all distros? see https://wiki.archlinux.org/index.php/Install_bundled_32-bit_system_in_Arch64 and https://wiki.archlinux.org/index.php/Chroot
|
||||||
|
--i think this might be unnecessary. testing across other major distros is necessary, but i think i can just use the chroot'd arch-chroot
|
||||||
|
-tweak build.conf (and build.conf.sample) to source the pwd and set as BASEDIR ***if*** the project resources are present in pwd, otherwise throw warning
|
||||||
|
--this is half-done;PWD is currently used by default.
|
||||||
|
-does gummiboot? loader? wtfever it's called support splash backgrounds? can i implement that differently somehow?
|
||||||
|
-Host-specific chroot customizations (i.e. -J in <chroot>/etc/makepkg.conf
|
||||||
|
-strip out/remove unnecessary and orphan packages (e.g. gcc, make, automake, etc.)
|
||||||
|
|
||||||
|
__________________________________________________________
|
||||||
|
FOOTNOTES:
|
||||||
|
|
||||||
|
|
||||||
|
[0] I'd really like to implement the following in build.conf; like:
|
||||||
|
http://forums.fedoraforum.org/showthread.php?t=275743
|
||||||
|
# The following is the setting for "verbosity". A more accurate way of saying it is how output should be handled.
|
||||||
|
# Note that for it to be properly parsed, it MUST be in the form of a linear array (e.g. VAR=(1 2 3) ).
|
||||||
|
# '| tee -a ${BASEDIR}/logs/${FUNCNAME}.$(date +%s)' means "display output for STDOUT and STDERR, and also log STDOUT to logs/<function name>.EPOCH_TIME"
|
||||||
|
# '2>&1 /dev/null' means "hide STDOUT and STDERR, no logging"
|
||||||
|
# '>> ${BASEDIR}/logs/${FUNCNAME}.$(date +%s) 2>&1' means "log both STDOUT and STDERR to logs/<function name>.EPOCH_TIME, no output"
|
||||||
|
# '>> ${BASEDIR}/logs/${FUNCNAME}.$(date +%s)' means "log STDOUT to logs/<function name>.EPOCH_TIME, display (but don't log) STDERR)"
|
||||||
|
# '' means "no logging; display both STDOUT and STDERR"
|
197
bin/build.sh
Executable file
197
bin/build.sh
Executable file
@ -0,0 +1,197 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
## 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 ${ROOTDIR} ${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
|
||||||
|
|
||||||
|
if [ ! -f "./BUILDNO" ];
|
||||||
|
then
|
||||||
|
echo '0' > ./BUILDNO
|
||||||
|
fi
|
||||||
|
|
||||||
|
CHROOTDIR_GLOB="${CHROOTDIR}"
|
||||||
|
BUILDDIR_GLOB="${BUILDDIR}"
|
||||||
|
|
||||||
|
# Set the version.
|
||||||
|
VERSION="$(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)"
|
||||||
|
#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 > VERSION_INFO.txt << EOF
|
||||||
|
Version: ${VERSION}
|
||||||
|
Build: ${BUILD}
|
||||||
|
Time: ${BUILDTIME}
|
||||||
|
Machine: ${BUILD_MACHINE}
|
||||||
|
User: ${BUILD_USERNAME} (${USERNAME_REAL})
|
||||||
|
EOF
|
||||||
|
|
||||||
|
## FUNCTIONS ##
|
||||||
|
|
||||||
|
source lib/00-im_batman.func.sh
|
||||||
|
source lib/01-holla_atcha_boi.func.sh
|
||||||
|
source lib/02-release_me.func.sh
|
||||||
|
source lib/03-facehugger.func.sh
|
||||||
|
source lib/04-chroot_wrapper.func.sh
|
||||||
|
source lib/05-jenny_craig.func.sh
|
||||||
|
source lib/06-centos_is_stupid.func.sh
|
||||||
|
source lib/07-will_it_blend.func.sh
|
||||||
|
source lib/08-stuffy.func.sh
|
||||||
|
source lib/09-yo_dj.func.sh
|
||||||
|
source lib/10-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 [[ -f "${CHROOTDIR}root.x86_64/root/chroot" || -f "${CHROOTDIR}root.i686/root/chroot" ]];
|
||||||
|
then
|
||||||
|
chroot_wrapper 64
|
||||||
|
chroot_wrapper 32
|
||||||
|
centos_is_stupid
|
||||||
|
will_it_blend 64
|
||||||
|
will_it_blend 32
|
||||||
|
yo_dj
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
# 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 ${ROOTDIR}
|
||||||
|
|
||||||
|
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!"
|
84
bin/clean.sh
Executable file
84
bin/clean.sh
Executable file
@ -0,0 +1,84 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
## 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}
|
6
bin/mirror.lst.sh
Executable file
6
bin/mirror.lst.sh
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/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
|
BIN
extra/bdisk.png
Normal file
BIN
extra/bdisk.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 MiB |
BIN
extra/bdisk.png.xcf
Normal file
BIN
extra/bdisk.png.xcf
Normal file
Binary file not shown.
133
extra/build.conf.sample
Normal file
133
extra/build.conf.sample
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
#####################################################
|
||||||
|
## BUILD.CONF SAMPLE FILE ##
|
||||||
|
#####################################################
|
||||||
|
#
|
||||||
|
# This file is used to define various variables/settings used by the build script.
|
||||||
|
#
|
||||||
|
|
||||||
|
# This should be an alpha-numeric string less than 8 characters. No spaces, etc.
|
||||||
|
# Used for metainfo
|
||||||
|
DISTNAME="BDISK"
|
||||||
|
|
||||||
|
# This should be the lowercase format of ${DISTNAME} but it can be different.
|
||||||
|
# Used for filenames etc. so no spaces
|
||||||
|
UXNAME="bdisk"
|
||||||
|
|
||||||
|
# Used for "pretty-formatted" version of the project. It can contain spaces etc.
|
||||||
|
PNAME="BDisk"
|
||||||
|
|
||||||
|
# Your/your organization's name
|
||||||
|
DISTPUB="r00t^2"
|
||||||
|
|
||||||
|
# What's this distro used for?
|
||||||
|
DISTDESC="j00 got 0wnz0r3d lulz."
|
||||||
|
|
||||||
|
# This should be the directory of the root of the project, e.g. the git's project/working directory.
|
||||||
|
# This can be left as-is as long as you're running everything from the project directory root.
|
||||||
|
BASEDIR="$(pwd)"
|
||||||
|
|
||||||
|
# This is the output directory of the ISO files when done building. This also should not be checked into git.
|
||||||
|
ISODIR="${BASEDIR}/iso"
|
||||||
|
|
||||||
|
# Where source code is kept.
|
||||||
|
SRCDIR="${BASEDIR}/src"
|
||||||
|
|
||||||
|
# Where we mount for chroots etc.
|
||||||
|
MOUNTPT="/mnt/${UXNAME}"
|
||||||
|
|
||||||
|
# This is where an http webroot can be specified. Very useful for PXE setups
|
||||||
|
# (the resulting kernel/initrd can be set to boot from HTTP initiated by PXE).
|
||||||
|
# These files will be generated whether you use them or not, so it's recommended to keep this a sane path.
|
||||||
|
HTTPDIR="${BASEDIR}/http"
|
||||||
|
|
||||||
|
# This is the root for where tftp files should be put for PXE booting.
|
||||||
|
TFTPDIR="${BASEDIR}/tftpboot"
|
||||||
|
|
||||||
|
# This is the user and group your web daemon will use. The webroot is automatically chowned.
|
||||||
|
HTTPUSR="http"
|
||||||
|
HTTPGRP="http"
|
||||||
|
|
||||||
|
# This is the user and group that your tftp files should be chowned as.
|
||||||
|
TFTPUSR="root"
|
||||||
|
TFTPGRP="root"
|
||||||
|
|
||||||
|
# If set to "no", build separate ISOs for different hardware structures.
|
||||||
|
# E.g. a separate i686 and x86_64 ISO. Note that it's TOTALLY supported to
|
||||||
|
# build a dual-architecture ISO (and is the default), it's just that it tends to be over 700MB
|
||||||
|
# (and thus doesn't fit on a normal CD. Still fits on DVDs and USBs though!)
|
||||||
|
MULTIARCH="yes"
|
||||||
|
|
||||||
|
# set to "yes" to enable pushing new changes to a git repo/committing to a local repo
|
||||||
|
GIT="no"
|
||||||
|
|
||||||
|
# If this is set, use rsync to copy the http and iso files. This is the rsync destination host.
|
||||||
|
# This is *great* for iPXE.
|
||||||
|
RSYNC_HOST=""
|
||||||
|
|
||||||
|
# Only used if RSYNC_HOST is set. The destination directory on the destination host to copy files to.
|
||||||
|
RSYNC_DEST="${BASEDIR}"
|
||||||
|
|
||||||
|
# Where the log should go, and how it should be prefixed.
|
||||||
|
# Note that the code appends, rather than replaces, logs- hence the timestamp in EPOCH time format.
|
||||||
|
LOGFILE="${BASEDIR}/logs/$(date +%s)"
|
||||||
|
|
||||||
|
# What should the regular username be? (Automatically logged in on boot)
|
||||||
|
REGUSR="${UXNAME}"
|
||||||
|
|
||||||
|
# Do we have enough horsepower on the build system to jack up the resources we throw at building?
|
||||||
|
# Enabling this will give absolute CPU preference to building the kernels and do make-time
|
||||||
|
# enhancements/optimizations (i.e. use the maximum number of CPU cores detected).
|
||||||
|
# I wouldn't enable this unless you have a dedicated build-box that isn't running much else.
|
||||||
|
I_AM_A_RACECAR="no"
|
||||||
|
|
||||||
|
|
||||||
|
# ________________________________________________________________________________________________
|
||||||
|
## RECOMMENDED DEFALTS ##
|
||||||
|
# The following shoult not be changed unless you are ABSOLUTELY, 100% SURE and COMPLETELY POSITIVE
|
||||||
|
# about what you are doing!!!
|
||||||
|
|
||||||
|
# Legacy support.
|
||||||
|
ROOTDIR="${BASEDIR}"
|
||||||
|
|
||||||
|
# This used to be defined statically (e.g. CHROOTDIR="${ROOTDIR}/chroot"),
|
||||||
|
# but is now dynamically appended. Please don't alter this unless you renamed the chroot directory paths.
|
||||||
|
CHROOTDIR="${BASEDIR}/"
|
||||||
|
CHROOTDIR32="${CHROOTDIR}root.i686"
|
||||||
|
CHROOTDIR64="${CHROOTDIR}root.x86_64"
|
||||||
|
|
||||||
|
# This is a directory we use for staging. It definitely should not be checked into git.
|
||||||
|
# It used to be defined statically (e.g. BUILDDIR="${ROOTDIR}/build"),
|
||||||
|
# but is now dynamically appended. Please don't alter this unless you renamed the chroot directory paths.
|
||||||
|
BUILDDIR="${BASEDIR}/build"
|
||||||
|
|
||||||
|
# More staging.
|
||||||
|
TEMPDIR="${ROOTDIR}/temp"
|
||||||
|
|
||||||
|
# This is where we stage the boot files.
|
||||||
|
ARCHBOOT="${TEMPDIR}/${DISTNAME}"
|
||||||
|
|
||||||
|
# Lockfile for checking for concurrent/failed builds
|
||||||
|
LOCKFILE="${ROOTDIR}/lockfile.lck"
|
||||||
|
|
||||||
|
|
||||||
|
## VARIABLE PROCESSING ##
|
||||||
|
# In order to make cleaner code, we need to make sure we can standardize some input.
|
||||||
|
# Don't even think about touching these unless you know what you're doing.
|
||||||
|
|
||||||
|
# MULTIARCH
|
||||||
|
if [ -z "${MULTIARCH}" ];
|
||||||
|
then
|
||||||
|
MULTIARCH="y"
|
||||||
|
fi
|
||||||
|
|
||||||
|
MULTIARCH=${MULTIARCH:0:1}
|
||||||
|
MULTIARCH=$(echo ${MULTIARCH} | tr [[:upper:]] [[:lower:]])
|
||||||
|
|
||||||
|
# OPTIMIZATIONS?
|
||||||
|
if [ -z "${I_AM_A_RACECAR}" ];
|
||||||
|
then
|
||||||
|
I_AM_A_RACECAR="n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
I_AM_A_RACECAR=${I_AM_A_RACECAR:0:1}
|
||||||
|
I_AM_A_RACECAR=$(echo ${I_AM_A_RACECAR} | tr [[:upper:]] [[:lower:]])
|
7
extra/mirrorlist
Normal file
7
extra/mirrorlist
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# 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
|
0
extra/packages.32
Normal file
0
extra/packages.32
Normal file
0
extra/packages.64
Normal file
0
extra/packages.64
Normal file
104
extra/packages.both
Normal file
104
extra/packages.both
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
# You can include comments, such as this. AUR packages are allowed.
|
||||||
|
# We need to install all X drivers.
|
||||||
|
abs
|
||||||
|
acpidump
|
||||||
|
arch-install-scripts
|
||||||
|
archiso
|
||||||
|
bridge-utils
|
||||||
|
#cryptcat
|
||||||
|
customizepkg-scripting
|
||||||
|
dhclient
|
||||||
|
dhcpcd
|
||||||
|
dialog
|
||||||
|
dmidecode
|
||||||
|
dnstracer
|
||||||
|
dnsutils
|
||||||
|
dos2unix
|
||||||
|
dosfstools
|
||||||
|
dropbear
|
||||||
|
dvd+rw-tools
|
||||||
|
elinks
|
||||||
|
ethtool
|
||||||
|
exfat-utils
|
||||||
|
findutils
|
||||||
|
firefox
|
||||||
|
gnu-netcat
|
||||||
|
google-chrome-beta
|
||||||
|
gummiboot
|
||||||
|
httping
|
||||||
|
hwdetect
|
||||||
|
hwinfo
|
||||||
|
idnkit
|
||||||
|
ifenslave
|
||||||
|
iftop
|
||||||
|
inetutils
|
||||||
|
ipcalc
|
||||||
|
iperf
|
||||||
|
iproute2
|
||||||
|
ipsec-tools
|
||||||
|
iptraf-ng
|
||||||
|
iputils
|
||||||
|
irssi
|
||||||
|
links
|
||||||
|
localepurge
|
||||||
|
lshw
|
||||||
|
lsof
|
||||||
|
lsscsi
|
||||||
|
lxde
|
||||||
|
lynx
|
||||||
|
macchanger
|
||||||
|
memtester
|
||||||
|
mkinitcpio-nfs-utils
|
||||||
|
mtr-gtk
|
||||||
|
nbd
|
||||||
|
net-tools
|
||||||
|
netctl
|
||||||
|
netselect
|
||||||
|
networkmanager
|
||||||
|
ngrep
|
||||||
|
nmap-nogui
|
||||||
|
nmon
|
||||||
|
ntfs-3g
|
||||||
|
openssh
|
||||||
|
openvpn
|
||||||
|
os-prober
|
||||||
|
pciutils
|
||||||
|
pcmciautils
|
||||||
|
ppp
|
||||||
|
pptpclient
|
||||||
|
prebootloader
|
||||||
|
procinfo-ng
|
||||||
|
procps-ng
|
||||||
|
psmisc
|
||||||
|
pwgen
|
||||||
|
rfkill
|
||||||
|
rp-pppoe
|
||||||
|
rsync
|
||||||
|
screen
|
||||||
|
sed
|
||||||
|
shorewall
|
||||||
|
socat
|
||||||
|
strace
|
||||||
|
syslinux
|
||||||
|
tcpdump
|
||||||
|
tcpslice
|
||||||
|
tcptraceroute
|
||||||
|
tmux
|
||||||
|
traceroute
|
||||||
|
tor
|
||||||
|
#udpcast
|
||||||
|
usbip
|
||||||
|
usbutils
|
||||||
|
vim-a
|
||||||
|
vim-bufexplorer
|
||||||
|
vim-indent-object
|
||||||
|
vim-minibufexpl
|
||||||
|
vim-nerdtree
|
||||||
|
vim-syntastic
|
||||||
|
vim-workspace
|
||||||
|
vnstat
|
||||||
|
vpnc
|
||||||
|
whois
|
||||||
|
wxpython
|
||||||
|
xorg
|
||||||
|
xorg-drivers
|
94
extra/pre-build.d/32/etc/pacman.conf
Normal file
94
extra/pre-build.d/32/etc/pacman.conf
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
#
|
||||||
|
# /etc/pacman.conf
|
||||||
|
#
|
||||||
|
# See the pacman.conf(5) manpage for option and repository directives
|
||||||
|
|
||||||
|
#
|
||||||
|
# GENERAL OPTIONS
|
||||||
|
#
|
||||||
|
[options]
|
||||||
|
# The following paths are commented out with their default values listed.
|
||||||
|
# If you wish to use different paths, uncomment and update the paths.
|
||||||
|
#RootDir = /
|
||||||
|
#DBPath = /var/lib/pacman/
|
||||||
|
#CacheDir = /var/cache/pacman/pkg/
|
||||||
|
#LogFile = /var/log/pacman.log
|
||||||
|
#GPGDir = /etc/pacman.d/gnupg/
|
||||||
|
HoldPkg = pacman glibc
|
||||||
|
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||||
|
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||||
|
#CleanMethod = KeepInstalled
|
||||||
|
#UseDelta = 0.7
|
||||||
|
Architecture = i686
|
||||||
|
|
||||||
|
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
||||||
|
#IgnorePkg =
|
||||||
|
#IgnoreGroup =
|
||||||
|
|
||||||
|
#NoUpgrade =
|
||||||
|
#NoExtract =
|
||||||
|
|
||||||
|
# Misc options
|
||||||
|
UseSyslog
|
||||||
|
Color
|
||||||
|
TotalDownload
|
||||||
|
CheckSpace
|
||||||
|
VerbosePkgLists
|
||||||
|
|
||||||
|
# By default, pacman accepts packages signed by keys that its local keyring
|
||||||
|
# trusts (see pacman-key and its man page), as well as unsigned packages.
|
||||||
|
SigLevel = Required DatabaseOptional
|
||||||
|
LocalFileSigLevel = Optional
|
||||||
|
#RemoteFileSigLevel = Required
|
||||||
|
|
||||||
|
# NOTE: You must run `pacman-key --init` before first using pacman; the local
|
||||||
|
# keyring can then be populated with the keys of all official Arch Linux
|
||||||
|
# packagers with `pacman-key --populate archlinux`.
|
||||||
|
|
||||||
|
#
|
||||||
|
# REPOSITORIES
|
||||||
|
# - can be defined here or included from another file
|
||||||
|
# - pacman will search repositories in the order defined here
|
||||||
|
# - local/custom mirrors can be added here or in separate files
|
||||||
|
# - repositories listed first will take precedence when packages
|
||||||
|
# have identical names, regardless of version number
|
||||||
|
# - URLs will have $repo replaced by the name of the current repo
|
||||||
|
# - URLs will have $arch replaced by the name of the architecture
|
||||||
|
#
|
||||||
|
# Repository entries are of the format:
|
||||||
|
# [repo-name]
|
||||||
|
# Server = ServerName
|
||||||
|
# Include = IncludePath
|
||||||
|
#
|
||||||
|
# The header [repo-name] is crucial - it must be present and
|
||||||
|
# uncommented to enable the repo.
|
||||||
|
#
|
||||||
|
|
||||||
|
# The testing repositories are disabled by default. To enable, uncomment the
|
||||||
|
# repo name header and Include lines. You can add preferred servers immediately
|
||||||
|
# after the header, and they will be used before the default mirrors.
|
||||||
|
|
||||||
|
#[testing]
|
||||||
|
#Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
[core]
|
||||||
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
[extra]
|
||||||
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
#[community-testing]
|
||||||
|
#Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
[community]
|
||||||
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
# An example of a custom package repository. See the pacman manpage for
|
||||||
|
# tips on creating your own repositories.
|
||||||
|
#[custom]
|
||||||
|
#SigLevel = Optional TrustAll
|
||||||
|
#Server = file:///home/custompkgs
|
||||||
|
|
||||||
|
[archlinuxfr]
|
||||||
|
SigLevel = Never
|
||||||
|
Server = http://repo.archlinux.fr/$arch
|
103
extra/pre-build.d/64/etc/pacman.conf
Normal file
103
extra/pre-build.d/64/etc/pacman.conf
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
#
|
||||||
|
# /etc/pacman.conf
|
||||||
|
#
|
||||||
|
# See the pacman.conf(5) manpage for option and repository directives
|
||||||
|
|
||||||
|
#
|
||||||
|
# GENERAL OPTIONS
|
||||||
|
#
|
||||||
|
[options]
|
||||||
|
# The following paths are commented out with their default values listed.
|
||||||
|
# If you wish to use different paths, uncomment and update the paths.
|
||||||
|
#RootDir = /
|
||||||
|
#DBPath = /var/lib/pacman/
|
||||||
|
#CacheDir = /var/cache/pacman/pkg/
|
||||||
|
#LogFile = /var/log/pacman.log
|
||||||
|
#GPGDir = /etc/pacman.d/gnupg/
|
||||||
|
HoldPkg = pacman glibc
|
||||||
|
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||||
|
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||||
|
#CleanMethod = KeepInstalled
|
||||||
|
#UseDelta = 0.7
|
||||||
|
Architecture = x86_64
|
||||||
|
|
||||||
|
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
||||||
|
#IgnorePkg =
|
||||||
|
#IgnoreGroup =
|
||||||
|
|
||||||
|
#NoUpgrade =
|
||||||
|
#NoExtract =
|
||||||
|
|
||||||
|
# Misc options
|
||||||
|
UseSyslog
|
||||||
|
Color
|
||||||
|
TotalDownload
|
||||||
|
CheckSpace
|
||||||
|
VerbosePkgLists
|
||||||
|
|
||||||
|
# By default, pacman accepts packages signed by keys that its local keyring
|
||||||
|
# trusts (see pacman-key and its man page), as well as unsigned packages.
|
||||||
|
SigLevel = Required DatabaseOptional
|
||||||
|
LocalFileSigLevel = Optional
|
||||||
|
#RemoteFileSigLevel = Required
|
||||||
|
|
||||||
|
# NOTE: You must run `pacman-key --init` before first using pacman; the local
|
||||||
|
# keyring can then be populated with the keys of all official Arch Linux
|
||||||
|
# packagers with `pacman-key --populate archlinux`.
|
||||||
|
|
||||||
|
#
|
||||||
|
# REPOSITORIES
|
||||||
|
# - can be defined here or included from another file
|
||||||
|
# - pacman will search repositories in the order defined here
|
||||||
|
# - local/custom mirrors can be added here or in separate files
|
||||||
|
# - repositories listed first will take precedence when packages
|
||||||
|
# have identical names, regardless of version number
|
||||||
|
# - URLs will have $repo replaced by the name of the current repo
|
||||||
|
# - URLs will have $arch replaced by the name of the architecture
|
||||||
|
#
|
||||||
|
# Repository entries are of the format:
|
||||||
|
# [repo-name]
|
||||||
|
# Server = ServerName
|
||||||
|
# Include = IncludePath
|
||||||
|
#
|
||||||
|
# The header [repo-name] is crucial - it must be present and
|
||||||
|
# uncommented to enable the repo.
|
||||||
|
#
|
||||||
|
|
||||||
|
# The testing repositories are disabled by default. To enable, uncomment the
|
||||||
|
# repo name header and Include lines. You can add preferred servers immediately
|
||||||
|
# after the header, and they will be used before the default mirrors.
|
||||||
|
|
||||||
|
#[testing]
|
||||||
|
#Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
[core]
|
||||||
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
[extra]
|
||||||
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
#[community-testing]
|
||||||
|
#Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
[community]
|
||||||
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
# If you want to run 32 bit applications on your x86_64 system,
|
||||||
|
# enable the multilib repositories as required here.
|
||||||
|
|
||||||
|
#[multilib-testing]
|
||||||
|
#Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
[multilib]
|
||||||
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
|
# An example of a custom package repository. See the pacman manpage for
|
||||||
|
# tips on creating your own repositories.
|
||||||
|
#[custom]
|
||||||
|
#SigLevel = Optional TrustAll
|
||||||
|
#Server = file:///home/custompkgs
|
||||||
|
|
||||||
|
[archlinuxfr]
|
||||||
|
SigLevel = Never
|
||||||
|
Server = http://repo.archlinux.fr/$arch
|
89
extra/pre-build.d/etc/customizepkg.d/linux
Executable file
89
extra/pre-build.d/etc/customizepkg.d/linux
Executable file
@ -0,0 +1,89 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# change some versions around
|
||||||
|
sed -i -e 's/^\(pkgbase=linux[[:space:]]*\)/#\1/g' ${1}
|
||||||
|
sed -i -e 's/^#\(pkgbase=linux-\)custom.*$/\1BDisk/g' ${1}
|
||||||
|
sed -i -e '/^_kernelname/a KERNVER=$(echo ${pkgver} | sed -e "s/\\\([0-9]\\\.[0-9]*\\\).*$/\\\1/")' ${1}
|
||||||
|
sed -i -e "s/^\(makedepends=.*\))$/\1 'rsync' 'git')/g" ${1}
|
||||||
|
##cp linux.preset linux-BDisk.preset
|
||||||
|
##sed -i -e 's#^[[:space:]]*install\ -D\ -m644\ "${srcdir}/linux.preset".*$#install -D -m644 "${srcdir}/linux-BDisk.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"#g' ${1}
|
||||||
|
##sed -i -e "s/\ 'fallback'//g" \
|
||||||
|
##-e '/^fallback/d' \
|
||||||
|
##-e '/^$/d' \
|
||||||
|
##-e '/^[[:space:]]*$/d' \
|
||||||
|
##-e 's#^\(default_image="/boot/initramfs-linux\).*#\1-BDisk"/g' linux-BDisk.preset
|
||||||
|
##-e 's/^\(ALL_kver="/boot/vmlinuz-linux\)\(.*\)/\1-BDisk\2/g' linux-BDisk.preset
|
||||||
|
|
||||||
|
# add source for aufs3
|
||||||
|
## 12.07.2014 - remove the "git checkout <SPECIFIC COMMIT HASH>" once a bug is fixed. currently fails with:
|
||||||
|
## LD fs/aufs/built-in.o
|
||||||
|
## CC [M] fs/aufs/module.o
|
||||||
|
##In file included from fs/aufs/module.c:24:0:
|
||||||
|
##fs/aufs/inode.h:307:12: error: function declaration isn't a prototype
|
||||||
|
##[-Werror=strict-prototypes]
|
||||||
|
## AuStubInt0(au_cpup_xattr, h_dst, h_src, ignore_flags)
|
||||||
|
## ^
|
||||||
|
##fs/aufs/aufs.h:28:21: note: in definition of macro 'AuStub'
|
||||||
|
## static inline type name(__VA_ARGS__) { body; }
|
||||||
|
## ^
|
||||||
|
##fs/aufs/inode.h:307:1: note: in expansion of macro 'AuStubInt0'
|
||||||
|
## AuStubInt0(au_cpup_xattr, h_dst, h_src, ignore_flags)
|
||||||
|
## ^
|
||||||
|
##cc1: some warnings being treated as errors
|
||||||
|
##scripts/Makefile.build:257: recipe for target 'fs/aufs/module.o' failed
|
||||||
|
##make[2]: *** [fs/aufs/module.o] Error 1
|
||||||
|
##scripts/Makefile.build:404: recipe for target 'fs/aufs' failed
|
||||||
|
##make[1]: *** [fs/aufs] Error 2
|
||||||
|
##Makefile:929: recipe for target 'fs' failed
|
||||||
|
##make: *** [fs] Error 2
|
||||||
|
sed -i -e '/^prepare()\ {/a\
|
||||||
|
\ git clone git:\/\/aufs.git.sourceforge.net\/gitroot\/aufs\/aufs3-standalone.git aufs3 > \/dev\/null 2>&1\
|
||||||
|
\ cd aufs3\
|
||||||
|
\ git checkout aufs${KERNVER} > \/dev\/null 2>&1\
|
||||||
|
\ git checkout c75f6dddc1c58950c76cc1581e4b4c7ac8365bff > \/dev\/null 2>&1\
|
||||||
|
\ cd ..\/' ${1}
|
||||||
|
#sed -i -e 's/^\(_kernelname=\).*$/\1"-BDisk"/' ${1}
|
||||||
|
sed -i -e '/^[[:space:]]*patch.*pkgver}"$/i rsync -a ../aufs3/Documentation/. Documentation/. ; rsync -a ../aufs3/fs/. fs/. ; cp -a ../aufs3/include/uapi/linux/aufs_type.h include/uapi/linux/. \
|
||||||
|
\ for i in $(ls -1 ../aufs3/*.patch) ; do patch -p1 -i ../aufs3/${i} ; done' ${1}
|
||||||
|
# and we need to be sure to build aufs3-util
|
||||||
|
#sed -i -e '/^[[:space:]]*install\ -D\ -m644\ vmlinux.*$/a\
|
||||||
|
#\ git clone git:\/\/git.code.sf.net\/p\/aufs\/aufs-util > \/dev\/null 2>&1\
|
||||||
|
#\ cd aufs-util\
|
||||||
|
#\ UTILVER=$(git branch -a | grep -v master | sort -nr | grep -v rcN | head -n1 | cut -f3 -d"\/")\
|
||||||
|
#\ git checkout ${UTILVER} > \/dev\/null 2>&1\
|
||||||
|
#\ make' ${1}
|
||||||
|
|
||||||
|
# and configure the kernel. this gets messy.
|
||||||
|
#-e "s/^#[[:space:]]\\\(CONFIG_AUFS_FS\\\).*$/\\\1=m/g" \\\
|
||||||
|
sed -i -e '/^[[:space:]]*make\ prepare.*$/i yes "" | make olddefconfig >/dev/null' ${1}
|
||||||
|
sed -i -e '/^[[:space:]]*make\ prepare.*$/a sed -i \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_FS\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_BRANCH_MAX_127\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_SBILIST\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_HNOTIFY\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_HFSNOTIFY\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_EXPORT\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_INO_T_64\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_FHSM\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_RDU\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_BDEV_LOOP\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(AUFS_BRANCH_MAX_511\\\).*$/\\\1=n/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(AUFS_BRANCH_MAX_1023\\\).*$/\\\1=n/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(AUFS_BRANCH_MAX_32767\\\).*$/\\\1=n/g" ${srcdir}/../config{,.x86_64}' ${1}
|
||||||
|
# yes, we have to do this twice. with a hammer.
|
||||||
|
sed -i -e '/^[[:space:]]*make\ prepare.*$/a sed -i \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_FS\\\).*$/\\\1=m/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_BRANCH_MAX_127\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_SBILIST\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_HNOTIFY\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_HFSNOTIFY\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_EXPORT\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_INO_T_64\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_FHSM\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_RDU\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(CONFIG_AUFS_BDEV_LOOP\\\).*$/\\\1=y/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(AUFS_BRANCH_MAX_511\\\).*$/\\\1=n/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(AUFS_BRANCH_MAX_1023\\\).*$/\\\1=n/g" \\\
|
||||||
|
-e "s/^#[[:space:]]\\\(AUFS_BRANCH_MAX_32767\\\).*$/\\\1=n/g" .config' ${1}
|
||||||
|
sed -i -e 's/^\([[:space:]]*yes\ ""\ |\ \)make\ config/\1make olddefconfig/' ${1}
|
||||||
|
# and we have to edit the linux.install as well.
|
||||||
|
sed -i -e 's/^\(KERNEL_NAME=\).*$/\1-BDisk/g' linux.install*
|
1
extra/pre-build.d/etc/hostname
Normal file
1
extra/pre-build.d/etc/hostname
Normal file
@ -0,0 +1 @@
|
|||||||
|
bdisk.square-r00t.net
|
67
extra/pre-build.d/etc/mkinitcpio.conf
Normal file
67
extra/pre-build.d/etc/mkinitcpio.conf
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# MODULES
|
||||||
|
# The following modules are loaded before any boot hooks are
|
||||||
|
# run. Advanced users may wish to specify all system modules
|
||||||
|
# in this array. For instance:
|
||||||
|
# MODULES="piix ide_disk reiserfs"
|
||||||
|
MODULES="aufs ata_generic ata_piix loop nls_cp437 ext4 raid456 vfat netconsole"
|
||||||
|
|
||||||
|
# BINARIES
|
||||||
|
# This setting includes any additional binaries a given user may
|
||||||
|
# wish into the CPIO image. This is run last, so it may be used to
|
||||||
|
# override the actual binaries included by a given hook
|
||||||
|
# BINARIES are dependency parsed, so you may safely ignore libraries
|
||||||
|
BINARIES="/usr/bin/memdiskfind"
|
||||||
|
|
||||||
|
# FILES
|
||||||
|
# This setting is similar to BINARIES above, however, files are added
|
||||||
|
# as-is and are not parsed in any way. This is useful for config files.
|
||||||
|
FILES=""
|
||||||
|
|
||||||
|
# HOOKS
|
||||||
|
# This is the most important setting in this file. The HOOKS control the
|
||||||
|
# modules and scripts added to the image, and what happens at boot time.
|
||||||
|
# Order is important, and it is recommended that you do not change the
|
||||||
|
# order in which HOOKS are added. Run 'mkinitcpio -H <hook name>' for
|
||||||
|
# help on a given hook.
|
||||||
|
# 'base' is _required_ unless you know precisely what you are doing.
|
||||||
|
# 'udev' is _required_ in order to automatically load modules
|
||||||
|
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
|
||||||
|
# Examples:
|
||||||
|
## This setup specifies all modules in the MODULES setting above.
|
||||||
|
## No raid, lvm2, or encrypted root is needed.
|
||||||
|
# HOOKS="base"
|
||||||
|
#
|
||||||
|
## This setup will autodetect all modules for your system and should
|
||||||
|
## work as a sane default
|
||||||
|
# HOOKS="base udev autodetect block filesystems"
|
||||||
|
#
|
||||||
|
## This setup will generate a 'full' image which supports most systems.
|
||||||
|
## No autodetection is done.
|
||||||
|
# HOOKS="base udev block filesystems"
|
||||||
|
#
|
||||||
|
## This setup assembles a pata mdadm array with an encrypted root FS.
|
||||||
|
## Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
|
||||||
|
# HOOKS="base udev block mdadm encrypt filesystems"
|
||||||
|
#
|
||||||
|
## This setup loads an lvm2 volume group on a usb device.
|
||||||
|
# HOOKS="base udev block lvm2 filesystems"
|
||||||
|
#
|
||||||
|
## NOTE: If you have /usr on a separate partition, you MUST include the
|
||||||
|
# usr, fsck and shutdown hooks.
|
||||||
|
#HOOKS="base udev autodetect modconf block filesystems keyboard fsck"
|
||||||
|
#HOOKS="base udev memdisk archiso_shutdown archiso modconf net ssh archiso_loop_mnt archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_kms block pcmcia filesystems keyboard livecd"
|
||||||
|
HOOKS="base udev memdisk archiso_shutdown archiso-custom modconf net ssh archiso_loop_mnt archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_kms block pcmcia filesystems keyboard livecd"
|
||||||
|
|
||||||
|
# COMPRESSION
|
||||||
|
# Use this to compress the initramfs image. By default, gzip compression
|
||||||
|
# is used. Use 'cat' to create an uncompressed image.
|
||||||
|
#COMPRESSION="gzip"
|
||||||
|
#COMPRESSION="bzip2"
|
||||||
|
#COMPRESSION="lzma"
|
||||||
|
COMPRESSION="xz"
|
||||||
|
#COMPRESSION="lzop"
|
||||||
|
#COMPRESSION="lz4"
|
||||||
|
|
||||||
|
# COMPRESSION_OPTIONS
|
||||||
|
# Additional options for the compressor
|
||||||
|
#COMPRESSION_OPTIONS=""
|
7
extra/pre-build.d/etc/pacman.d/mirrorlist
Normal file
7
extra/pre-build.d/etc/pacman.d/mirrorlist
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# 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
|
57
extra/pre-build.d/etc/yaourtrc
Normal file
57
extra/pre-build.d/etc/yaourtrc
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# yaourtrc - Configuration for yaourt
|
||||||
|
#
|
||||||
|
# See yaourtrc(5) for more information
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
# General
|
||||||
|
#AUTOSAVEBACKUPFILE=0
|
||||||
|
#DEVELBUILDDIR="/var/abs/local/yaourtbuild"
|
||||||
|
#DEVEL=0
|
||||||
|
#EDITOR="$EDITOR"
|
||||||
|
#FORCEENGLISH=0
|
||||||
|
#FORCE=0
|
||||||
|
#TMPDIR="/tmp"
|
||||||
|
TMPDIR="/var/tmp"
|
||||||
|
|
||||||
|
# SUDO
|
||||||
|
#SUDONOVERIF=0 # Avoid multiple sudo checks when timestamp_timeout=0
|
||||||
|
#SUDOREDIRECT=1 # Define to 0 in case you use a fingerprint device
|
||||||
|
|
||||||
|
# ABS
|
||||||
|
# If the package "abs" is installed, those var are parsed from abs.conf
|
||||||
|
#REPOS=() # REPOS available at $SYNCSERVER
|
||||||
|
#SYNCSERVER=""
|
||||||
|
|
||||||
|
# AUR
|
||||||
|
#AURURL="https://aur.archlinux.org"
|
||||||
|
AURCOMMENT=0
|
||||||
|
#AURDEVELONLY=0
|
||||||
|
#AURSEARCH=1
|
||||||
|
#AURUPGRADE=0
|
||||||
|
#AURVOTE=1
|
||||||
|
|
||||||
|
# Build
|
||||||
|
#EXPORT=0 # Export to 1: EXPORTDIR or PKGDEST
|
||||||
|
# 2: pacman cache (as root)
|
||||||
|
#EXPORTSRC=0 # Need EXPORT>0 to be used
|
||||||
|
#EXPORTDIR="" # If empty, use makepkg's connfiguration (see makepkg.conf)
|
||||||
|
|
||||||
|
# Prompt
|
||||||
|
NOCONFIRM=0
|
||||||
|
UP_NOCONFIRM=1
|
||||||
|
BUILD_NOCONFIRM=1
|
||||||
|
PU_NOCONFIRM=1
|
||||||
|
EDITFILES=0
|
||||||
|
NOENTER=1
|
||||||
|
|
||||||
|
# Output
|
||||||
|
USECOLOR=1
|
||||||
|
#USEPAGER=0
|
||||||
|
DETAILUPGRADE=1
|
||||||
|
SHOWORPHANS=1
|
||||||
|
TERMINALTITLE=1
|
||||||
|
|
||||||
|
# Command
|
||||||
|
#PACMAN="pacman"
|
||||||
|
#DIFFEDITCMD="vimdiff"
|
186
extra/pre-build.d/usr/lib/initcpio/hooks/archiso-custom
Normal file
186
extra/pre-build.d/usr/lib/initcpio/hooks/archiso-custom
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
# args: source, newroot, mountpoint
|
||||||
|
_mnt_fs() {
|
||||||
|
local img="${1}"
|
||||||
|
local newroot="${2}"
|
||||||
|
local mnt="${3}"
|
||||||
|
local img_fullname="${img##*/}";
|
||||||
|
local img_name="${img_fullname%%.*}"
|
||||||
|
local dm_snap_name="${dm_snap_prefix}_${img_name}"
|
||||||
|
local ro_dev ro_dev_size rw_dev
|
||||||
|
|
||||||
|
ro_dev=$(losetup --find --show --read-only "${img}")
|
||||||
|
echo ${ro_dev} >> /run/archiso/used_block_devices
|
||||||
|
ro_dev_size=$(blockdev --getsz ${ro_dev})
|
||||||
|
if [[ "${cowfile_size}" == "100" ]]; then
|
||||||
|
rw_dev_size=${ro_dev_size}
|
||||||
|
else
|
||||||
|
# size calculation done in this way to avoid integer overflow when ro_dev_size is > 10.2G
|
||||||
|
rw_dev_size=$((ro_dev_size/100*cowfile_size))
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${cow_persistent}" == "P" ]]; then
|
||||||
|
if [[ -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow" ]]; then
|
||||||
|
msg ":: Found '/run/archiso/cowspace/${cow_directory}/${img_name}.cow', using as persistent."
|
||||||
|
else
|
||||||
|
msg ":: Creating '/run/archiso/cowspace/${cow_directory}/${img_name}.cow' as persistent."
|
||||||
|
dd of="/run/archiso/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${rw_dev_size} &> /dev/null
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow" ]]; then
|
||||||
|
msg ":: Found '/run/archiso/cowspace/${cow_directory}/${img_name}.cow' but non-persistent requested, removing."
|
||||||
|
rm -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow"
|
||||||
|
fi
|
||||||
|
msg ":: Creating '/run/archiso/cowspace/${cow_directory}/${img_name}.cow' as non-persistent."
|
||||||
|
dd of="/run/archiso/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${rw_dev_size} &> /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
rw_dev=$(losetup --find --show "/run/archiso/cowspace/${cow_directory}/${img_name}.cow")
|
||||||
|
echo ${rw_dev} >> /run/archiso/used_block_devices
|
||||||
|
|
||||||
|
echo "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} 8" | dmsetup create ${dm_snap_name}
|
||||||
|
|
||||||
|
_mnt_dev "/dev/mapper/${dm_snap_name}" "${newroot}${mnt}" "-w"
|
||||||
|
echo $(readlink -f /dev/mapper/${dm_snap_name}) >> /run/archiso/used_block_devices
|
||||||
|
}
|
||||||
|
|
||||||
|
# args: /path/to/image_file, mountpoint
|
||||||
|
_mnt_sfs() {
|
||||||
|
local img="${1}"
|
||||||
|
local mnt="${2}"
|
||||||
|
local img_fullname="${img##*/}"
|
||||||
|
local sfs_dev
|
||||||
|
|
||||||
|
if [[ "${copytoram}" == "y" ]]; then
|
||||||
|
msg -n ":: Copying squashfs image to RAM..."
|
||||||
|
if ! cp "${img}" "/run/archiso/copytoram/${img_fullname}" ; then
|
||||||
|
echo "ERROR: while copy '${img}' to '/run/archiso/copytoram/${img_fullname}'"
|
||||||
|
launch_interactive_shell
|
||||||
|
fi
|
||||||
|
img="/run/archiso/copytoram/${img_fullname}"
|
||||||
|
msg "done."
|
||||||
|
fi
|
||||||
|
sfs_dev=$(losetup --find --show --read-only "${img}")
|
||||||
|
echo ${sfs_dev} >> /run/archiso/used_block_devices
|
||||||
|
_mnt_dev "${sfs_dev}" "${mnt}" "-r"
|
||||||
|
}
|
||||||
|
|
||||||
|
# args: device, mountpoint, flags
|
||||||
|
_mnt_dev() {
|
||||||
|
local dev="${1}"
|
||||||
|
local mnt="${2}"
|
||||||
|
local flg="${3}"
|
||||||
|
|
||||||
|
mkdir -p "${mnt}"
|
||||||
|
|
||||||
|
msg ":: Mounting '${dev}' to '${mnt}'"
|
||||||
|
|
||||||
|
while ! poll_device "${dev}" 30; do
|
||||||
|
echo "ERROR: '${dev}' device did not show up after 30 seconds..."
|
||||||
|
echo " Falling back to interactive prompt"
|
||||||
|
echo " You can try to fix the problem manually, log out when you are finished"
|
||||||
|
launch_interactive_shell
|
||||||
|
done
|
||||||
|
|
||||||
|
if mount "${flg}" "${dev}" "${mnt}"; then
|
||||||
|
msg ":: Device '${dev}' mounted successfully."
|
||||||
|
else
|
||||||
|
echo "ERROR; Failed to mount '${dev}'"
|
||||||
|
echo " Falling back to interactive prompt"
|
||||||
|
echo " You can try to fix the problem manually, log out when you are finished"
|
||||||
|
launch_interactive_shell
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_verify_checksum() {
|
||||||
|
local _status
|
||||||
|
cd "/run/archiso/bootmnt/${archisobasedir}/${arch}"
|
||||||
|
md5sum -c airootfs.md5 > /tmp/checksum.log 2>&1
|
||||||
|
_status=$?
|
||||||
|
cd "${OLDPWD}"
|
||||||
|
return ${_status}
|
||||||
|
}
|
||||||
|
|
||||||
|
run_hook() {
|
||||||
|
[[ -z "${arch}" ]] && arch="$(uname -m)"
|
||||||
|
[[ -z "${cowspace_size}" ]] && cowspace_size="75%"
|
||||||
|
[[ -z "${copytoram_size}" ]] && copytoram_size="75%"
|
||||||
|
[[ -z "${archisobasedir}" ]] && archisobasedir="arch"
|
||||||
|
[[ -z "${dm_snap_prefix}" ]] && dm_snap_prefix="arch"
|
||||||
|
[[ -z "${archisodevice}" ]] && archisodevice="/dev/disk/by-label/${archisolabel}"
|
||||||
|
if [[ -z "${cowfile_size}" ]]; then
|
||||||
|
cowfile_size="100"
|
||||||
|
else
|
||||||
|
cowfile_size=${cowfile_size/%}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${cow_label}" ]]; then
|
||||||
|
cow_device="/dev/disk/by-label/${cow_label}"
|
||||||
|
[[ -z "${cow_persistent}" ]] && cow_persistent="P"
|
||||||
|
elif [[ -n "${cow_device}" ]]; then
|
||||||
|
[[ -z "${cow_persistent}" ]] && cow_persistent="P"
|
||||||
|
else
|
||||||
|
cow_persistent="N"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ -z "${cow_directory}" ]] && cow_directory="persistent_${archisolabel}/${arch}"
|
||||||
|
|
||||||
|
# set mount handler for archiso
|
||||||
|
mount_handler="archiso_mount_handler"
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function is called normally from init script, but it can be called
|
||||||
|
# as chain from other mount handlers.
|
||||||
|
# args: /path/to/newroot
|
||||||
|
archiso_mount_handler() {
|
||||||
|
local newroot="${1}"
|
||||||
|
|
||||||
|
if ! mountpoint -q "/run/archiso/bootmnt"; then
|
||||||
|
_mnt_dev "${archisodevice}" "/run/archiso/bootmnt" "-r"
|
||||||
|
if [[ "${copytoram}" != "y" ]]; then
|
||||||
|
echo $(readlink -f ${archisodevice}) >> /run/archiso/used_block_devices
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${checksum}" == "y" ]]; then
|
||||||
|
if [[ -f "/run/archiso/bootmnt/${archisobasedir}/${arch}/airootfs.md5" ]]; then
|
||||||
|
msg -n ":: Self-test requested, please wait..."
|
||||||
|
if _verify_checksum; then
|
||||||
|
msg "done. Checksum is OK, continue booting."
|
||||||
|
else
|
||||||
|
echo "ERROR: one or more files are corrupted"
|
||||||
|
echo "see /tmp/checksum.log for details"
|
||||||
|
launch_interactive_shell
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "ERROR: checksum=y option specified but ${archisobasedir}/${arch}/airootfs.md5 not found"
|
||||||
|
launch_interactive_shell
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${copytoram}" == "y" ]]; then
|
||||||
|
msg ":: Mounting /run/archiso/copytoram (tmpfs) filesystem, size=${copytoram_size}"
|
||||||
|
mkdir -p /run/archiso/copytoram
|
||||||
|
mount -t tmpfs -o "size=${copytoram_size}",mode=0755 copytoram /run/archiso/copytoram
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${cow_device}" ]]; then
|
||||||
|
_mnt_dev "${cow_device}" "/run/archiso/cowspace" "-r"
|
||||||
|
echo $(readlink -f ${cow_device}) >> /run/archiso/used_block_devices
|
||||||
|
mount -o remount,rw "/run/archiso/cowspace"
|
||||||
|
else
|
||||||
|
msg ":: Mounting /run/archiso/cowspace (tmpfs) filesystem, size=${cowspace_size}..."
|
||||||
|
mkdir -p /run/archiso/cowspace
|
||||||
|
mount -t tmpfs -o "size=${cowspace_size}",mode=0755 cowspace /run/archiso/cowspace
|
||||||
|
fi
|
||||||
|
mkdir -p "/run/archiso/cowspace/${cow_directory}"
|
||||||
|
|
||||||
|
_mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${arch}/airootfs.sfs" "/run/archiso/sfs/airootfs"
|
||||||
|
# _mnt_fs "/run/archiso/sfs/airootfs/airootfs.img" "${newroot}" "/"
|
||||||
|
mount --bind "run/archiso/sfs/airootfs" "/new_root"
|
||||||
|
|
||||||
|
if [[ "${copytoram}" == "y" ]]; then
|
||||||
|
umount /run/archiso/bootmnt
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim:ft=sh:ts=4:sw=4:et:
|
15
extra/pre-build.d/usr/lib/initcpio/hooks/livecd
Normal file
15
extra/pre-build.d/usr/lib/initcpio/hooks/livecd
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# vim: set ft=sh:
|
||||||
|
|
||||||
|
run_cleanuphook () {
|
||||||
|
msg ":: Mounting aufs on / with tmpfs=rw, ${root}=ro ..."
|
||||||
|
modprobe aufs
|
||||||
|
|
||||||
|
echo "Now attempting aufs mount..."
|
||||||
|
|
||||||
|
mkdir /new_root.hw
|
||||||
|
mount --move /new_root /new_root.hw
|
||||||
|
mkdir /dev/shm
|
||||||
|
mount -t tmpfs none /dev/shm
|
||||||
|
mount -t aufs none /new_root -o dirs=/dev/shm=rw:/new_root.hw=ro -o noatime
|
||||||
|
pkill -9 dropbear #kill SSH (in preparation for the live system starting ssh on port 22
|
||||||
|
}
|
67
extra/pre-build.d/usr/lib/initcpio/hooks/ssh
Normal file
67
extra/pre-build.d/usr/lib/initcpio/hooks/ssh
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
#!/usr/bin/ash
|
||||||
|
|
||||||
|
run_hook ()
|
||||||
|
{
|
||||||
|
local line i address netmask gateway dns0 dns1 rootserver rootpath defaultrootpath defaultserver
|
||||||
|
|
||||||
|
: > /ip_opts
|
||||||
|
|
||||||
|
if [ -z "${ip}" -a -n "${nfsaddrs}" ]; then
|
||||||
|
ip="${nfsaddrs}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "${ip}" ]; then
|
||||||
|
# setup network and save some values
|
||||||
|
ipconfig "ip=${ip}" | while read line; do
|
||||||
|
if [ "${line#"IP-Config:"}" != "${line}" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
line="$(echo ${line} | sed -e 's/ :/:/g;s/: /=/g')"
|
||||||
|
|
||||||
|
for i in ${line}; do
|
||||||
|
case "${i}" in
|
||||||
|
address=*)
|
||||||
|
echo "${i}" >> /ip_opts
|
||||||
|
;;
|
||||||
|
netmask=*)
|
||||||
|
echo "${i}" >> /ip_opts
|
||||||
|
;;
|
||||||
|
gateway=*)
|
||||||
|
echo "${i}" >> /ip_opts
|
||||||
|
;;
|
||||||
|
dns0=*)
|
||||||
|
echo "${i}" >> /ip_opts
|
||||||
|
;;
|
||||||
|
dns1=*)
|
||||||
|
echo "${i}" >> /ip_opts
|
||||||
|
;;
|
||||||
|
rootserver=*)
|
||||||
|
echo "${i}" >> /ip_opts
|
||||||
|
;;
|
||||||
|
rootpath=*)
|
||||||
|
echo "${i}" >> /ip_opts
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "device=$(echo ${ip} | cut -d: -f6)" >> /ip_opts
|
||||||
|
fi
|
||||||
|
|
||||||
|
. /ip_opts
|
||||||
|
|
||||||
|
echo "IP-Config: ${address}/${netmask}"
|
||||||
|
echo "IP-Config: gw: ${gateway} dns0: ${dns0} dns1: ${dns1}"
|
||||||
|
|
||||||
|
[ -d /dev/pts ] || mkdir -p /dev/pts
|
||||||
|
mount -t devpts devpts /dev/pts
|
||||||
|
|
||||||
|
echo "Starting dropbear"
|
||||||
|
/usr/sbin/dropbear -E
|
||||||
|
}
|
||||||
|
|
||||||
|
run_cleanuphook ()
|
||||||
|
{
|
||||||
|
pkill -9 dropbear
|
||||||
|
}
|
23
extra/pre-build.d/usr/lib/initcpio/install/archiso-custom
Normal file
23
extra/pre-build.d/usr/lib/initcpio/install/archiso-custom
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
build() {
|
||||||
|
add_module "cdrom"
|
||||||
|
add_module "loop"
|
||||||
|
add_module "dm-snapshot"
|
||||||
|
|
||||||
|
add_runscript
|
||||||
|
|
||||||
|
add_binary /usr/lib/udev/cdrom_id
|
||||||
|
add_binary blockdev
|
||||||
|
add_binary dmsetup
|
||||||
|
add_binary losetup
|
||||||
|
add_binary mountpoint
|
||||||
|
add_binary truncate
|
||||||
|
|
||||||
|
add_file /usr/lib/udev/rules.d/60-cdrom_id.rules
|
||||||
|
add_file /usr/lib/udev/rules.d/10-dm.rules
|
||||||
|
add_file /usr/lib/udev/rules.d/95-dm-notify.rules
|
||||||
|
add_file /usr/lib/initcpio/udev/11-dm-initramfs.rules /usr/lib/udev/rules.d/11-dm-initramfs.rules
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ft=sh ts=4 sw=4 et:
|
21
extra/pre-build.d/usr/lib/initcpio/install/livecd
Normal file
21
extra/pre-build.d/usr/lib/initcpio/install/livecd
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
build()
|
||||||
|
{
|
||||||
|
add_module 'squashfs'
|
||||||
|
add_module 'loop'
|
||||||
|
add_module 'aufs'
|
||||||
|
|
||||||
|
add_binary "sed"
|
||||||
|
add_binary "pkill"
|
||||||
|
|
||||||
|
add_runscript
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
help()
|
||||||
|
{
|
||||||
|
cat <<HELPEOF
|
||||||
|
Mount a squashed flat-file directory with AUFS3 on /
|
||||||
|
HELPEOF
|
||||||
|
}
|
110
extra/pre-build.d/usr/lib/initcpio/install/ssh
Normal file
110
extra/pre-build.d/usr/lib/initcpio/install/ssh
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
get_fingerprint() {
|
||||||
|
local keyfile="$1"
|
||||||
|
dropbearkey -y -f "${keyfile}" | sed -n '/^Fingerprint:/ {s/Fingerprint: *//; p}'
|
||||||
|
}
|
||||||
|
|
||||||
|
display_fingerprints() {
|
||||||
|
local keyfile
|
||||||
|
|
||||||
|
for keyfile in "/etc/dropbear/dropbear_dss_host_key" "/etc/dropbear/dropbear_rsa_host_key" ; do
|
||||||
|
if [ ! -r "${keyfile}" ] ; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
echo "$(basename "${keyfile}") : $(get_fingerprint "${keyfile}")"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
copy_openssh_keys() {
|
||||||
|
local osshrsa="/etc/ssh/ssh_host_rsa_key"
|
||||||
|
local osshdsa="/etc/ssh/ssh_host_dsa_key"
|
||||||
|
|
||||||
|
local dbpre="/etc/dropbear/dropbear_"
|
||||||
|
|
||||||
|
[ -f "$osshrsa" ] && [ -f "$osshdsa" ] || return 1
|
||||||
|
|
||||||
|
dropbearconvert openssh dropbear $osshrsa ${dbpre}rsa_host_key
|
||||||
|
dropbearconvert openssh dropbear $osshdsa ${dbpre}dss_host_key
|
||||||
|
}
|
||||||
|
|
||||||
|
generate_keys() {
|
||||||
|
local keyfile keytype
|
||||||
|
for keytype in dss rsa ; do
|
||||||
|
keyfile="/etc/dropbear/dropbear_${keytype}_host_key"
|
||||||
|
echo "Generating ${keytype} host key for dropbear ..."
|
||||||
|
dropbearkey -t "${keytype}" -f "${keyfile}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
make_etc_passwd() {
|
||||||
|
echo 'root:x:0:0:root:/:/bin/ash' > "${TMPDIR}"/passwd
|
||||||
|
}
|
||||||
|
|
||||||
|
build ()
|
||||||
|
{
|
||||||
|
#
|
||||||
|
# Begin real processing
|
||||||
|
#
|
||||||
|
|
||||||
|
# Are we even needed?
|
||||||
|
if [ ! -e "/etc/dropbear/root_key" ]; then
|
||||||
|
echo "There is no root key in /etc/dropbear/root_key existent; exit"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if TMPDIR is set leave it alone otherwise set
|
||||||
|
[ -z $TMPDIR ] && TMPDIR='/tmp/dropbear_initrd_encrypt'
|
||||||
|
|
||||||
|
# check if TMPDIR exsists if not make it
|
||||||
|
[ -d $TMPDIR ] || mkdir -p $TMPDIR
|
||||||
|
|
||||||
|
umask 0022
|
||||||
|
|
||||||
|
[ -d /etc/dropbear ] && mkdir -p /etc/dropbear
|
||||||
|
|
||||||
|
display_fingerprints || copy_openssh_keys || generate_keys
|
||||||
|
|
||||||
|
[ -e "${TMPDIR}/passwd" ] && ( grep -q -e '^root:' "${TMPDIR}/passwd" ) || make_etc_passwd
|
||||||
|
|
||||||
|
add_checked_modules "/drivers/net/"
|
||||||
|
add_binary "rm"
|
||||||
|
add_binary "dropbear"
|
||||||
|
add_binary "killall"
|
||||||
|
|
||||||
|
echo '/bin/ash' > "${TMPDIR}"/shells
|
||||||
|
add_file "${TMPDIR}/shells" "/etc/shells"
|
||||||
|
|
||||||
|
cat /etc/dropbear/root_key > "${TMPDIR}"/authorized_keys
|
||||||
|
|
||||||
|
add_dir "/.ssh"
|
||||||
|
add_file "${TMPDIR}/authorized_keys" "/.ssh/authorized_keys"
|
||||||
|
add_file "${TMPDIR}/passwd" "/etc/passwd"
|
||||||
|
add_dir "/etc/dropbear"
|
||||||
|
add_file "/etc/dropbear/dropbear_rsa_host_key"
|
||||||
|
add_file "/etc/dropbear/dropbear_dss_host_key"
|
||||||
|
add_file "/lib/libnss_files.so.2"
|
||||||
|
add_binary "ip" "/sbin/ip"
|
||||||
|
add_dir "/var/run"
|
||||||
|
|
||||||
|
touch "${TMPDIR}"/lastlog
|
||||||
|
add_dir "/var/log"
|
||||||
|
add_file "${TMPDIR}/lastlog" "/var/log/lastlog"
|
||||||
|
add_binary "/usr/lib/initcpio/ipconfig" "/bin/ipconfig"
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
rm "${TMPDIR}/shells"
|
||||||
|
rm "${TMPDIR}/authorized_keys"
|
||||||
|
rm "${TMPDIR}/passwd"
|
||||||
|
rm "${TMPDIR}/lastlog"
|
||||||
|
|
||||||
|
add_runscript
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
help ()
|
||||||
|
{
|
||||||
|
cat<<HELPEOF
|
||||||
|
Allow SSH access to an initial environment for debugging.
|
||||||
|
HELPEOF
|
||||||
|
}
|
30
lib/00-im_batman.func.sh
Normal file
30
lib/00-im_batman.func.sh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
function im_batman {
|
||||||
|
set +e # false errors are bad mmk
|
||||||
|
# Detect the distro and set some vars
|
||||||
|
if [ -f "/usr/bin/yum" ]; # CentOS/Redhat, etc.
|
||||||
|
then
|
||||||
|
OS_STRING='RHEL-like'
|
||||||
|
DISTRO='RHEL'
|
||||||
|
INST_CMD='yum -y install '
|
||||||
|
elif [ -f "/usr/bin/pacman" ]; # Arch, Manjaro, etc.
|
||||||
|
then
|
||||||
|
OS_STRING='Arch-like'
|
||||||
|
DISTRO='Arch'
|
||||||
|
INST_CMD='pacman -S '
|
||||||
|
elif [ -f "/usr/bin/emerge" ]; # Gentoo
|
||||||
|
then
|
||||||
|
OS_STRING='Gentoo-like'
|
||||||
|
DISTRO='Gentoo'
|
||||||
|
INST_CMD='emerge '
|
||||||
|
elif [ -f "/usr/bin/apt-get" ]; # Debian, Ubuntu (and derivatives), etc.
|
||||||
|
then
|
||||||
|
OS_STRING='Debian-like'
|
||||||
|
DISTRO="Debian"
|
||||||
|
INST_CMD='apt-get install '
|
||||||
|
else
|
||||||
|
echo 'Sorry, I cannot detect which distro you are running. Please report this along with what distro you are running. Dying now.'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -e # and turn this back on lolz
|
||||||
|
}
|
11
lib/01-holla_atcha_boi.func.sh
Normal file
11
lib/01-holla_atcha_boi.func.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
function holla_atcha_boi {
|
||||||
|
# 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}
|
||||||
|
${BASEDIR}/lib/mk.chroot.sh
|
||||||
|
touch ${LOCKFILE}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
50
lib/02-release_me.func.sh
Normal file
50
lib/02-release_me.func.sh
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
function 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}"
|
||||||
|
}
|
39
lib/03-facehugger.func.sh
Normal file
39
lib/03-facehugger.func.sh
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
function 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}
|
||||||
|
}
|
||||||
|
|
29
lib/04-chroot_wrapper.func.sh
Normal file
29
lib/04-chroot_wrapper.func.sh
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
function 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}"
|
||||||
|
}
|
61
lib/05-jenny_craig.func.sh
Normal file
61
lib/05-jenny_craig.func.sh
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
function 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
|
||||||
|
cp -af ${CHROOTDIR}/usr/share/zoneinfo/EST5EDT ${CHROOTDIR}/etc/localtime
|
||||||
|
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 '{}' \;
|
||||||
|
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/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}/usr/src/*
|
||||||
|
rm -rf ${BUILDDIR}/var/log/*
|
||||||
|
rm -rf ${BUILDDIR}/.git
|
||||||
|
CHROOTDIR="${CHROOTDIR_GLOB}"
|
||||||
|
BUILDDIR="${BUILDDIR_GLOB}"
|
||||||
|
}
|
||||||
|
|
70
lib/06-centos_is_stupid.func.sh
Normal file
70
lib/06-centos_is_stupid.func.sh
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
function centos_is_stupid {
|
||||||
|
echo "Checking for appropriate kernel version and mksquashfs version..."
|
||||||
|
SQFS_VER=$(mksquashfs -version 2>&1 | head -n1 | awk '{print $3}' | sed -re 's/(^[0-9]*\.[0-9]*).*$/\1/g')
|
||||||
|
KERN_VER=$(uname -r | cut -f1 -d"-")
|
||||||
|
SQUASH_OPTS="-noappend -comp xz"
|
||||||
|
|
||||||
|
set +e
|
||||||
|
ver_check() {
|
||||||
|
[ "$1" == "$2" ] && return 10
|
||||||
|
ver1front=`echo $1 | cut -d "." -f -1`
|
||||||
|
ver1back=`echo $1 | cut -d "." -f 2-`
|
||||||
|
ver2front=`echo $2 | cut -d "." -f -1`
|
||||||
|
ver2back=`echo $2 | cut -d "." -f 2-`
|
||||||
|
if [ "$ver1front" != "$1" ] || [ "$ver2front" != "$2" ]; then
|
||||||
|
[ "$ver1front" -gt "$ver2front" ] && return 11
|
||||||
|
[ "$ver1front" -lt "$ver2front" ] && return 9
|
||||||
|
[ "$ver1front" == "$1" ] || [ -z "$ver1back" ] && ver1back=0
|
||||||
|
[ "$ver2front" == "$2" ] || [ -z "$ver2back" ] && ver2back=0
|
||||||
|
ver_check "$ver1back" "$ver2back"
|
||||||
|
return $?
|
||||||
|
else
|
||||||
|
[ "$1" -gt "$2" ] && return 11 || return 9
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
ver_check ${KERN_VER} "2.6.38"
|
||||||
|
KERNTEST=${?}
|
||||||
|
ver_check ${SQFS_VER} "4.2"
|
||||||
|
SQFSTEST=${?}
|
||||||
|
if [ ${KERNTEST} -lt "10" ];
|
||||||
|
then
|
||||||
|
echo "You need a newer kernel to even think about doing this. (>= 2.6.38)"
|
||||||
|
echo "If you're on CentOS, there are 3.x branches available via the elrepo repository."
|
||||||
|
echo "I recommend the 'kernel-lt' package from there."
|
||||||
|
echo "Bailing out."
|
||||||
|
exit 1
|
||||||
|
#elif [ ${SQFS_VER} -ge "4.2" ] && [ ${KERN_VER} -ge "2.6.38" ];
|
||||||
|
elif [ ${SQFSTEST} -ge "10" ] && [ ${KERNTEST} -ge "10" ];
|
||||||
|
then
|
||||||
|
#echo "Awesome; your mksquashfs (if found) is not less than v4.2."
|
||||||
|
SQUASH_CMD=$(which mksquashfs)
|
||||||
|
if [ ${?} != "0" ];
|
||||||
|
then
|
||||||
|
echo "...Except you need to install whatever package you need to for mksquashfs."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
SQUASH_CMD=$(which mksquashfs)
|
||||||
|
fi
|
||||||
|
elif [ ${SQFSTEST} -lt "10" ] && [ ${KERNTEST} -ge "10" ];
|
||||||
|
then
|
||||||
|
if [ ! -f ${SRCDIR}/squashfs4.2/squashfs-tools/mksquashfs ];
|
||||||
|
then
|
||||||
|
echo "Boy howdy. We need to compile a custom version of the squashfs-tools because you aren't running a version that supports XZ. Give me a second."
|
||||||
|
set -e
|
||||||
|
mkdir -p ${SRCDIR} ${ROOTDIR}/bin
|
||||||
|
cd ${SRCDIR}
|
||||||
|
#wget --quiet -O squashfs4.2.tar.gz "http://downloads.sourceforge.net/project/squashfs/squashfs/squashfs4.2/squashfs4.2.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fsquashfs%2Ffiles%2F&ts=1387047818&use_mirror=hivelocity"
|
||||||
|
curl -o squashfs4.2.tar.gz "http://downloads.sourceforge.net/project/squashfs/squashfs/squashfs4.2/squashfs4.2.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fsquashfs%2Ffiles%2F&ts=1387047818&use_mirror=hivelocity" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||||
|
tar -zxf squashfs4.2.tar.gz
|
||||||
|
cd squashfs4.2/squashfs-tools
|
||||||
|
make clean
|
||||||
|
sed -i -e 's/^#\(XZ_SUPPORT\)/\1/g' Makefile
|
||||||
|
make
|
||||||
|
SQUASH_CMD="${SRCDIR}/squashfs4.2/squashfs-tools/mksquashfs"
|
||||||
|
else
|
||||||
|
echo "Using custom-compiled mksquashfs from an earlier run."
|
||||||
|
SQUASH_CMD="${SRCDIR}/squashfs4.2/squashfs-tools/mksquashfs"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
set -e
|
||||||
|
}
|
77
lib/07-will_it_blend.func.sh
Normal file
77
lib/07-will_it_blend.func.sh
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
function will_it_blend () {
|
||||||
|
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.
|
||||||
|
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 ${ROOTDIR}
|
||||||
|
else
|
||||||
|
cd ${ROOTDIR}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generate the mtree spec.
|
||||||
|
# Not really necessary anymore.
|
||||||
|
#mtree -c -p ${ROOTDIR}/chroot -K flags,gid,mode,nlink,uid,link,time,type > ${ROOTDIR}/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}/*
|
||||||
|
cp -af ${BASEDIR}/extra/${UXNAME}.png ${TEMPDIR}/.
|
||||||
|
cp -af ${BASEDIR}/extra/${UXNAME}.png ${TFTPDIR}/.
|
||||||
|
mkdir -p ${TEMPDIR}/boot
|
||||||
|
cp -af ${CHROOTDIR}/boot/initramfs-linux-${PNAME}.img ${TEMPDIR}/boot/${UXNAME}.${ARCHSUFFIX}.img
|
||||||
|
cp -af ${CHROOTDIR}/boot/vmlinuz-linux-${PNAME} ${TEMPDIR}/boot/${UXNAME}.${ARCHSUFFIX}.kern
|
||||||
|
cp -af ${CHROOTDIR}/boot/initramfs-linux-${PNAME}.img ${TFTPDIR}/${UXNAME}.${ARCHSUFFIX}.img
|
||||||
|
cp -af ${CHROOTDIR}/boot/vmlinuz-linux-${PNAME} ${TFTPDIR}/${UXNAME}.${ARCHSUFFIX}.kern
|
||||||
|
cp -af ${ARCHBOOT}/* ${HTTPDIR}/${DISTNAME}/.
|
||||||
|
chown -R ${HTTPUSR}:${HTTPGRP} ${HTTPDIR}
|
||||||
|
chown ${TFTPUSR}:${TFTPGRP} ${TFTPDIR}/${UXNAME}.*
|
||||||
|
}
|
106
lib/08-stuffy.func.sh
Normal file
106
lib/08-stuffy.func.sh
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
function 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 gummiboot pkg. lets us boot on UEFI machines with secureboot still enabled.
|
||||||
|
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/gummiboot/gummibootx64.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://svn.code.sf.net/p/edk2/code/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi >> "${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://svn.code.sf.net/p/edk2/code/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi >> "${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}_ram
|
||||||
|
EOF
|
||||||
|
cat > ${TEMPDIR}/loader/entries/${UXNAME}_ram.conf << EOF
|
||||||
|
title ${PNAME}
|
||||||
|
linux /boot/${UXNAME}.kern
|
||||||
|
initrd /boot/${UXNAME}.img
|
||||||
|
options copytoram archisobasedir=${DISTNAME} archisolabel=${DISTNAME}
|
||||||
|
EOF
|
||||||
|
cat > ${TEMPDIR}/loader/entries/${UXNAME}.conf << EOF
|
||||||
|
title ${PNAME} (Run from 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..."
|
||||||
|
FTSIZE=$(du -sc ${TEMPDIR}/{boot,EFI,loader} | tail -n1 | awk '{print $1}')
|
||||||
|
FATSIZE=$((${FTSIZE} + 64)) # let's give a little wiggle room
|
||||||
|
${RACECAR_CHK}truncate -s "${FATSIZE}"K ${TEMPDIR}/EFI/${DISTNAME}/efiboot.img
|
||||||
|
${RACECAR_CHK}mkfs.vfat -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}_ram
|
||||||
|
EOF
|
||||||
|
cat > ${SRCDIR}/efiboot/loader/entries/${UXNAME}_ram.conf << EOF
|
||||||
|
title ${PNAME}
|
||||||
|
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} (Run from 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 ${BASEDIR}/root.x86_64/usr/lib/prebootloader/PreLoader.efi ${SRCDIR}/efiboot/EFI/boot/bootx64.efi
|
||||||
|
cp ${BASEDIR}/root.x86_64/usr/lib/prebootloader/HashTool.efi ${SRCDIR}/efiboot/EFI/boot/.
|
||||||
|
cp ${BASEDIR}/root.x86_64/usr/lib/gummiboot/gummibootx64.efi ${SRCDIR}/efiboot/EFI/boot/loader.efi # TODO: can i use syslinux.efi instead?
|
||||||
|
cp ${TEMPDIR}/EFI/shellx64_v* ${SRCDIR}/efiboot/EFI/.
|
||||||
|
umount ${SRCDIR}/efiboot
|
||||||
|
echo "EFI configuration complete..."
|
||||||
|
|
||||||
|
}
|
||||||
|
|
296
lib/09-yo_dj.func.sh
Normal file
296
lib/09-yo_dj.func.sh
Normal file
@ -0,0 +1,296 @@
|
|||||||
|
function yo_dj () {
|
||||||
|
ARCH="${1}"
|
||||||
|
echo "Building the actual .iso image. This may take a while."
|
||||||
|
im_batman
|
||||||
|
ISOFILENAME="${UXNAME}-${VERSION}.iso"
|
||||||
|
if [[ "${MULTIARCH}" == "y" ]];
|
||||||
|
then
|
||||||
|
ISOFILENAME="${UXNAME}-${VERSION}-any.iso"
|
||||||
|
else
|
||||||
|
ISOFILENAME="${UXNAME}-${VERSION}-${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}_ram_64 -- ${UXNAME}_ram_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}_ram_64
|
||||||
|
|
||||||
|
LABEL ${UXNAME}_ram_64
|
||||||
|
MENU LABEL ^1) ${PNAME} (run from RAM) (Default)
|
||||||
|
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}
|
||||||
|
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}_ram_32
|
||||||
|
|
||||||
|
## 32 BIT
|
||||||
|
LABEL ${UXNAME}_ram_32
|
||||||
|
MENU LABEL ^1) ${PNAME} (run from RAM) (Default)
|
||||||
|
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}
|
||||||
|
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}_ram_${ARCH}
|
||||||
|
|
||||||
|
LABEL ${UXNAME}_ram_${ARCH}
|
||||||
|
MENU LABEL ^1) ${PNAME} (run from RAM) (Default)
|
||||||
|
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}
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
#isohybrid ${ISOFILENAME}
|
||||||
|
cd ${ISODIR}
|
||||||
|
${RACECAR_CHK}sha256sum ${ISOFILENAME} > ${ISOFILENAME}.sha256
|
||||||
|
cd ..
|
||||||
|
echo "ISO generated; size is $(ls -lh ${ISODIR}/${ISOFILENAME} | awk '{print $5}')."
|
||||||
|
echo "SHA256 sum is: $(awk '{print $1}' ${ISODIR}/${ISOFILENAME}.sha256)"
|
||||||
|
echo "You can find it at ${ISODIR}/${ISOFILENAME}"
|
||||||
|
#rm -rf ${TEMPDIR}/*
|
||||||
|
|
||||||
|
# are we rsyncing?
|
||||||
|
if [ -n "${RSYNC_HOST}" ];
|
||||||
|
then
|
||||||
|
rsync -a ${TFTPDIR}/. ${RSYNC_HOST}:${RSYNC_DEST}/tftpboot/.
|
||||||
|
rsync -a ${HTTPDIR}/. ${RSYNC_HOST}:${RSYNC_DEST}/http/.
|
||||||
|
# rsync -a ${TEMPDIR}/boot/${UXNAME}.* ${RSYNC_HOST}:${RSYNC_DEST}/http/.
|
||||||
|
rsync -a ${ISODIR}/. ${RSYNC_HOST}:${RSYNC_DEST}/iso/.
|
||||||
|
rsync -a ${ROOTDIR}/extra/. ${RSYNC_HOST}:${RSYNC_DEST}/extra/.
|
||||||
|
fi
|
||||||
|
}
|
104
lib/10-mentos.func.sh
Normal file
104
lib/10-mentos.func.sh
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
function 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-${PNAME}) ]];
|
||||||
|
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-${PNAME} | 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"-")
|
||||||
|
|
||||||
|
if [[ -n $(find ${BASEDIR}/extra/pre-build.d/ -type f -newer ${BASEDIR}/root.x86_64/boot/vmlinuz-linux-${PNAME}) ]] || [[ "${INSTKERN}" != "${NEWKERN}" ]];
|
||||||
|
then
|
||||||
|
${CHROOTCMD} ${i}/ bash -c "${RACECAR_CHK}yaourt -Syyua --noconfirm --devel" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||||
|
else
|
||||||
|
${CHROOTCMD} ${i}/ bash -c "${RACECAR_CHK}yaourt -Syyua --noconfirm --devel --ignore linux,linux-${PNAME}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||||
|
fi
|
||||||
|
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%.pacorig} ; done
|
||||||
|
${CHROOTCMD} ${i}/ bash -c "${RACECAR_CHK}yaourt -S --needed --ignore linux,linux-${PNAME} --noconfirm ${PKGLIST}" >> "${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 "yaourt -S --needed --noconfirm ${PKGLIST}"
|
||||||
|
if [[ -n $(find ${BASEDIR}/extra/pre-build.d/ -type f -newer root.x86_64/boot/vmlinuz-linux-${PNAME}) ]];
|
||||||
|
then
|
||||||
|
${CHROOTCMD} ${i}/ bash -c "${RACECAR_CHK}mkinitcpio -p linux-${PNAME}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||||
|
fi
|
||||||
|
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}yaourt -S --needed --noconfirm ${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 "${RACECAR_CHK}yaourt -S --needed --noconfirm ${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 "yaourt -S --needed --noconfirm ${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 '{}' \;
|
||||||
|
echo "Done."
|
||||||
|
|
||||||
|
}
|
275
lib/mk.chroot.sh
Executable file
275
lib/mk.chroot.sh
Executable file
@ -0,0 +1,275 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
if [[ "${I_AM_A_RACECAR}" == "y" ]];
|
||||||
|
then
|
||||||
|
RACECAR_CHK='nice -n "-19" '
|
||||||
|
else
|
||||||
|
RACECAR_CHK=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "${BASEDIR}"
|
||||||
|
|
||||||
|
## Set some vars.
|
||||||
|
MIRROR='http://mirrors.kernel.org/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}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
curl -o latest.64.tar.gz "${RLSDIR}/${CURRLS64}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||||
|
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}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
curl -o latest.32.tar.gz "${RLSDIR}/${CURRLS32}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||||
|
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
|
||||||
|
done
|
||||||
|
|
||||||
|
# And make it usable.
|
||||||
|
echo "Initializing chroots..."
|
||||||
|
|
||||||
|
for i in ${CHROOTDIR32} ${CHROOTDIR64};
|
||||||
|
do
|
||||||
|
echo "Prepping ${i}. This will take a while..."
|
||||||
|
echo -n "...Key initializing..."
|
||||||
|
${CHROOTCMD} ${i}/ ${RACECAR_CHK}pacman-key --init >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||||
|
echo "Done."
|
||||||
|
echo -n "...Importing keys..."
|
||||||
|
${CHROOTCMD} ${i}/ ${RACECAR_CHK}pacman-key --populate archlinux >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||||
|
echo "Done."
|
||||||
|
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 >> "${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}/ ${RACECAR_CHK}pacman -Syyu --noconfirm >> "${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 yaourt >> "${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-devel >> "${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
|
||||||
|
|
||||||
|
# preprocessing
|
||||||
|
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' ' ')
|
||||||
|
for i in ${CHROOTDIR32} ${CHROOTDIR64};
|
||||||
|
do
|
||||||
|
echo -n "...Packages installing to ${i}..."
|
||||||
|
${CHROOTCMD} ${i}/ bash -c "yaourt -S --needed --noconfirm customizepkg-scripting" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||||
|
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%%.pacorig} ; done
|
||||||
|
echo -n "Compiling kernel sources..."
|
||||||
|
set +e
|
||||||
|
${CHROOTCMD} ${i}/ bash -c "${RACECAR_CHK}yaourt -S --needed --noconfirm linux" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||||
|
set -e
|
||||||
|
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%%.pacorig} ; done
|
||||||
|
echo -n "Regular packages..."
|
||||||
|
set +e
|
||||||
|
${CHROOTCMD} ${i}/ bash -c "yes '' | ${RACECAR_CHK}yaourt -S --needed --noconfirm ${PKGLIST}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||||
|
set -e
|
||||||
|
for x in $(find ${i}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%%.pacorig} ; done
|
||||||
|
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
|
||||||
|
echo "${REGUSR} ALL=(ALL) ALL" >> ${i}/etc/sudoers.d/${REGUSR}
|
||||||
|
echo "Done."
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in ${CHROOTDIR32} ${CHROOTDIR64};
|
||||||
|
do
|
||||||
|
${CHROOTCMD} ${i}/ bash -c "${RACECAR_CHK}mkinitcpio -p linux-${PNAME}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||||
|
done
|
||||||
|
|
||||||
|
# 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 "${RACECAR_CHK}yaourt -S --needed --noconfirm ${PKGLIST}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||||
|
fi
|
||||||
|
for x in $(find ${CHROOTDIR32}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%.pacorig} ; done
|
||||||
|
echo "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 "${RACECAR_CHK}yaourt -S --needed --noconfirm ${PKGLIST}" >> "${LOGFILE}.${FUNCNAME}" 2>&1
|
||||||
|
fi
|
||||||
|
for x in $(find ${CHROOTDIR64}/etc/ -type f -iname "*.pacorig");do mv -f ${x} ${x%.pacorig} ; done
|
||||||
|
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 '{}' \;
|
||||||
|
echo "Done."
|
||||||
|
|
||||||
|
|
||||||
|
rm -f ${LOCKFILE}
|
||||||
|
|
||||||
|
echo "Chroot setup complete."
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
mkchroot
|
0
overlay/32/.keepme
Normal file
0
overlay/32/.keepme
Normal file
0
overlay/64/.keepme
Normal file
0
overlay/64/.keepme
Normal file
62
overlay/etc/lxdm/lxdm.conf
Normal file
62
overlay/etc/lxdm/lxdm.conf
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
[base]
|
||||||
|
## uncomment and set autologin username to enable autologin
|
||||||
|
#autologin=bdisk
|
||||||
|
|
||||||
|
## uncomment and set timeout to enable timeout autologin,
|
||||||
|
## the value should >=5
|
||||||
|
# timeout=10
|
||||||
|
|
||||||
|
## default session or desktop used when no systemwide config
|
||||||
|
# session=/usr/bin/startlxde
|
||||||
|
|
||||||
|
## uncomment and set to set numlock on your keyboard
|
||||||
|
# numlock=0
|
||||||
|
|
||||||
|
## set this if you don't want to put xauth file at ~/.Xauthority
|
||||||
|
# xauth_path=/tmp
|
||||||
|
|
||||||
|
# not ask password for users who have empty password
|
||||||
|
# skip_password=1
|
||||||
|
|
||||||
|
## greeter used to welcome the user
|
||||||
|
greeter=/usr/lib/lxdm/lxdm-greeter-gtk
|
||||||
|
|
||||||
|
[server]
|
||||||
|
## arg used to start xserver, not fully function
|
||||||
|
arg=/usr/bin/X -background vt1
|
||||||
|
# uncomment this if you really want xserver listen to tcp
|
||||||
|
# tcp_listen=1
|
||||||
|
# uncoment this if you want reset the xserver after logou
|
||||||
|
# reset=1
|
||||||
|
|
||||||
|
[display]
|
||||||
|
## gtk theme used by greeter
|
||||||
|
gtk_theme=Clearlooks
|
||||||
|
|
||||||
|
## background of the greeter
|
||||||
|
# bg=/usr/share/backgrounds/default.png
|
||||||
|
|
||||||
|
## if show bottom pane
|
||||||
|
bottom_pane=1
|
||||||
|
|
||||||
|
## if show language select control
|
||||||
|
lang=1
|
||||||
|
|
||||||
|
## if show keyboard layout select control
|
||||||
|
keyboard=0
|
||||||
|
|
||||||
|
## the theme of greeter
|
||||||
|
theme=Industrial
|
||||||
|
|
||||||
|
[input]
|
||||||
|
|
||||||
|
[userlist]
|
||||||
|
## if disable the user list control at greeter
|
||||||
|
disable=0
|
||||||
|
|
||||||
|
## whitelist user
|
||||||
|
white=
|
||||||
|
|
||||||
|
## blacklist user
|
||||||
|
black=
|
||||||
|
|
9
overlay/etc/systemd/scripts/livecd.fix.sh
Executable file
9
overlay/etc/systemd/scripts/livecd.fix.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#/bin/sh -
|
||||||
|
|
||||||
|
#chmod 4755 /opt/google/chrome-beta/chrome-sandbox
|
||||||
|
mkdir -p /var/db/sudo/lectured
|
||||||
|
touch /var/db/sudo/lectured/bdisk
|
||||||
|
chmod 700 /var/db/sudo/lectured
|
||||||
|
chgrp bdisk /var/db/sudo/lectured/bdisk
|
||||||
|
chmod 600 /var/db/sudo/lectured/bdisk
|
||||||
|
chmod 4755 /usr/bin/sudo
|
@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/NetworkManager.service
|
@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/NetworkManager-dispatcher.service
|
1
overlay/etc/systemd/system/getty.target.wants/getty@tty1.service
Symbolic link
1
overlay/etc/systemd/system/getty.target.wants/getty@tty1.service
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/getty@.service
|
@ -0,0 +1,5 @@
|
|||||||
|
#[Service]
|
||||||
|
##Type=simple
|
||||||
|
#Type=idle
|
||||||
|
#ExecStart=
|
||||||
|
#ExecStart=-/usr/bin/agetty --autologin bdisk --noclear %I 38400 linux
|
11
overlay/etc/systemd/system/livecdfix.service
Normal file
11
overlay/etc/systemd/system/livecdfix.service
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Various LiveCD fixes
|
||||||
|
After=pacmandb.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/bin/bash /etc/systemd/scripts/livecd.fix.sh
|
||||||
|
RemainAfterExit=yes
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/NetworkManager.service
|
@ -0,0 +1 @@
|
|||||||
|
/etc/systemd/system/livecdfix.service
|
@ -0,0 +1 @@
|
|||||||
|
/etc/systemd/system/pacmandb.service
|
1
overlay/etc/systemd/system/multi-user.target.wants/sshd.service
Symbolic link
1
overlay/etc/systemd/system/multi-user.target.wants/sshd.service
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
/usr/lib/systemd/system/sshd.service
|
10
overlay/etc/systemd/system/pacmandb.service
Normal file
10
overlay/etc/systemd/system/pacmandb.service
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Restoring Installed Packages DB
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/bin/tar -Jxf /usr/local/pacman.db.tar.xz -C /var/lib/pacman/
|
||||||
|
RemainAfterExit=yes
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user