echo " --no-lvm2 Don't add in LVM2 support."
echo " --bootloader=grub Add new kernel to GRUB configuration"
echo " Internals"
- echo " --tempdir=<dir> Location of Genkernel's temporary directory"
echo " --arch-override=<arch> Force to arch instead of autodetect"
+ echo " --cachedir=<dir> Override the default cache location"
+ echo " --tempdir=<dir> Location of Genkernel's temporary directory"
echo " Output Settings"
echo " --minkernpackage=<tbz2> File to output a .tar.bz2'd kernel and initrd:"
echo " No modules outside of the initrd will be"
CMD_INSTALL_MOD_PATH=`parse_opt "$*"`
print_info 2 "CMD_INSTALL_MOD_PATH: $CMD_INSTALL_MOD_PATH"
;;
+ --cachedir*)
+ CACHE_DIR=`parse_opt "$*"`
+ print_info 2 "CACHE_DIR: $CACHE_DIR"
+ ;;
--minkernpackage*)
CMD_MINKERNPACKAGE=`parse_opt "$*"`
print_info 2 "MINKERNPACKAGE: $CMD_MINKERNPACKAGE"
UTILS_AS="${CMD_UTILS_AS}"
fi
+ CACHE_DIR=`arch_replace "${CACHE_DIR}"`
+
+ BUSYBOX_BINCACHE=`cache_replace "${BUSYBOX_BINCACHE}"`
+ MODULE_INIT_TOOLS_BINCACHE=`cache_replace "${MODULE_INIT_TOOLS_BINCACHE}"`
+ MODUTILS_BINCACHE=`cache_replace "${MODUTILS_BINCACHE}"`
+ DIETLIBC_BINCACHE=`cache_replace "${DIETLIBC_BINCACHE}"`
+ DIETLIBC_BINCACHE_TEMP=`cache_replace "${DIETLIBC_BINCACHE_TEMP}"`
+ DEVFSD_BINCACHE=`cache_replace "${DEVFSD_BINCACHE}"`
+ DEVFSD_CONF_BINCACHE=`cache_replace "${DEVFSD_CONF_BINCACHE}"`
+ UDEV_BINCACHE=`cache_replace "${UDEV_BINCACHE}"`
+
DEFAULT_KERNEL_CONFIG=`arch_replace "${DEFAULT_KERNEL_CONFIG}"`
BUSYBOX_CONFIG=`arch_replace "${BUSYBOX_CONFIG}"`
BUSYBOX_BINCACHE=`arch_replace "${BUSYBOX_BINCACHE}"`
var_replace()
{
- echo "${3}" | sed -e "s/%%${1}%%/${2}/g" -
+ # Escape '\' and '.' in $2 to make it safe to use
+ # in the later sed expression
+ local SAFE_VAR
+ SAFE_VAR=`echo "${2}" | sed -e 's/\([\/\.]\)/\\\\\\1/g'`
+
+ echo "${3}" | sed -e "s/%%${1}%%/${SAFE_VAR}/g" -
+ echo "${3}" | sed -e "s/%%${1}%%/${SAFE_VAR}/g" >> /tmp/out
}
arch_replace() {
var_replace "ARCH" "${ARCH}" "${1}"
}
+cache_replace() {
+ var_replace "CACHE" "${CACHE_DIR}" "${1}"
+}
+
clear_log() {
[ -f "${DEBUGFILE}" ] && echo > "${DEBUGFILE}"
}
# =========GENKERNEL LOCATION CONFIGURATION============
# Variables:
-# %%ARCH%% - Final determined architecture
+# %%ARCH%% - Final determined architecture
+# %%CACHE%% - Final determined cache location
# Default share directory location
GK_SHARE="/usr/share/genkernel"
# Location of helper-scripts
#GK_BIN="${GK_SHARE}/bin"
GK_BIN="${GK_SHARE}"
+# Location of the default cache
+CACHE_DIR="${GK_SHARE}/pkg/%%ARCH%%"
# Log output file
DEBUGFILE="/var/log/genkernel.log"
# Debug Level
BUSYBOX_VER="1.00-pre7-losetup-crypto-alpha"
# Busybox bin-cache location, to store pre-compiled busybox
# binary is just a bzip2 busybox executable
-BUSYBOX_BINCACHE="${GK_SHARE}/pkg/%%ARCH%%/busybox-${BUSYBOX_VER}-%%ARCH%%.bz2"
+BUSYBOX_BINCACHE="%%CACHE%%/busybox-${BUSYBOX_VER}-%%ARCH%%.bz2"
# Location of BusyBox source tarball
BUSYBOX_SRCTAR="${GK_SHARE}/pkg/busybox-${BUSYBOX_VER}.tar.bz2"
# Directory created after busybox tarball is extracted
MODULE_INIT_TOOLS_VER="0.9.15-pre4"
MODULE_INIT_TOOLS_SRCTAR="${GK_SHARE}/pkg/module-init-tools-${MODULE_INIT_TOOLS_VER}.tar.bz2"
MODULE_INIT_TOOLS_DIR="module-init-tools-${MODULE_INIT_TOOLS_VER}"
-MODULE_INIT_TOOLS_BINCACHE="${GK_SHARE}/pkg/%%ARCH%%/insmod-%%ARCH%%-static-2.6.bz2"
+MODULE_INIT_TOOLS_BINCACHE="%%CACHE%%/insmod-%%ARCH%%-static-2.6.bz2"
MODUTILS_VER="2.4.26"
MODUTILS_SRCTAR="${GK_SHARE}/pkg/modutils-${MODUTILS_VER}.tar.bz2"
MODUTILS_DIR="modutils-${MODUTILS_VER}"
-MODUTILS_BINCACHE="${GK_SHARE}/pkg/%%ARCH%%/insmod-%%ARCH%%-static-2.4.bz2"
+MODUTILS_BINCACHE="%%CACHE%%/insmod-%%ARCH%%-static-2.4.bz2"
DIETLIBC_VER="0.24"
DIETLIBC_SRCTAR="${GK_SHARE}/pkg/dietlibc-${DIETLIBC_VER}.tar.bz2"
DIETLIBC_DIR="dietlibc-${DIETLIBC_VER}"
-DIETLIBC_BINCACHE="${GK_SHARE}/pkg/%%ARCH%%/dietlibc-${DIETLIBC_VER}-%%ARCH%%.tar.bz2"
-DIETLIBC_BINCACHE_TEMP="${GK_SHARE}/pkg/%%ARCH%%/dietlibc-${DIETLIBC_VER}-%%ARCH%%-tempdir"
+DIETLIBC_BINCACHE="%%CACHE%%/dietlibc-${DIETLIBC_VER}-%%ARCH%%.tar.bz2"
+DIETLIBC_BINCACHE_TEMP="%%CACHE%%/dietlibc-${DIETLIBC_VER}-%%ARCH%%-tempdir"
DEVFSD_VER="1.3.25-dietlibc-kernel25"
DEVFSD_SRCTAR="${GK_SHARE}/pkg/devfsd-${DEVFSD_VER}.tar.bz2"
DEVFSD_DIR="devfsd"
-DEVFSD_BINCACHE="${GK_SHARE}/pkg/%%ARCH%%/devfsd-${DEVFSD_VER}-%%ARCH%%.bz2"
-DEVFSD_CONF_BINCACHE="${GK_SHARE}/pkg/%%ARCH%%/devfsd-conf-${DIETLIBC_VER}-%%ARCH%%.bz2"
+DEVFSD_BINCACHE="%%CACHE%%/devfsd-${DEVFSD_VER}-%%ARCH%%.bz2"
+DEVFSD_CONF_BINCACHE="%%CACHE%%/devfsd-conf-${DIETLIBC_VER}-%%ARCH%%.bz2"
UDEV_VER="030"
UDEV_DIR="udev-${UDEV_VER}"
UDEV_SRCTAR="${GK_SHARE}/pkg/udev-${UDEV_VER}.tar.bz2"
-UDEV_BINCACHE="${GK_SHARE}/pkg/%%ARCH%%/udev-${UDEV_VER}-%%ARCH%%.tar.bz2"
+UDEV_BINCACHE="%%CACHE%%/udev-${UDEV_VER}-%%ARCH%%.tar.bz2"