Commit 3ac6084f authored by Iain Learmonth's avatar Iain Learmonth

Imported Upstream version 5.0~a5

parent 3bb8e3f0
This diff is collapsed.
# Makefile
SHELL := sh -e
LANGUAGES = $(shell cd manpages/po && ls)
SCRIPTS = backend/*/* frontend/* components/*
all: build
test:
@echo -n "Checking for syntax errors"
@for SCRIPT in $(SCRIPTS); \
do \
sh -n $${SCRIPT}; \
echo -n "."; \
done
@echo " done."
@# We can't just fail yet on bashisms (FIXME)
@if [ -x "$$(which checkbashisms 2>/dev/null)" ]; \
then \
echo -n "Checking for bashisms"; \
for SCRIPT in $(SCRIPTS); \
do \
checkbashisms -f -x $${SCRIPT} || true; \
echo -n "."; \
done; \
echo " done."; \
else \
echo "W: checkbashisms - command not found"; \
echo "I: checkbashisms can be obtained from: "; \
echo "I: http://git.debian.org/?p=devscripts/devscripts.git"; \
echo "I: On Debian based systems, checkbashisms can be installed with:"; \
echo "I: apt-get install devscripts"; \
fi
build:
@echo "Nothing to build."
install:
# Installing components
mkdir -p $(DESTDIR)/lib/live/boot
cp components/* $(DESTDIR)/lib/live/boot
# Installing executables
mkdir -p $(DESTDIR)/usr/share/initramfs-tools/hooks
cp backend/initramfs-tools/live.hook $(DESTDIR)/usr/share/initramfs-tools/hooks/live
mkdir -p $(DESTDIR)/usr/share/initramfs-tools/scripts
cp backend/initramfs-tools/live.script $(DESTDIR)/usr/share/initramfs-tools/scripts/live
mkdir -p $(DESTDIR)/bin
cp frontend/* $(DESTDIR)/bin
# Installing docs
mkdir -p $(DESTDIR)/usr/share/doc/live-boot
cp -r COPYING $(DESTDIR)/usr/share/doc/live-boot
# Installing manpages
for MANPAGE in manpages/en/*; \
do \
SECTION="$$(basename $${MANPAGE} | sed -e 's|\.|\n|g' | tail -n1)"; \
install -D -m 0644 $${MANPAGE} $(DESTDIR)/usr/share/man/man$${SECTION}/$$(basename $${MANPAGE}); \
done
for LANGUAGE in $(LANGUAGES); \
do \
for MANPAGE in manpages/$${LANGUAGE}/*; \
do \
SECTION="$$(basename $${MANPAGE} | sed -e 's|\.|\n|g' | tail -n1)"; \
install -D -m 0644 $${MANPAGE} $(DESTDIR)/usr/share/man/$${LANGUAGE}/man$${SECTION}/$$(basename $${MANPAGE} .$${LANGUAGE}.$${SECTION}).$${SECTION}; \
done; \
done
uninstall:
# Uninstalling executables
rm -f $(DESTDIR)/bin/live-boot
rm -f $(DESTDIR)/bin/live-swapfile
rmdir --ignore-fail-on-non-empty $(DESTDIR)/bin > /dev/null 2>&1 || true
rm -f $(DESTDIR)/usr/share/initramfs-tools/hooks/live
rm -f $(DESTDIR)/usr/share/initramfs-tools/scripts/live
rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/initramfs-tools/hooks > /dev/null 2>&1 || true
rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/initramfs-tools/scripts > /dev/null 2>&1 || true
rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/initramfs-tools > /dev/null 2>&1 || true
rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share > /dev/null 2>&1 || true
rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr > /dev/null 2>&1 || true
# Uninstalling docs
rm -rf $(DESTDIR)/usr/share/doc/live-boot
rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/doc > /dev/null 2>&1 || true
rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share > /dev/null 2>&1 || true
rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr > /dev/null 2>&1 || true
# Uninstalling manpages
for MANPAGE in manpages/en/*; \
do \
SECTION="$$(basename $${MANPAGE} | sed -e 's|\.|\n|g' | tail -n1)"; \
rm -f $(DESTDIR)/usr/share/man/man$${SECTION}/$$(basename $${MANPAGE} .en.$${SECTION}).$${SECTION}; \
done
for LANGUAGE in $(LANGUAGES); \
do \
for MANPAGE in manpages/$${LANGUAGE}/*; \
do \
SECTION="$$(basename $${MANPAGE} | sed -e 's|\.|\n|g' | tail -n1)"; \
rm -f $(DESTDIR)/usr/share/man/$${LANGUAGE}/man$${SECTION}/$$(basename $${MANPAGE} .$${LANGUAGE}.$${SECTION}).$${SECTION}; \
done; \
done
for SECTION in $(for MANPAGE in $(ls manpages/en/*); do basename $${MANPAGE} | sed -e 's|\.|\n|g' | tail -n1; done | sort -u); \
do \
rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/man/man$${SECTION} > /dev/null 2>&1 || true; \
rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/man/*/man$${SECTION} > /dev/null 2>&1 || true; \
done
rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share/man > /dev/null 2>&1 || true
rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr/share > /dev/null 2>&1 || true
rmdir --ignore-fail-on-non-empty $(DESTDIR)/usr > /dev/null 2>&1 || true
rmdir --ignore-fail-on-non-empty $(DESTDIR) > /dev/null 2>&1 || true
clean:
@echo "Nothing to clean."
distclean: clean
@echo "Nothing to distclean."
reinstall: uninstall install
5.0~a5-1
#!/bin/sh
#set -e
. /bin/live-boot
DRACUT_FIXME ()
{
# dracut entry point for live-boot is FIXME(); function
Live
}
#!/bin/sh
set -e
. /usr/share/initramfs-tools/hook-functions
[ "${QUIET}" ] || echo -n "live-boot:"
# Reading configuration file from filesystem and live-media
for _FILE in /etc/live/boot.conf /etc/live/boot/* \
/lib/live/mount/media/live/boot.conf /lib/live/mount/media/live/boot/*
do
if [ -e "${_FILE}" ]
then
. "${_FILE}"
fi
done
# Checking live-boot
if [ ! -e /bin/live-boot ]
then
echo
echo "W: live-boot-initramfs-tools (backend) installed without live-boot,"
echo "W: this initramfs will *NOT* have live support."
exit 0
fi
[ "${QUIET}" ] || echo -n " core"
mkdir -p "${DESTDIR}/bin"
cp -a /bin/live-boot /lib/live/boot "${DESTDIR}/bin"
mkdir -p "${DESTDIR}/lib/live"
cp -a /lib/live/boot "${DESTDIR}/lib/live"
# klibc dependencies
for FILE in /lib/libacl* /lib/libblkid* /lib/libuuid* /lib/libdevmapper* /lib/libattr*
do
if [ ! -e "${DESTDIR}/${FILE}" ] && ls "${FILE}" > /dev/null 2>&1
then
cp -a "${FILE}" "${DESTDIR}/${FILE}"
fi
done
# udev dependencies
for FILE in /lib/udev/*_id
do
copy_exec "${FILE}"
done
if [ -e /lib/udev/rules.d/60-cdrom_id.rules ]
then
mkdir -p "${DESTDIR}/lib/udev/rules.d"
cp -p /lib/udev/rules.d/60-cdrom_id.rules "${DESTDIR}/lib/udev/rules.d"
fi
[ "${QUIET}" ] || echo -n " filesystems"
# Configuration: keymap (usefull when using encryption)
if [ -x /bin/loadkeys ] && [ -r /etc/console/boottime.kmap.gz ]
then
copy_exec /bin/loadkeys
mkdir -p "${DESTDIR}/etc"
cp /etc/console/boottime.kmap.gz "${DESTDIR}/etc"
fi
# Configuration: Unique ID
if [ -n "${LIVE_GENERATE_UUID}" ]
then
mkdir -p "${DESTDIR}/conf"
uuidgen -r > "${DESTDIR}/conf/uuid.conf"
fi
# Filesystem: btrfs
manual_add_modules btrfs
# Filesystem: cifs
if [ -x /sbin/mount.cifs ]
then
copy_exec /sbin/mount.cifs
manual_add_modules cifs
fi
# Filesystem: ext3/ext4
manual_add_modules ext3
manual_add_modules ext4
# Filesystem: hfs/hfsplus
manual_add_modules hfs
manual_add_modules hfsplus
# Filesystem: jffs2
manual_add_modules jffs2
if [ -x /usr/bin/rsync ]
then
copy_exec /usr/bin/rsync /bin
fi
# Filesystem: squashfs
copy_exec /sbin/losetup
manual_add_modules loop
manual_add_modules squashfs
manual_add_modules sqlzma
manual_add_modules unlzma
# Filesystem: aufs/overlay
manual_add_modules aufs
manual_add_modules overlay
# Filesystem: vfat
manual_add_modules nls_cp437
manual_add_modules nls_iso8859-1
manual_add_modules nls_utf8
manual_add_modules vfat
# Filesystem: ntfs
manual_add_modules ntfs
[ "${QUIET}" ] || echo -n " devices"
# Hardware: cdrom
manual_add_modules ide-cd
manual_add_modules ide-generic
manual_add_modules ohci1394
manual_add_modules sbp2
manual_add_modules sr_mod
# Hardware: usb
manual_add_modules sd_mod
# Hardware: network
auto_add_modules net
# Program: eject
if [ -x /usr/bin/eject ]
then
copy_exec /usr/bin/eject /bin
fi
# Program: mount
# fuse does not work with klibc mount
copy_exec /bin/mount /bin/mount.util-linux
[ "${QUIET}" ] || echo -n " utils"
# Feature: Verify Checksums
if [ -e /etc/progress-linux_version ]
then
copy_exec /usr/bin/sha256sum /bin
else
copy_exec /usr/bin/md5sum /bin
fi
# Program: memdisk
if [ -x /usr/bin/memdiskfind ]
then
[ "${QUIET}" ] || echo -n " memdisk"
copy_exec /usr/bin/memdiskfind
manual_add_modules phram
manual_add_modules mtdblock
fi
# Program: udev
if [ -x /sbin/udevadm ]
then
[ "${QUIET}" ] || echo -n " udev"
copy_exec /sbin/udevadm
fi
# Program: wget
if [ -x /usr/bin/wget ]
then
[ "${QUIET}" ] || echo -n " wget"
copy_exec /usr/bin/wget /bin
fi
# Program: blockdev
if [ -x /sbin/blockdev ]
then
[ "${QUIET}" ] || echo -n " blockdev"
copy_exec /sbin/blockdev
fi
# FUSE kernel module
manual_add_modules fuse
# FUSE filesystem: httpfs2
if [ -x /usr/bin/httpfs2_ssl ]
then
[ "${QUIET}" ] || echo -n " httpfs:ssl"
copy_exec /usr/bin/httpfs2_ssl /bin/httpfs
elif [ -x /usr/bin/httpfs2 ]
then
[ "${QUIET}" ] || echo -n " httpfs"
copy_exec /usr/bin/httpfs2 /bin/httpfs
fi
# FUSE filesystem: curlftpfs
if [ -x /usr/bin/curlftpfs ]
then
[ "${QUIET}" ] || echo -n " ftpfs"
copy_exec /usr/bin/curlftpfs /bin
fi
# iSCSI
if [ -x /usr/sbin/iscsistart ]
then
[ "${QUIET}" ] || echo -n " iscsi"
copy_exec /usr/sbin/iscsistart /bin
#manual_add_modules ib_iser
manual_add_modules iscsi_tcp
manual_add_modules crc32c
fi
# Some experimental stuff
case "${LIVE_DNS}" in
true)
[ "${QUIET}" ] || echo -n " dns"
# /lib/libnss_dns.so.*:a DNS
# /lib/libnss_files.so.*: /etc/hosts and /etc/passwd
# /lib/libnss_compat.so.*: /etc/passwd
for _SHLIB in $(find /lib -name 'libnss_dns.so.*')
do
copy_exec "${_SHLIB}"
done
# might be needed if /etc/hosts is used
#mkdir -p "${DESTDIR}/etc"
#cp -p /etc/nsswitch.conf "${DESTDIR}/etc"
;;
esac
[ "${QUIET}" ] || echo .
#!/bin/sh
#set -e
. /bin/live-boot
. /scripts/functions
mountroot ()
{
# initramfs-tools entry point for live-boot is mountroot(); function
Live
}
#!/bin/sh
#set -e
Debug ()
{
for _PARAMETER in ${LIVE_BOOT_CMDLINE}
do
case "${_PARAMETER}" in
live-boot.debug|debug)
LIVE_BOOT_DEBUG="true"
;;
esac
done
case "${LIVE_BOOT_DEBUG}" in
true)
;;
*)
return 0
;;
esac
# Write the trace output
set -x
}
#!/bin/sh
#set -e
Read_only ()
{
for _PARAMETER in ${LIVE_BOOT_CMDLINE}
do
case "${_PARAMETER}" in
live-boot.read-only=*|read-only=*)
LIVE_READ_ONLY="true"
LIVE_READ_ONLY_DEVICES="${_PARAMETER#*read-only=}"
;;
live-boot.read-only|read-only)
LIVE_READ_ONLY="true"
;;
esac
done
case "${LIVE_READ_ONLY}" in
true)
;;
*)
return 0
;;
esac
# Marking some block devices as read-only to ensure that nothing
# gets written as linux still writes to 'only' read-only mounted filesystems.
LIVE_READ_ONLY_DEVICES="${LIVE_READ_ONLY_DEVICES:-/dev/sd* /dev/vd*}"
for _DEVICE in $(echo ${LIVE_READ_ONLY_DEVICES} | sed -e 's|,| |g')
do
if [ ! -b "${_DEVICE}" ]
then
continue
fi
echo -n "live-boot: Setting ${_DEVICE} read-only..." > /dev/console
blockdev --setro ${_DEVICE}
_RETURN="${?}"
case "${_RETURN}" in
0)
echo " done, use 'blockdev --setrw ${_DEVICE}' to set read-write." > /dev/console
;;
*)
echo " failed." > /dev/console
;;
esac
done
}
#!/bin/sh
#set -e
Verify_checksums ()
{
for _PARAMETER in ${LIVE_BOOT_CMDLINE}
do
case "${_PARAMETER}" in
live-boot.verify-checksums=*|verify-checksums=*)
LIVE_VERIFY_CHECKSUMS="true"
LIVE_VERIFY_CHECKSUMS_DIGESTS="${_PARAMETER#*verify-checksums=}"
;;
live-boot.verify-checksums|verify-checksums)
LIVE_VERIFY_CHECKSUMS="true"
;;
esac
done
case "${LIVE_VERIFY_CHECKSUMS}" in
true)
;;
*)
return 0
;;
esac
_MOUNTPOINT="${1}"
LIVE_VERIFY_CHECKSUMS_DIGESTS="${LIVE_VERIFY_CHECKSUMS_DIGESTS:-sha512 sha384 sha256 sha224 sha1 md5}"
_TTY="/dev/tty8"
log_begin_msg "Verifying checksums"
cd "${_MOUNTPOINT}"
for _DIGEST in $(echo ${LIVE_VERIFY_CHECKSUMS_DIGESTS} | sed -e 's|,| |g')
do
_CHECKSUMS="$(echo ${_DIGEST} | tr [a-z] [A-Z])SUMS ${_DIGEST}sum.txt"
for _CHECKSUM in ${_CHECKSUMS}
do
if [ -e "${_CHECKSUM}" ]
then
echo "Found ${_CHECKSUM}..." > "${_TTY}"
if [ -e "/bin/${_DIGEST}sum" ]
then
echo "Checking ${_CHECKSUM}..." > "${_TTY}"
# Verify checksums
/bin/${_DIGEST}sum -c "${_CHECKSUM}" < "${_TTY}" > "${_TTY}"
_RETURN="${?}"
# Stop after first verification
break
else
echo "Not found /bin/${_DIGEST}sum..." > "${_TTY}"
fi
fi
done
done
log_end_msg
case "${_RETURN}" in
0)
log_success_msg "Verification successfull, rebooting in 10 seconds."
sleep 10
# Unmount live-media
cd /
umount -f "${_MOUNTPOINT}" > /dev/null 2>&1
sync
# Attempt to remount all mounted filesystems read-only
echo u > /proc/sysrq-trigger
# Immediately reboot the system without syncing or unmounting filesystems
echo b > /proc/sysrq-trigger
;;
*)
panic "Verification failed, $(basename ${_TTY}) for more information."
;;
esac
}
#!/bin/sh
#set -e
Remove_persistence ()
{
for _PARAMETER in ${LIVE_BOOT_CMDLINE}
do
case "${_PARAMETER}" in
live-boot.persistence-remove=*|persistence-remove=*)
LIVE_PERSISTENCE_REMOVE="${_PARAMETER#*persistence-remove=}"
;;
live-boot.persistence-remove|persistence-remove)
LIVE_PERSISTENCE_REMOVE="true"
;;
esac
done
case "${LIVE_PERSISTENCE_REMOVE}" in
true)
;;
*)
return 0
;;
esac
# Remove persistence
cd /live/overlay && find . -not -name 'persistence.conf' | xargs rm -rf
}
#!/bin/sh
#set -e
Swap ()
{
for _PARAMETER in ${LIVE_BOOT_CMDLINE}
do
case "${_PARAMETER}" in
live-boot.swap=*|swap=*)
LIVE_SWAP="true"
LIVE_SWAP_DEVICES="${_PARAMETER#*swap=}"
;;
live-boot.swap|swap)
LIVE_SWAP="true"
;;
esac
done
case "${LIVE_SWAP}" in
true)
;;
*)
return 0
;;
esac
LIVE_SWAP_DEVICES="${LIVE_SWAP_DEVICES:-/dev/sd* /dev/vd*}"
for _DEVICE in $(echo ${LIVE_SWAP_DEVICES} | sed -e 's|,| |g')
do
if [ ! -b "${_DEVICE}" ]
then
continue
fi
blkid -o udev -p ${_DEVICE%%[0-9]*} | grep -q "^ID_FS_USAGE=raid" && continue
_MAGIC="$(/bin/dd if=${_DEVICE} bs=4086 skip=1 count=1 2>/dev/null | /bin/dd bs=10 count=1 2>/dev/null)" || continue
case "${_MAGIC}" in
SWAPSPACE2|SWAP-SPACE)
_SWAP_DEVICES="${_SWAP_DEVICES} ${_DEVICE}"
;;
esac
done
# Remove all auto swap entries
if grep -qs "swap swap" /root/etc/fstab
then
grep -v "swap swap" /root/etc/fstab > /root/etc/fstab.tmp
mv /root/etc/fstab.tmp /root/etc/fstab
fi
# Add new swap entries
for _DEVICE in ${_SWAP_DEVICES}
do
echo "${_DEVICE} swap swap defaults 0 0" >> /root/etc/fstab
done
}
#!/bin/sh
PATH="/root/usr/bin:/root/usr/sbin:/root/bin:/root/sbin:/usr/bin:/usr/sbin:/bin:/sbin"
export PATH
echo "/root/lib" >> /etc/ld.so.conf
echo "/root/usr/lib" >> /etc/ld.so.conf
mountpoint="/live/medium"
alt_mountpoint="/media"
LIVE_MEDIA_PATH="live"
HOSTNAME="host"
mkdir -p "${mountpoint}"
mkdir -p /var/lib/live/boot
# Create /etc/mtab for debug purpose and future syncs
mkdir -p /etc
touch /etc/mtab
if [ ! -x "/bin/fstype" ]
then
# klibc not in path -> not in initramfs
PATH="${PATH}:/usr/lib/klibc/bin"
export PATH
fi
custom_overlay_label="persistence"
persistence_list="persistence.conf"
#!/bin/sh
#set -e
Cmdline_old ()
{
for _PARAMETER in ${LIVE_BOOT_CMDLINE}
do
case "${_PARAMETER}" in
skipconfig)
NOFSTAB="true"
NONETWORKING="true"
export NOFSTAB NONETWORKING
;;
BOOTIF=*)
BOOTIF="${_PARAMETER#BOOTIF=}"
;;
dhcp)
# Force dhcp even while netbooting
# Use for debugging in case somebody works on fixing dhclient
DHCP="true";
export DHCP
;;
nodhcp)
DHCP=""
export DHCP
;;
ethdevice=*)
DEVICE="${_PARAMETER#ethdevice=}"
ETHDEVICE="${DEVICE}"
export DEVICE ETHDEVICE
;;