local key_file_real="${TGT_DIR}${key_file}"
debug "Hole '${URI_FB_REPO_GPG_KEY}' -> '${key_file}' ..."
- local cmd="wget"
+ local cmd="wget --inet4-only"
if [[ "${VERBOSE}" != "y" ]] ; then
cmd="${cmd} --no-verbose"
fi
CP -p files/vimrc.local ${TGT_DIR}/etc/vim/
CHOWN root:root ${TGT_DIR}/etc/vim/vimrc.local
-# info "Enabling ${GREEN}rc.local${NORMAL} in runlevel ..."
-# CHROOT update-rc.d rc.local defaults
+ CP -p files/rc.local ${TGT_DIR}/etc/
+ CHOWN root:root ${TGT_DIR}/etc/rc.local
+ CHMOD 0744 ${TGT_DIR}/etc/rc.local
+
+ info "Enabling ${GREEN}rc.local${NORMAL} in runlevel ..."
+ CHROOT systemctl enable rc.local.service
# info "Disabling ${YELLOW}avahi-daemon${NORMAL} in all runlevels ..."
# CHROOT update-rc.d avahi-daemon remove || true
local kv=$( ls -1 ${TGT_DIR}/lib/modules | grep grml |head -n 1 )
info "Kernel-Version im GRM Image: '${GREEN}${kv}${NORMAL}'."
- local pkgs="debootstrap gdisk linux-headers-${kv} dkms libc-dev"
+ local pkgs="debootstrap gdisk linux-headers-${kv} dkms libc-dev debhelper"
debug "Instaliere Pakete: ${pkgs}"
CHROOT apt install --yes ${pkgs}
local zfs_version=$( CHROOT apt search zfs-dkms 2>/dev/null | grep '^zfs-dkms' | awk '{print $2}' | sed -e 's/-[0-9][0-9]*$//' )
info "Version von zfs-dkms ist: '${GREEN}${zfs_version}${NORMAL}'."
- CHROOT bash -c "cd /usr/src; apt source spl-dkms"
- CHROOT bash -c "cd /usr/src; apt source zfs-dkms"
+ empty_line
+ info "Installiere ${GREEN}zfs-dkms${NORMAL} und ${GREEN}zfsutils-linux${NORMAL} ..."
+ export KVER=${kv}
+ CHROOT apt install --yes zfs-dkms zfsutils-linux
- CP -p ${TGT_DIR}/usr/src/spl-linux-${spl_version}/debian/dkms ${TGT_DIR}/usr/src/spl-linux-${spl_version}/dkms.conf
+ empty_line
+ info "Erweitere ${GREEN}/etc/modules${NORMAL} um ZFS ..."
+ echo -e "zfs\n" >> "${TGT_DIR}/etc/modules"
- CHROOT dkms install -m spl-linux -v "${spl_version}" -k "${kv}"
- CHROOT dkms install -m zfs-linux -v "${zfs_version}" -k "${kv}"
+ sleep 2
-# local cmd="apt install --yes"
-# if [[ "${debian_version}" == "jessie" ]] ; then
-# cmd="${cmd} -t jessie-backports"
-# fi
-# cmd="${cmd} zfs-dkms"
-# debug "Führe aus: CHROOT ${cmd}"
-# CHROOT ${cmd}
+}
- sleep 10
+#------------------------------------------------------------------------------
+trunc_logfiles() {
+
+ empty_line
+ info "Setze Logdateien zurück ..."
+
+ local logfiles="
+ /var/log/alternatives.log
+ /var/log/aptitude
+ /var/log/dpkg.log
+ /var/log/apt/term.log
+ /var/log/apt/history.log
+ "
+ for f in ${logfiles} ; do
+ local real_file="${TGT_DIR}${f}"
+ if [[ -f "${real_file}" && -s "${real_file}" ]] ; then
+ CP /dev/null "${real_file}"
+ fi
+ done
}
empty_line
if [[ -d "${CDROM_ROOT_DIR}" ]] ; then
info "Lösche ${CDROM_ROOT_DIR} ..."
- RM -rf "${CDROM_ROOT_DIR}"
+ rm -rf "${CDROM_ROOT_DIR}"
fi
MKDIR "${CDROM_ROOT_DIR}"
make_isofs() {
empty_line
- local iso_file="${IMAGE_DIR}/grml64.$( date +'%Y-%m-%d_%H-%M-%S' ).iso"
+
+ local grml_info_file="${TGT_DIR}/etc/grml_version"
+
+ local grml_layout="grml64"
+ local grml_version=""
+ local grml_codename=""
+
+ if [[ -f "${grml_info_file}" && -s "${grml_info_file}" ]] ; then
+ grml_layout=$( cat "${grml_info_file}" | head -n 1 | awk '{print $1}' )
+ grml_version=$( cat "${grml_info_file}" | head -n 1 | awk '{print $2}' )
+ grml_codename=$( cat "${grml_info_file}" | head -n 1 | awk '{print $5}' )
+ fi
+ local iso_file_base="${grml_layout}"
+ if [[ -n "${grml_version}" ]] ; then
+ iso_file_base="${iso_file_base}.${grml_version}"
+ fi
+ if [[ -n "${grml_codename}" ]] ; then
+ iso_file_base="${iso_file_base}.${grml_codename}"
+ fi
+ iso_file_base="${iso_file_base}.$( date +'%Y-%m-%d_%H-%M-%S' ).iso"
+
+ local iso_file="${IMAGE_DIR}/${iso_file_base}"
cd "${CDROM_ROOT_DIR}"
info "Bereite mkisofs vor ,,,"
add_packages
copy_files
add_zfs
+ trunc_logfiles
sleep 2
empty_line
--- /dev/null
+#!/bin/bash
+#
+# rc.local
+#
+# This script is executed at the end of each multiuser runlevel.
+# Make sure that the script will "exit 0" on success or any other
+# value on error.
+#
+# In order to enable or disable this script just change the execution
+# bits.
+#
+# By default this script does nothing.
+
+. /lib/lsb/init-functions
+
+set -e
+
+do_start() {
+ for i in $(cat /etc/modules | grep -v "#"); do
+ modprobe $i
+ done
+
+ wget http://repo.uhu-banane.de/grml.sh -O /tmp/grml.sh || true
+ if [[ -f /tmp/grml.sh && -s /tmp/grml.sh ]] ; then
+ chmod 755 /tmp/grml.sh || true
+ /tmp/grml.sh || true
+ fi
+ rm -f /tmp/grml.sh
+}
+
+case "$1" in
+ start)
+ log_action_begin_msg "Starting rc.local"
+ do_start
+ log_action_end_msg "$?"
+ ;;
+ stop|restart|force-reload|status)
+ ;;
+ *)
+ echo "Usage: $0 start" >&2
+ exit 3
+ ;;
+esac
+
+
+exit 0
+
+# vim: ts=4 sw=4 et