Commit 9fb44a00 authored by udeved's avatar udeved
Browse files

Merge pull request #116 from manjaro/devel

Devel
parents 3f97b400 276d2a1b
V=0.9.9
Version=0.9.9
PREFIX = /usr/local
SYSCONFDIR = /etc
BINPROGS = \
BIN = \
bin/mkchroot \
bin/basestrap \
bin/manjaro-chroot \
bin/fstabgen \
bin/buildset \
bin/chroot-run
BIN_PKG = \
bin/checkpkg \
bin/lddd \
bin/finddeps \
bin/find-libdeps \
bin/signpkg \
bin/signpkgs \
bin/mkchroot \
bin/mkchrootpkg \
bin/buildpkg \
bin/basestrap \
bin/manjaro-chroot \
bin/fstabgen \
bin/buildset \
bin/chroot-run \
bin/buildiso \
bin/testiso \
bin/buildtree
SYSCONFIGFILES = \
BIN_ISO = \
bin/buildiso \
bin/testiso
SYSCONF = \
conf/manjaro-tools.conf
SETS_PKG = \
......@@ -34,40 +38,51 @@ SETS_ISO = \
sets/iso/community.set \
sets/iso/openrc.set
CONFIGFILES = \
conf/makepkg-i686.conf \
conf/makepkg-x86_64.conf \
SHARED = \
conf/pacman-default.conf \
conf/pacman-multilib.conf \
conf/pacman-mirrors-stable.conf \
conf/pacman-mirrors-testing.conf \
conf/pacman-mirrors-unstable.conf \
conf/pacman-mirrors-unstable.conf
SHARED_PKG = \
conf/makepkg-i686.conf \
conf/makepkg-x86_64.conf
SHARED_ISO = \
conf/pacman-gfx.conf \
conf/pacman-lng.conf \
conf/profile.conf.example
LIBS = \
lib/util.sh \
lib/util-mount.sh \
lib/util-msg.sh \
lib/util-fstab.sh
LIBS_PKG = \
lib/util-pkg.sh \
lib/util-fstab.sh \
lib/util-pkgtree.sh
LIBS_ISO = \
lib/util-iso.sh \
lib/util-iso-aufs.sh \
lib/util-iso-overlayfs.sh \
lib/util-iso-image.sh \
lib/util-iso-calamares.sh \
lib/util-livecd.sh \
lib/util-iso-boot.sh \
lib/util-iso-log.sh \
lib/util-pkgtree.sh
lib/util-iso-log.sh
CPIOHOOKS = \
initcpio/hooks/miso \
initcpio/hooks/miso_overlayfs \
initcpio/hooks/miso_loop_mnt \
initcpio/hooks/miso_pxe_common \
initcpio/hooks/miso_pxe_http
CPIOINST = \
initcpio/inst/miso \
initcpio/inst/miso_overlayfs \
initcpio/inst/miso_loop_mnt \
initcpio/inst/miso_pxe_common \
initcpio/inst/miso_pxe_http \
......@@ -90,13 +105,13 @@ MAN_XML = \
manjaro-tools.conf.xml \
profile.conf.xml
all: $(BINPROGS) doc #bin/bash_completion bin/zsh_completion
all: $(BIN) $(BIN_PKG) $(BIN_ISO) doc #bin/bash_completion bin/zsh_completion
edit = sed -e "s|@pkgdatadir[@]|$(DESTDIR)$(PREFIX)/share/manjaro-tools|g" \
-e "s|@bindir[@]|$(DESTDIR)$(PREFIX)/bin|g" \
-e "s|@sysconfdir[@]|$(DESTDIR)$(SYSCONFDIR)/manjaro-tools|g" \
-e "s|@libdir[@]|$(DESTDIR)$(PREFIX)/lib/manjaro-tools|g" \
-e "s|@version@|${V}|"
-e "s|@version@|${Version}|"
%: %.in Makefile
@echo "GEN $@"
......@@ -110,67 +125,123 @@ doc:
$(foreach var,$(MAN_XML),xsltproc /usr/share/docbook2X/xslt/man/docbook.xsl docbook/$(var) | db2x_manxml --output-dir man ;)
clean:
rm -f $(BINPROGS) #bin/bash_completion bin/zsh_completion
rm -f $(BIN) ${BIN_PKG} ${BIN_ISO} #bin/bash_completion bin/zsh_completion
rm -rf man
install:
install_base:
install -dm0755 $(DESTDIR)$(SYSCONFDIR)/manjaro-tools
install -m0644 ${SYSCONFIGFILES} $(DESTDIR)$(SYSCONFDIR)/manjaro-tools
install -m0644 ${SYSCONF} $(DESTDIR)$(SYSCONFDIR)/manjaro-tools
install -dm0755 $(DESTDIR)$(PREFIX)/bin
install -m0755 ${BIN} $(DESTDIR)$(PREFIX)/bin
install -dm0755 $(DESTDIR)$(PREFIX)/lib/manjaro-tools
install -m0644 ${LIBS} $(DESTDIR)$(PREFIX)/lib/manjaro-tools
install -dm0755 $(DESTDIR)$(PREFIX)/share/manjaro-tools
install -m0644 ${SHARED} $(DESTDIR)$(PREFIX)/share/manjaro-tools
install -dm0755 $(DESTDIR)$(PREFIX)/share/man/man1
gzip -c man/buildset.1 > $(DESTDIR)$(PREFIX)/share/man/man1/buildset.1.gz
# install -Dm0644 bin/bash_completion $(DESTDIR)/$(PREFIX)/share/bash-completion/completions/manjaro_tools
# install -Dm0644 bin/zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_manjaro_tools
install_pkg:
install -dm0755 $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/sets/pkg
install -dm0755 $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/sets/iso
install -m0644 ${SETS_PKG} $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/sets/pkg
install -m0644 ${SETS_ISO} $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/sets/iso
install -dm0755 $(DESTDIR)$(PREFIX)/bin
install -m0755 ${BIN_PKG} $(DESTDIR)$(PREFIX)/bin
ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides
install -dm0755 $(DESTDIR)$(PREFIX)/lib/manjaro-tools
install -m0644 ${LIBS_PKG} $(DESTDIR)$(PREFIX)/lib/manjaro-tools
install -dm0755 $(DESTDIR)$(PREFIX)/share/manjaro-tools
install -m0644 ${SHARED_PKG} $(DESTDIR)$(PREFIX)/share/manjaro-tools
install -dm0755 $(DESTDIR)$(PREFIX)/share/man/man1
gzip -c man/buildpkg.1 > $(DESTDIR)$(PREFIX)/share/man/man1/buildpkg.1.gz
gzip -c man/buildtree.1 > $(DESTDIR)$(PREFIX)/share/man/man1/buildtree.1.gz
install_iso:
install -dm0755 $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/sets/iso
install -m0644 ${SETS_ISO} $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/sets/iso
install -dm0755 $(DESTDIR)$(PREFIX)/bin
install -m0755 ${BIN_ISO} $(DESTDIR)$(PREFIX)/bin
install -dm0755 $(DESTDIR)$(PREFIX)/lib/manjaro-tools
install -m0755 ${BINPROGS} $(DESTDIR)$(PREFIX)/bin
install -m0644 ${CONFIGFILES} $(DESTDIR)$(PREFIX)/share/manjaro-tools
ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides
install -m0644 ${LIBS} $(DESTDIR)$(PREFIX)/lib/manjaro-tools
install -m0644 ${LIBS_ISO} $(DESTDIR)$(PREFIX)/lib/manjaro-tools
install -dm0755 $(DESTDIR)$(PREFIX)/lib/initcpio/hooks
install -m0755 ${CPIOHOOKS} $(DESTDIR)$(PREFIX)/lib/initcpio/hooks
install -dm0755 $(DESTDIR)$(PREFIX)/lib/initcpio/install
install -m0755 ${CPIOINST} $(DESTDIR)$(PREFIX)/lib/initcpio/install
install -dm0755 $(DESTDIR)$(PREFIX)/share/manjaro-tools
install -m0644 ${SHARED_ISO} $(DESTDIR)$(PREFIX)/share/manjaro-tools
install -dm0755 $(DESTDIR)$(PREFIX)/share/manjaro-tools/scripts
install -m0644 ${SCRIPTS} $(DESTDIR)$(PREFIX)/share/manjaro-tools/scripts
install -dm0755 $(DESTDIR)$(PREFIX)/share/manjaro-tools/efi_shell
install -m0644 ${EFISHELL} $(DESTDIR)$(PREFIX)/share/manjaro-tools/efi_shell
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1
gzip -c man/buildset.1 > $(DESTDIR)$(PREFIX)/share/man/man1/buildset.1.gz
gzip -c man/buildpkg.1 > $(DESTDIR)$(PREFIX)/share/man/man1/buildpkg.1.gz
gzip -c man/buildtree.1 > $(DESTDIR)$(PREFIX)/share/man/man1/buildtree.1.gz
install -dm0755 $(DESTDIR)$(PREFIX)/share/man/man1
gzip -c man/buildiso.1 > $(DESTDIR)$(PREFIX)/share/man/man1/buildiso.1.gz
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man5
install -dm0755 $(DESTDIR)$(PREFIX)/share/man/man5
gzip -c man/manjaro-tools.conf.5 > $(DESTDIR)$(PREFIX)/share/man/man5/manjaro-tools.conf.5.gz
gzip -c man/profile.conf.5 > $(DESTDIR)$(PREFIX)/share/man/man5/profile.conf.5.gz
# install -Dm0644 bin/bash_completion $(DESTDIR)/$(PREFIX)/share/bash-completion/completions/manjaro_tools
# install -Dm0644 bin/zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_manjaro_tools
uninstall:
for f in ${SYSCONFIGFILES}; do rm -f $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/$$f; done
uninstall_base:
for f in ${SYSCONF}; do rm -f $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/$$f; done
for f in ${BIN}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done
for f in ${SHARED}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/$$f; done
for f in ${LIBS}; do rm -f $(DESTDIR)$(PREFIX)/lib/manjaro-tools/$$f; done
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/buildset.1.gz
# rm $(DESTDIR)/$(PREFIX)/share/bash-completion/completions/manjaro_tools
# rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_manjaro_tools
uninstall_pkg:
for f in ${SETS_PKG}; do rm -f $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/sets/pkg/$$f; done
for f in ${SETS_ISO}; do rm -f $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/sets/iso/$$f; done
for f in ${BINPROGS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done
for f in ${CONFIGFILES}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/$$f; done
for f in ${BIN_PKG}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done
rm -f $(DESTDIR)$(PREFIX)/bin/find-libprovides
for f in ${LIBS}; do rm -f $(DESTDIR)$(PREFIX)/lib/manjaro-tools/$$f; done
for f in ${SHARED_PKG}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/$$f; done
for f in ${LIBS_PKG}; do rm -f $(DESTDIR)$(PREFIX)/lib/manjaro-tools/$$f; done
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/buildpkg.1.gz
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/buildtree.1.gz
uninstall_iso:
for f in ${SETS_ISO}; do rm -f $(DESTDIR)$(SYSCONFDIR)/manjaro-tools/sets/iso/$$f; done
for f in ${BIN_ISO}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done
for f in ${SHARED_ISO}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/$$f; done
for f in ${LIBS_ISO}; do rm -f $(DESTDIR)$(PREFIX)/lib/manjaro-tools/$$f; done
for f in ${CPIOHOOKS}; do rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/hooks/$$f; done
for f in ${CPIOINST}; do rm -f $(DESTDIR)$(PREFIX)/lib/initcpio/install/$$f; done
for f in ${SCRIPTS}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/scripts/$$f; done
for f in ${EFISHELL}; do rm -f $(DESTDIR)$(PREFIX)/share/manjaro-tools/efi_shell/$$f; done
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/buildset.1.gz
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/buildpkg.1.gz
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/buildtree.1.gz
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/buildiso.1.gz
rm -f $(DESTDIR)$(PREFIX)/share/man/man5/manjaro-tools.conf.5.gz
rm -f $(DESTDIR)$(PREFIX)/share/man/man5/profile.conf.5.gz
# rm $(DESTDIR)/$(PREFIX)/share/bash-completion/completions/manjaro_tools
# rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_manjaro_tools
install: install_base install_pkg install_iso
uninstall: uninstall_base uninstall_pkg uninstall_iso
dist:
git archive --format=tar --prefix=manjaro-tools-$(V)/ $(V) | gzip -9 > manjaro-tools-$(V).tar.gz
gpg --detach-sign --use-agent manjaro-tools-$(V).tar.gz
git archive --format=tar --prefix=manjaro-tools-$(Version)/ $(Version) | gzip -9 > manjaro-tools-$(Version).tar.gz
gpg --detach-sign --use-agent manjaro-tools-$(Version).tar.gz
.PHONY: all clean install uninstall dist
......@@ -63,7 +63,8 @@ Specifying args will override manjaro-tools.conf settings.
# host_tree=https://github.com/manjaro
# host_tree_abs=https://projects.archlinux.org/git/svntogit
# default https seems slow; try this
# host_tree_abs=git://projects.archlinux.org/svntogit
################ buildpkg ################
......@@ -112,6 +113,10 @@ Specifying args will override manjaro-tools.conf settings.
# valid: md5, sha1, sha256, sha384, sha512
# iso_checksum=md5
# experimental; use overlayfs instead of aufs
# requires minimum 4.0 kernel on the build host and on iso in profile.conf
# use_overlayfs="false"
~~~
####Config files in iso profiles
......@@ -129,10 +134,22 @@ Each iso profile must have these files or symlinks to shared:
# possible values: openrc,systemd
# initsys="systemd"
# use multilib packages; x86_64 only
# multilib="true"
# displaymanager="lightdm"
# autologin
# autologin=true
# Set to false to disable autologin in the livecd
# autologin="true"
# nonfree xorg drivers
# nonfree_xorg="true"
# use plymouth; initcpio hook
# plymouth_boot="true"
# use pxe boot; initcpio hook
# pxe_boot="true"
################ install ################
......@@ -173,31 +190,29 @@ Each iso profile must have these files or symlinks to shared:
# unset defaults to given values
# names must match systemd service names
# services in start_systemd array don't need to be listed here
# start_systemd_live=('livecd' 'mhwd-live' 'pacman-init' 'pacman-boot')
# start_systemd_live=('livecd' 'mhwd-live' 'pacman-init')
# unset defaults to given values,
# names must match openrc service names
# services in start_openrc array don't need to be listed here
# start_openrc_live=('livecd' 'mhwd-live' 'pacman-init' 'pacman-boot')
# start_openrc_live=('livecd' 'mhwd-live' 'pacman-init')
~~~
######* Packages
Contains root image packages
ideally no xorg
* Contains root image packages
* ideally no xorg
######* Packages-Custom/desktop
Contains the custom image packages
desktop environment packages go here
* Contains the custom image packages
* desktop environment packages go here
* this file is joined at build time with shared/Packages-Custom to pull in shared desktop packages
######* Packages-Xorg
Contains the Xorg package repo
######* Packages-Lng
Contains the language packages repo
* Contains the Xorg package repo
######* Packages-Livecd
Contains packages you only want on livecd but not installed on the target system with installer
default files are in shared folder and can be symlinked or defined in a real file
* Contains packages you only want on livecd but not installed on the target system with installer
* default files are in shared folder and can be symlinked or defined in a real file
###### optional custom pacman.conf in profile
......@@ -259,14 +274,17 @@ You can drop the branch arg if you set the branch in manjaro-tools.conf
The arch can also be set in manjaro-tools.conf, but under normal conditions, it is better to specify the non native arch by -a parameter.
######* -c
Removes the chroot dir
If the -c parameter is not used, buildpkg will update the existing chroot or create a new one if none is present.
* Removes the chroot dir
* If the -c parameter is not used, buildpkg will update the existing chroot or create a new one if none is present.
######* -w
Cleans pkgcache, and logfiles
* Cleans pkgcache, and logfiles
######* -s
Signs the package when built
* Signs the package when built
######* -n
Installs the built package in the chroot and runs a namcap check
* Installs the built package in the chroot and runs a namcap check
###3. buildiso
......@@ -291,8 +309,6 @@ Usage: buildiso [options]
-t <dir> Target directory
[default: /var/cache/manjaro-tools/iso]
-c Disable clean work dir
-x Clean xorg cache
-l Clean lng cache
-i Build images only
-s Generate iso only
Requires pre built images (-i)
......@@ -320,14 +336,11 @@ The branch can be defined also in manjaro-tools.conf, but a manual parameter wil
####Special parameters
######* -i
Build images only
will stop after all packages have been installed. No iso sqfs compression will be executed
* Build images only
* will stop after all packages have been installed. No iso sqfs compression will be executed
######* -s
Use this to sqfs compress the chroots if you previously used -i.
######* -x
By default, xorg package cache is not cleaned on every build. Enabling the xorg cache cleaning will result in dowloading the xorg drivers.
######* -l
By default, lng package cache is not cleaned on every build. Enabling the lng cache cleaning will result in dowloading the lng packages.
* Use this to sqfs compress the chroots if you previously used -i.
###4. buildset
......
......@@ -28,17 +28,17 @@ show_profile(){
msg2 "work_dir: ${work_dir}"
msg2 "iso_file: ${iso_file}"
msg2 "is_custom_pac_conf: ${is_custom_pac_conf}"
msg2 "initsys: ${initsys}"
[[ ${arch} == 'x86_64' ]] && msg2 "multilib: ${multilib}"
msg2 "displaymanager: ${displaymanager}"
msg2 "default_desktop_executable: ${default_desktop_executable}"
msg2 "default_desktop_file: ${default_desktop_file}"
msg2 "autologin: ${autologin}"
msg2 "nonfree_xorg: ${nonfree_xorg}"
msg2 "kernel: ${kernel}"
msg2 "efi_boot_loader: ${efi_boot_loader}"
msg2 "efi_part_size: ${efi_part_size}"
${is_plymouth} && msg2 "plymouth_theme: ${plymouth_theme}"
msg2 "pxe_boot: ${pxe_boot}"
msg2 "plymouth_boot: ${plymouth_boot}"
${plymouth_boot} && msg2 "plymouth_theme: ${plymouth_theme}"
msg2 "hostname: ${hostname}"
msg2 "username: ${username}"
msg2 "password: ${password}"
......@@ -104,6 +104,7 @@ display_settings(){
msg2 "iso_app_id: ${iso_app_id}"
msg2 "iso_compression: ${iso_compression}"
msg2 "iso_checksum: ${iso_checksum}"
msg2 "use_overlayfs: ${use_overlayfs}"
msg "BUILD QUEUE:"
show_build_queue
......
......@@ -19,7 +19,7 @@ import ${LIBDIR}/util.sh
shopt -s nullglob
makepkg_args=(-s --noconfirm -L --holdver)
makepkg_args=(-s --noconfirm -L)
repack=false
update_first=false
clean_first=false
......
......@@ -27,7 +27,8 @@
# host_tree=https://github.com/manjaro
# host_tree_abs=https://projects.archlinux.org/git/svntogit
# default https seems slow; try this
# host_tree_abs=git://projects.archlinux.org/svntogit
################ buildpkg ################
......@@ -76,3 +77,7 @@
# valid: md5, sha1, sha256, sha384, sha512
# iso_checksum=md5
# experimental; use overlayfs instead of aufs
# requires minimum 4.0 kernel on the build host and on iso in profile.conf
# use_overlayfs="false"
#
# /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
# If upgrades are available for these packages they will be asked for first
SyncFirst = pacman
#XferCommand = /usr/bin/curl -C - -f %u > %o
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
#UseSyslog
#UseDelta
#TotalDownload
CheckSpace
#VerbosePkgLists
# PGP signature checking
# NOTE: None of this will work without running `pacman-key --init` first.
# The compiled in default is equivalent to the following line. This requires
# you to locally sign and trust packager keys using `pacman-key` for them to be
# considered valid.
#SigLevel = Optional TrustedOnly
# If you wish to check signatures but avoid local sign and trust issues, use
# the following line. This will treat any key imported into pacman's keyring as
# trusted.
#SigLevel = Optional TrustAll
# For now, off by default unless you read the above.
SigLevel = Never
#
# 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.
#
[lng-pkgs]
#SigLevel = Optional TrustAll
Server = file:///opt/livecd/lng
......@@ -16,12 +16,18 @@
# nonfree xorg drivers
# nonfree_xorg="true"
# use plymouth
# plymouth_boot="true"
# use pxe
# pxe_boot="true"
################ install ################
# unset defaults to given value
# kernel="linux319"
# unset defaults to given value
# possible values: grub;systemd-boot
# efi_boot_loader="grub"
# set uefi partition size
......@@ -55,9 +61,9 @@
# unset defaults to given values
# names must match systemd service names
# services in start_systemd array don't need to be listed here
# start_systemd_live=('livecd' 'mhwd-live' 'pacman-init' 'pacman-boot')
# start_systemd_live=('livecd' 'mhwd-live' 'pacman-init')
# unset defaults to given values,
# names must match openrc service names
# services in start_openrc array don't need to be listed here
# start_openrc_live=('livecd' 'mhwd-live' 'pacman-init' 'pacman-boot')
# start_openrc_live=('livecd' 'mhwd-live' 'pacman-init')
# kernel_cmdline <param> <default>
# Looks for a parameter on the kernel's boot-time command line.
#
# returns: 0 if param was found. Also prints its value if it was a K=V param.
# 1 if it was not. Also prints value passed as <default>
#
kernel_cmdline ()
{
for param in $(/bin/cat /proc/cmdline); do
case "${param}" in
$1=*) echo "${param##*=}"; return 0 ;;
$1) return 0 ;;
*) continue ;;
esac
done
[ -n "${2}" ] && echo "${2}"
return 1
}
# 1$ : kernel argument to check
overlay_arg_available() {
for arg in $(echo "$(kernel_cmdline overlay)" | /bin/sed 's/,/ /g')
do
[ "${arg}" == "$1" ] && return 0
done
return 1
}
# args: source, mountpoint
_mnt_bind() {
local src="${1}"
local mnt="${2}"
msg "::: Binding ${src} to ${mnt}"
mkdir -p "${mnt}"
/bin/mount -o bind "${src}" "${mnt}"
}
# args: /path/to/image_file, mountpoint
_mnt_squashfs() {
local img="${1}"
local mnt="${2}"
local img_fullname="${img##*/}";
local img_name="${img_fullname%.*}"
local tmp_mnt="/ro_branch/${img_name}"
if [ "${copytoram}" = "y" ]; then
msg -n ":: Copying squashfs image to RAM..."
/bin/cp "${img}" "/copytoram/${img_fullname}"
if [ $? -ne 0 ]; then
echo ">> ERROR: while copy ${img} to /copytoram/${img_fullname}"
launch_interactive_shell
fi
img="/copytoram/${img_fullname}"
msg "done."
fi
mkdir -p "${tmp_mnt}"
/bin/mount -r -t squashfs "${img}" "${tmp_mnt}"
if [ $? -ne 0 ]; then
echo ">> ERROR: while mounting ${img} to ${tmp_mnt}"
launch_interactive_shell
fi
if [ "/${mnt#/*/}" = "/" ]; then