parent
613380c489
commit
a1f986724f
@ -0,0 +1 @@
|
||||
{% calculate append='skip' %}
|
@ -0,0 +1 @@
|
||||
{% calculate path='/etc', name='local.d', package='calculate-sources' %}
|
@ -0,0 +1,11 @@
|
||||
{% calculate exec='/bin/bash', install.os.arch.machine == 'i686', action='!disk' %}
|
||||
|
||||
for fn in /usr/src/*/Module.symvers
|
||||
do
|
||||
if [[ -f $fn ]]
|
||||
then
|
||||
sed -ri 's/(alternatives_patched.*SYMBOL)_GPL/\1/' $fn
|
||||
fi
|
||||
done
|
||||
|
||||
true
|
@ -0,0 +1,3 @@
|
||||
{% calculate path='/etc/modprobe.d' %}
|
||||
|
||||
options amdgpu cik_support=1 si_support=1
|
@ -0,0 +1,3 @@
|
||||
{% calculate path='/etc/modprobe.d' %}
|
||||
|
||||
options vboxvideo modeset=0
|
@ -0,0 +1 @@
|
||||
{% calculate path='/usr/lib/dracut', name='modules.d', package='sys-kernel/dracut' %}
|
@ -0,0 +1,3 @@
|
||||
{% calculate format='regex' %}
|
||||
<reg>if \[\[ \$\{hostonly\} \]\] \&\& (! \[\[ \$\{i18n_install_all\})</reg>
|
||||
<text>if \1</text>
|
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Licensed under the GPLv2
|
||||
#
|
||||
# Copyright 2013 Red Hat, Inc.
|
||||
# Peter Jones <pjones@redhat.com>
|
||||
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods radeon uvesafb nouveau i915 amdgpu
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_binary /usr/bin/cut
|
||||
inst_binary /bin/grep
|
||||
inst_script "$moddir/select-video.sh" "/sbin/select-video.sh"
|
||||
inst_hook pre-pivot 50 "$moddir/system-video-blacklist.sh"
|
||||
inst_hook cmdline 50 "$moddir/parse-cmdline.sh"
|
||||
mkdir -p ${initdir}/etc/modprobe.d
|
||||
if [ -f /etc/modprobe.d/amdgpu.conf ]; then
|
||||
inst_multiple /etc/modprobe.d/amdgpu.conf
|
||||
fi
|
||||
if [ -f /etc/modprobe.d/vboxvideo.conf ]; then
|
||||
inst_multiple /etc/modprobe.d/vboxvideo.conf
|
||||
fi
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
[ -z "$calculate" ] && calculate=$(getarg calculate=)
|
||||
[ -z "$video" ] && video=$(getarg video=)
|
||||
[ -z "$bootimage" ] && bootimage=$(getarg BOOT_IMAGE=)
|
||||
|
||||
[ -z "$calculate" ] && [ -z "$video" ] && return
|
||||
|
||||
if [[ $bootimage != ${bootimage/SafeMode/} ]]
|
||||
then
|
||||
echo "rd.plymouth=0" >>/etc/cmdline.d/90-noplymouth.conf
|
||||
fi
|
||||
|
||||
if [ -n "$video" ]
|
||||
then
|
||||
for i in ${video//,/ }
|
||||
do
|
||||
if [ -z "${i//[0-9-x@]}" ]
|
||||
then
|
||||
videoresolution=${i}
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ "${calculate//:/}" != "${calculate}" ]]
|
||||
then
|
||||
for i in ${calculate//,/ }
|
||||
do
|
||||
case "${i}" in
|
||||
video:*)
|
||||
videodrv=`echo "${i}" | cut -s -d: -f2-`
|
||||
;;
|
||||
resolution:*)
|
||||
resolution=`echo "${i}" | cut -s -d: -f2-`
|
||||
if [ -n "${resolution}" -a "${resolution}" != "auto" ]
|
||||
then
|
||||
videoresolution=${resolution}-32
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
/sbin/select-video.sh /etc/modprobe.d/video-blacklist.conf $videodrv
|
@ -0,0 +1,31 @@
|
||||
{% calculate chmod='755' %}
|
||||
#!/bin/bash
|
||||
|
||||
blacklistfile=$1
|
||||
videomodule=$2
|
||||
|
||||
if [[ -n $videomodule ]]
|
||||
then
|
||||
cat >$blacklistfile <<EOF
|
||||
# This file was created by initramfs
|
||||
# Do not edit this file manually
|
||||
# Please use cl-setup-video to select video driver
|
||||
|
||||
EOF
|
||||
case $videomodule in
|
||||
nouveau)
|
||||
echo "blacklist nvidia" >>$blacklistfile
|
||||
;;
|
||||
radeon)
|
||||
echo "blacklist amdgpu" >>$blacklistfile
|
||||
;;
|
||||
nvidia)
|
||||
echo "blacklist nouveau" >>$blacklistfile
|
||||
;;
|
||||
amdgpu)
|
||||
echo "blacklist radeon" >>$blacklistfile
|
||||
;;
|
||||
esac
|
||||
else
|
||||
rm -f $blacklistfile
|
||||
fi
|
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
if mount | grep " /sysroot " | grep ro, &>/dev/null
|
||||
then
|
||||
mount -o rw,remount ${NEWROOT} &>/dev/null
|
||||
/sbin/select-video.sh ${NEWROOT}/etc/modprobe.d/video-blacklist.conf $videodrv
|
||||
mount -o ro,remount ${NEWROOT} &>/dev/null
|
||||
else
|
||||
/sbin/select-video.sh ${NEWROOT}/etc/modprobe.d/video-blacklist.conf $videodrv
|
||||
fi
|
@ -0,0 +1,8 @@
|
||||
{% calculate format='regex' %}
|
||||
<reg>(inst_hook emergency 50 "\$moddir"/plymouth-emergency.sh
|
||||
)\s*
|
||||
(\s*)(inst_multiple readlink)</reg>
|
||||
<text>\1
|
||||
\2inst_rules /lib/udev/rules.d/71-udev-seat.rules
|
||||
|
||||
\2\3</text>
|
@ -0,0 +1,10 @@
|
||||
{% calculate format='regex' %}
|
||||
<reg>\n(\s+)(plymouthd)(\s*--attach-to-session)(\s*--pid-file\s*\S+)</reg>
|
||||
<text>
|
||||
\1if getargbool 0 quiet
|
||||
\1then
|
||||
\1\1\2\4\3
|
||||
\1else
|
||||
\1\1\2\4
|
||||
\1fi
|
||||
</text>
|
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -n $netroot ]]
|
||||
then
|
||||
cp -a /etc/resolv.conf ${NEWROOT}/etc/
|
||||
fi
|
@ -0,0 +1,15 @@
|
||||
{% calculate chmod='0755' %}
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
# live images are specified with
|
||||
# root=live:backingdev
|
||||
|
||||
isofile=$(getarg iso-scan/filename)
|
||||
|
||||
if [ -n "$isofile" -a "$root" = "live" ]; then
|
||||
rootok=1
|
||||
{% if pkg() >= '044' %}
|
||||
wait_for_dev -n /dev/mapper/live-rw
|
||||
{% endif %}
|
||||
fi
|
@ -0,0 +1,43 @@
|
||||
{% calculate chmod='755' %}
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
isofile=$1
|
||||
|
||||
[ -z "$isofile" ] && exit 1
|
||||
|
||||
ismounted "/run/initramfs/isoscan" && exit 0
|
||||
|
||||
mkdir -p "/run/initramfs/isoscan"
|
||||
|
||||
do_iso_scan() {
|
||||
local _name
|
||||
local dev
|
||||
for dev in /dev/disk/by-uuid/*; do
|
||||
_name=$(dev_unit_name "$dev")
|
||||
[ -e /tmp/isoscan-${_name} ] && continue
|
||||
> /tmp/isoscan-${_name}
|
||||
mount -t auto -o ro "$dev" "/run/initramfs/isoscan" || continue
|
||||
if [ -f "/run/initramfs/isoscan/$isofile" ]; then
|
||||
if [ "$root" == "live" ]; then
|
||||
/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root `losetup -f --show "/run/initramfs/isoscan/$isofile"`
|
||||
else
|
||||
losetup -f --show "/run/initramfs/isoscan/$isofile"
|
||||
fi
|
||||
rm -f -- "$job"
|
||||
exit 0
|
||||
else
|
||||
umount "/run/initramfs/isoscan"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
do_iso_scan
|
||||
|
||||
rmdir "/run/initramfs/isoscan"
|
||||
exit 1
|
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
[[ $root =~ ^live: ]] && /sbin/live-scan && cancel_wait_for_dev "${root#live:}"
|
||||
|
||||
[ -e "$job" ] && rm -f "$job"
|
@ -0,0 +1,41 @@
|
||||
{% calculate chmod='0755' %}
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
LIVEPATH=/run/initramfs/livescan
|
||||
|
||||
ismounted "$LIVEPATH" && exit 0
|
||||
|
||||
mkdir -p "$LIVEPATH"
|
||||
|
||||
check_for_live() {
|
||||
[[ -f $LIVEPATH/livecd ]] && cat "$LIVEPATH/livecd" | grep -q calculate &>/dev/null
|
||||
}
|
||||
|
||||
do_live_scan() {
|
||||
local _name
|
||||
local dev
|
||||
for dev in /dev/disk/by-uuid/*; do
|
||||
_name=$(dev_unit_name "$dev")
|
||||
[ -e /tmp/livescan-${_name} ] && continue
|
||||
> /tmp/livescan-${_name}
|
||||
mount -t auto -o ro "$dev" "$LIVEPATH" || continue
|
||||
if check_for_live; then
|
||||
umount "$LIVEPATH"
|
||||
/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $dev
|
||||
exit 0
|
||||
else
|
||||
umount "$LIVEPATH"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
do_live_scan
|
||||
|
||||
rmdir "/run/initramfs/livescan"
|
||||
exit 1
|
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
# if dmsetup is not installed, then we cannot support fedora/red hat
|
||||
# style live images
|
||||
{% if pkg() < '049' %}
|
||||
[[ $hostonly ]] || echo rootfs-block dmsquash-live
|
||||
{% else %}
|
||||
[[ $hostonly ]] || echo rootfs-block dmsquash-live network-legacy
|
||||
{% endif %}
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
[[ $hostonly ]] || instmods squashfs loop iso9660
|
||||
instmods =drivers/usb/host =drivers/usb/phy
|
||||
}
|
||||
|
||||
install() {
|
||||
if ! [[ $hostonly ]]
|
||||
then
|
||||
inst_multiple umount dmsetup blkid dd losetup grep blockdev cat cut sed rmdir pidof
|
||||
inst_hook mount 20 "$moddir/scratch-mount-root.sh"
|
||||
inst_hook cmdline 31 "$moddir/iso-scan-rootok.sh"
|
||||
inst_hook pre-pivot 50 "$moddir/copy-resolv.sh"
|
||||
inst_script "$moddir/scratch-live-root.sh" "/sbin/dmsquash-live-root"
|
||||
inst_script "$moddir/mount-squashfs.sh" "/sbin/mount-squashfs"
|
||||
inst_script "$moddir/iso-scan.sh" "/sbin/iso-scan"
|
||||
inst_script "$moddir/live-scan.sh" "/sbin/live-scan"
|
||||
inst_script "$moddir/nfsroot.sh" "/sbin/nfsroot"
|
||||
inst_hook initqueue/timeout 95 "$moddir/live-fallback.sh"
|
||||
fi
|
||||
echo rd.skipfsck=1 >> "${initdir}/etc/cmdline.d/95-skipfsck.conf"
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
{% calculate chmod='755' %}
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
live_dir=$(getarg rd.live.dir -d live_dir )
|
||||
squash_image=$(getarg rd.live.squashimg -d loop)
|
||||
[ -z "$squash_image" ] && squash_image="livecd.squashfs"
|
||||
|
||||
getargbool 0 rd.live.ram -d -y live_ram -d -y docache && live_ram="yes"
|
||||
|
||||
# we might have an embedded fs image on squashfs (compressed live)
|
||||
if [ -e /run/initramfs/live/${live_dir}/${squash_image} ]; then
|
||||
SQUASHED="/run/initramfs/live/${live_dir}/${squash_image}"
|
||||
fi
|
||||
|
||||
do_cache() {
|
||||
allmemory=0
|
||||
for i in $(cat /proc/meminfo | grep -e ^MemFree -e ^Cached | \
|
||||
cut -d: -f2 | cut -dk -f1 | sed -e "s/^\s*//") ;
|
||||
do
|
||||
allmemory=$((${allmemory} + $i))
|
||||
done
|
||||
|
||||
# getting size tmpfs of default
|
||||
let curtfs=${allmemory}/2
|
||||
|
||||
# getting size of image
|
||||
let imagesize=`ls -la ${SQUASHED} | sed -r -n 's/(\S*\s*){4}(\S*).*/\2/p'`/20000*21
|
||||
let addon=${imagesize}/7
|
||||
if [[ ${curtfs} -gt $(( ${imagesize} + ${addon} )) ]];
|
||||
then
|
||||
newsize=${curtfs}
|
||||
else
|
||||
newsize=$(( ${addon} + ${imagesize} ))
|
||||
fi
|
||||
|
||||
if [[ ${newsize} -lt ${allmemory} ]];
|
||||
then
|
||||
LIVECACHE=/run/initramfs/livecache
|
||||
mkdir -m 0755 -p $LIVECACHE
|
||||
mount -o remount,size=${newsize}k -t tmpfs tmpfs /run
|
||||
echo "Copying live image to RAM..."
|
||||
echo "(this may take a few minutes)"
|
||||
dd if=$SQUASHED of=${LIVECACHE}/livecd.squashfs bs=512 2> /dev/null
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
bad_msg "Failed to cache the loop file! Lack of space?"
|
||||
umount ${LIVECACHE}
|
||||
else
|
||||
SQUASHED="${LIVECACHE}/livecd.squashfs"
|
||||
echo "Unmounting media from /var/initramfs/live"
|
||||
umount -nd /run/initramfs/live
|
||||
[[ -d /run/initramfs/isoscan ]] && umount -nd /run/initramfs/isoscan
|
||||
fi
|
||||
else
|
||||
echo "Too low memory for cache the loop file." 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -e "$SQUASHED" ] ; then
|
||||
if [ -n "$live_ram" ] ; then
|
||||
do_cache
|
||||
fi
|
||||
|
||||
SQUASHED_LOOPDEV=$( losetup -f )
|
||||
losetup -r $SQUASHED_LOOPDEV $SQUASHED
|
||||
mkdir -m 0755 -p /run/initramfs/squashfs
|
||||
mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /run/initramfs/squashfs
|
||||
fi
|
||||
|
||||
ROOTFLAGS="$(getarg rootflags)"
|
||||
if [ -n "$ROOTFLAGS" ]; then
|
||||
ROOTFLAGS="-o $ROOTFLAGS"
|
||||
else
|
||||
ROOTFLAGS="-o udba=reval,br:/overlay=rw,/run/initramfs/squashfs=ro"
|
||||
fi
|
||||
|
||||
ln -s ${SQUASHED_LOOPDEV} /dev/mapper/live-rw
|
||||
{% if pkg() >= '045' %}
|
||||
ln -s ${SQUASHED_LOOPDEV} /run/rootfsbase
|
||||
{% endif %}
|
||||
{% if pkg() >= '049' %}
|
||||
ln -s ${SQUASHED_LOOPDEV} /dev/root
|
||||
{% endif %}
|
||||
|
||||
need_shutdown
|
||||
|
||||
exit 0
|
@ -0,0 +1,27 @@
|
||||
{% calculate chmod='0755' %}
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
. /lib/nfs-lib.sh
|
||||
|
||||
[ "$#" = 3 ] || exit 1
|
||||
|
||||
# root is in the form root=nfs[4]:[server:]path[:options], either from
|
||||
# cmdline or dhcp root-path
|
||||
netif="$1"
|
||||
root="$2"
|
||||
NEWROOT="$3"
|
||||
|
||||
nfs_to_var $root $netif
|
||||
[ -z "$server" ] && die "Required parameter 'server' is missing"
|
||||
|
||||
mkdir -m 0755 -p /run/initramfs/live
|
||||
|
||||
mount_nfs $root /run/initramfs/live $netif && { [ -e /dev/root ] || ln -s null /dev/root ; }
|
||||
|
||||
/sbin/mount-squashfs
|
||||
echo '[ -e /run/initramfs/squashfs/proc ]' > $hookdir/initqueue/finished/nfsroot.sh
|
||||
|
||||
need_shutdown
|
@ -0,0 +1,37 @@
|
||||
{% calculate chmod='755' %}
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
if getargbool 0 rd.live.debug -n -y rdlivedebug; then
|
||||
exec > /tmp/liveroot.$$.out
|
||||
exec 2>> /tmp/liveroot.$$.out
|
||||
set -x
|
||||
fi
|
||||
|
||||
[ -z "$1" ] && exit 1
|
||||
livedev="$1"
|
||||
|
||||
# parse various live image specific options that make sense to be
|
||||
# specified as their own things
|
||||
|
||||
ln -s $livedev /run/initramfs/livedev
|
||||
|
||||
modprobe squashfs
|
||||
CMDLINE=$(getcmdline)
|
||||
for arg in $CMDLINE; do case $arg in ro|rw) liverw=$arg ;; esac; done
|
||||
# mount the backing of the live image first
|
||||
mkdir -m 0755 -p /run/initramfs/live
|
||||
mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
|
||||
if [ "$?" != "0" ]; then
|
||||
die "Failed to mount block device of live image"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
/sbin/mount-squashfs
|
||||
|
||||
exit 0
|
@ -0,0 +1,58 @@
|
||||
{% calculate chmod='755' %}
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
mount_live_root_aufs() {
|
||||
mkdir /run/initramfs/workspace
|
||||
mountoption="-o udba=reval,br:/run/initramfs/workspace=rw:/run/initramfs/squashfs=ro"
|
||||
if getargbool 0 scratch
|
||||
then
|
||||
mkdir /run/initramfs/delta
|
||||
mountoption="-o udba=reval,br:/run/initramfs/workspace=rw:/run/initramfs/delta=ro+wh:/run/initramfs/squashfs=ro"
|
||||
fi
|
||||
mount -t aufs $mountoption none $NEWROOT
|
||||
if getargbool 0 scratch
|
||||
then
|
||||
mkdir /run/builder
|
||||
mountoption="-o udba=reval,br:/run/initramfs/delta=rw:/run/initramfs/squashfs=ro"
|
||||
mount -t aufs $mountoption none /run/builder
|
||||
fi
|
||||
}
|
||||
|
||||
mount_live_root_overlay() {
|
||||
lowerdir=/run/initramfs/squashfs
|
||||
if getargbool 0 scratch
|
||||
then
|
||||
upperdir=/run/initramfs/delta
|
||||
builderdir=/run/builder
|
||||
mkdir $upperdir
|
||||
mkdir $builderdir
|
||||
mkdir ${upperdir}-workdir
|
||||
mount -t overlay -o lowerdir=${lowerdir},upperdir=${upperdir},workdir=${upperdir}-workdir none $builderdir
|
||||
lowerdir=$builderdir
|
||||
fi
|
||||
upperdir=/run/initramfs/workspace
|
||||
mkdir ${upperdir}
|
||||
mkdir ${upperdir}-workdir
|
||||
mount -t overlay -o lowerdir=${lowerdir},upperdir=${upperdir},workdir=${upperdir}-workdir none $NEWROOT
|
||||
}
|
||||
|
||||
mount_live_root() {
|
||||
local module_found=
|
||||
for typefs in overlay aufs
|
||||
do
|
||||
if ! mount -t $typefs -o remount none /init 2>&1 | grep -q "unknown filesystem"
|
||||
then
|
||||
mount_live_root_$typefs
|
||||
module_found=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
[[ -z $module_found ]] &&
|
||||
die "Cannot mount layered filesystem! Compile the kernel with CONFIG_OVERLAY_FS!"
|
||||
}
|
||||
|
||||
[ -n "$root" -a -z "${root%%live*}" -o "$root" = "nfs" ] && mount_live_root
|
@ -0,0 +1,3 @@
|
||||
{% calculate format='regex', multiline, exists('/usr/lib/dracut/modules.d/95nfs/module-setup.sh') %}
|
||||
<reg>instmods.*$</reg>
|
||||
<text>instmods =net/sunrpc =fs/nfs ipv6 nfs_acl nfs_layout_nfsv41_files =drivers/crypto/ccp</text>
|
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
install() {
|
||||
# install userui
|
||||
[ -e /sbin/tuxoniceui ] && inst tuxoniceui || true
|
||||
|
||||
# install splash graphics if exists
|
||||
my_inst_dir() {
|
||||
inst_dir $1
|
||||
for i in $1/*; do
|
||||
if [ -d "$i" ]; then
|
||||
my_inst_dir "$i"
|
||||
else
|
||||
inst "$i"
|
||||
fi
|
||||
done
|
||||
}
|
||||
[ -e /etc/splash/tuxonice ] && my_inst_dir /etc/splash/tuxonice
|
||||
[ -e /etc/splash/suspend2 ] && my_inst_dir /etc/splash/suspend2
|
||||
|
||||
inst_hook pre-udev 30 "$moddir/tuxonice-prepare.sh"
|
||||
inst_hook pre-mount 30 "$moddir/tuxonice-lvmfix.sh"
|
||||
inst "$moddir"/tuxonice-resumecheck.sh /sbin/tuxonice-resumecheck.sh
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
# fixes an asynchronous problem with lvm/dracut while resuming
|
||||
# for details see https://bugzilla.redhat.com/show_bug.cgi?id=830447
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
info "TuxOnIce lvmfix started"
|
||||
|
||||
udevadm settle --timeout=30
|
||||
|
||||
info "TuxOnIce udev should be now fully settled"
|
||||
|
||||
return 0
|
||||
|
@ -0,0 +1,98 @@
|
||||
#!/bin/sh
|
||||
# prepare parameters for ToI
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
info "TuxOnIce premodule started"
|
||||
|
||||
# first check if ToI support is available
|
||||
if [ ! -d /sys/power/tuxonice ]; then
|
||||
info "Kernel has no tuxonice support, aborting"
|
||||
return 0
|
||||
else
|
||||
info "Kernel has tuxonice support, continuing"
|
||||
fi
|
||||
|
||||
if getarg noresume2; then
|
||||
warn "noresume2 was specified, aborting"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# prepare UserUI
|
||||
info "Setting up UserUI"
|
||||
UI="/sbin/tuxoniceui"
|
||||
UIOPTS=""
|
||||
|
||||
if [ -e "/sys/class/graphics/fb0/state" -a -e "/etc/splash/tuxonice/" ]; then
|
||||
UIOPTS="$UIOPTS -f"
|
||||
fi
|
||||
|
||||
SYSFS_TUI_UI=/sys/power/tuxonice/user_interface
|
||||
PROGRAM_PATH=${SYSFS_TUI_UI}/program
|
||||
ENABLED_PATH=${SYSFS_TUI_UI}/enabled
|
||||
if [ -e "$UI" ] && [ -e "$PROGRAM_PATH" ] && [ -e "$ENABLED_PATH" ]; then
|
||||
info "Using $UI with $UIOPTS"
|
||||
echo "$UI $UIOPTS" >$PROGRAM_PATH
|
||||
echo 1 >$ENABLED_PATH
|
||||
else
|
||||
if [ -e "$ENABLED_PATH" ]; then
|
||||
echo 0 >$ENABLED_PATH
|
||||
fi
|
||||
fi
|
||||
|
||||
# install udev rule for resume parameter
|
||||
if resume=$(getarg resume=) && ! getarg noresume2; then
|
||||
resume="${resume#file:}"
|
||||
resume="${resume#swap:}"
|
||||
resume="${resume%:*}"
|
||||
else
|
||||
unset resume
|
||||
fi
|
||||
|
||||
info "Installing udev rule for resume parameter"
|
||||
case "$resume" in
|
||||
LABEL=*) \
|
||||
resume="$(echo $resume | sed 's,/,\\x2f,g')"
|
||||
{
|
||||
echo "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_LABEL}==\"${resume#LABEL=}\", " \
|
||||
" RUN+=\"/sbin/tuxonice-resumecheck.sh '/dev/%k' 'resume'\"";
|
||||
} >> /etc/udev/rules.d/99-tuxonice.rules
|
||||
;;
|
||||
UUID=*) \
|
||||
{
|
||||
echo "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_UUID}==\"${resume#UUID=}\", " \
|
||||
" RUN+=\"/sbin/tuxonice-resumecheck.sh '/dev/%k' 'resume'\"";
|
||||
} >> /etc/udev/rules.d/99-tuxonice.rules
|
||||
;;
|
||||
PARTUUID=*) \
|
||||
{
|
||||
echo "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_PART_ENTRY_UUID}==\"${resume#PARTUUID=}\", " \
|
||||
" RUN+=\"/sbin/tuxonice-resumecheck.sh '/dev/%k' 'resume'\"";
|
||||
} >> /etc/udev/rules.d/99-tuxonice.rules
|
||||
;;
|
||||
*) \
|
||||
{
|
||||
echo "SUBSYSTEM==\"block\", ACTION==\"add|change\", SYMLINK==\"${resume#/dev/}\", " \
|
||||
" RUN+=\"/sbin/tuxonice-resumecheck.sh '/dev/%k' 'resume'\"";
|
||||
} >> /etc/udev/rules.d/99-tuxonice.rules
|
||||
{
|
||||
echo "SUBSYSTEM==\"block\", ACTION==\"add|change\", KERNEL==\"${resume#/dev/}\", " \
|
||||
" RUN+=\"/sbin/tuxonice-resumecheck.sh '/dev/%k' 'resume'\"";
|
||||
} >> /etc/udev/rules.d/99-tuxonice.rules
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# install udev rule for resuming
|
||||
info "Installing udev rule for ToI resume"
|
||||
{
|
||||
echo "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"suspend|swsuspend|swsupend\", " \
|
||||
" RUN+=\"/sbin/tuxonice-resumecheck.sh '/dev/%k' 'suspend'\"";
|
||||
} >> /etc/udev/rules.d/99-tuxonice.rules
|
||||
|
||||
# install udev rule to add swapdevice as hibernation target
|
||||
info "Installing udev rule for ToI swap detection"
|
||||
{
|
||||
echo "SUBSYSTEM==\"block\", ACTION==\"add|change\", ENV{ID_FS_TYPE}==\"swap\", " \
|
||||
" RUN+=\"/sbin/tuxonice-resumecheck.sh '/dev/%k' 'swap'\"";
|
||||
} >> /etc/udev/rules.d/99-tuxonice.rules
|
||||
|
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$2" = "suspend" ]; then
|
||||
echo "<3>Dracut: found ToI/suspend signature in $1, trying to resume" > /dev/kmsg
|
||||
OLDDEV=$(cat /sys/power/tuxonice/resume)
|
||||
echo "swap:$1" >/sys/power/tuxonice/resume
|
||||
echo 1 >/sys/power/tuxonice/do_resume
|
||||
echo "<3>Dracut: no resume operation occured, restoring old value ($OLDDEV)" >/dev/kmsg
|
||||
echo "$OLDDEV" >/sys/power/tuxonice/resume
|
||||
elif [ "$2" = "swap" ]; then
|
||||
echo "<3>Dracut: found swap signature in $1, using for ToI" > /dev/kmsg
|
||||
CURDEV=$(cat /sys/power/tuxonice/resume)
|
||||
[ -z "$CURDEV" ] && echo "swap:$1" >/sys/power/tuxonice/resume
|
||||
elif [ "$2" = "resume" ]; then
|
||||
echo "<3>Dracut: found resume parameter device in $1, trying to resume" > /dev/kmsg
|
||||
echo 1 >/sys/power/tuxonice/do_resume
|
||||
echo "<3>Dracut: no resume operation occured" >/dev/kmsg
|
||||
fi
|
@ -0,0 +1,3 @@
|
||||
{% calculate format='regex', dotall, path='/usr/lib/dracut/modules.d/99base', pkg() < '039' %}
|
||||
<reg>(\nwait_for_dev.*?_name.*?str_replace.*)'\\x2f'</reg>
|
||||
<text>\1'\\\\x2f'</text>
|
@ -0,0 +1 @@
|
||||
{% calculate path='/usr/lib/dracut' %}
|
@ -0,0 +1 @@
|
||||
{% calculate source='/usr/lib/dracut/dracut.conf.d/gentoo.conf', exists('/usr/lib/dracut/dracut.conf.d/gentoo.conf'), mirror %}
|
@ -0,0 +1,14 @@
|
||||
|
||||
omit_dracutmodules+=" multipath"
|
||||
add_dracutmodules+=" video calculate"
|
||||
{% if pkg('net-nds/rpcbind') and pkg('net-misc/iputils[arping]') %}
|
||||
add_dracutmodules+=" nfs"
|
||||
{% endif %}
|
||||
{% if pkg('sys-boot/plymouth') %}
|
||||
add_dracutmodules+=" plymouth"
|
||||
omit_dracutmodules+=" gensplash"
|
||||
{% endif %}
|
||||
omit_dracutmodules+=" biosdevname"
|
||||
|
||||
i18n_default_font="ter-v18n"
|
||||
add_drivers+=" sunrpc crc32c_generic "
|
@ -0,0 +1 @@
|
||||
{% calculate append='remove' %}
|
Loading…
Reference in new issue