gereksiz-dracut-dizini
This commit is contained in:
parent
2713cd43d5
commit
0c8242e3af
|
@ -1,20 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -b /dev/mapper/live-rw ] && [ -d /run/initramfs/live/updates -o -d /updates ]; then
|
||||
info "Applying updates to live image..."
|
||||
mount -o bind /run $NEWROOT/run
|
||||
# avoid overwriting symlinks (e.g. /lib -> /usr/lib) with directories
|
||||
for d in /updates /run/initramfs/live/updates; do
|
||||
[ -d "$d" ] || continue
|
||||
(
|
||||
cd $d
|
||||
find . -depth -type d | while read dir; do
|
||||
mkdir -p "$NEWROOT/$dir"
|
||||
done
|
||||
find . -depth \! -type d | while read file; do
|
||||
cp -a "$file" "$NEWROOT/$file"
|
||||
done
|
||||
)
|
||||
done
|
||||
umount $NEWROOT/run
|
||||
fi
|
|
@ -1,58 +0,0 @@
|
|||
#!/bin/sh -x
|
||||
# -*- 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
|
||||
|
||||
masa="lxqt"
|
||||
|
||||
echo "pisilinux" > ${NEWROOT}/etc/hostname
|
||||
|
||||
USERNAME=$(getarg live.user)
|
||||
USERSHELL=$(getarg live.shell)
|
||||
|
||||
[ -z "$USERNAME" ] && USERNAME=pisix
|
||||
[ -x $NEWROOT/bin/bash -a -z "$USERSHELL" ] && USERSHELL=/bin/bash
|
||||
[ -z "$USERSHELL" ] && USERSHELL=/bin/sh
|
||||
|
||||
# Create /etc/default/live.conf to store USER.
|
||||
echo "USERNAME=$USERNAME" >> ${NEWROOT}/etc/default/live.conf
|
||||
chmod 644 ${NEWROOT}/etc/default/live.conf
|
||||
|
||||
if ! grep -q ${USERSHELL} ${NEWROOT}/etc/shells ; then
|
||||
echo ${USERSHELL} >> ${NEWROOT}/etc/shells
|
||||
fi
|
||||
|
||||
# Create new user and remove password. We'll use autologin by default.
|
||||
|
||||
#chroot ${NEWROOT} sh -c "groupadd -g 18 'messagebus' "
|
||||
#chroot ${NEWROOT} sh -c "useradd -m -d /var/run/dbus -r -s /bin/false -u 18 -g 18 'messagebus' -c 'D-Bus Message Daemon' "
|
||||
|
||||
chroot ${NEWROOT} sh -c 'useradd -m -c $USERNAME -G audio,video,wheel,utmp -s $USERSHELL $USERNAME'
|
||||
chroot ${NEWROOT} sh -c "groupadd -fg 84 avahi && useradd -c 'Avahi Daemon Owner' -d /var/run/avahi-daemon -u 84 -g avahi -s /bin/false avahi"
|
||||
chroot ${NEWROOT} sh -c "passwd -d $USERNAME >/dev/null 2>&1"
|
||||
|
||||
# Setup default root/user password (pisilinux).
|
||||
chroot ${NEWROOT} sh -c 'echo "root:toor" | chpasswd -c SHA512'
|
||||
chroot ${NEWROOT} sh -c 'echo $USERNAME:pisix | chpasswd -c SHA512'
|
||||
|
||||
#gerekli ayarlar
|
||||
#chroot ${NEWROOT} sh -c "chmod +x /usr/local/bin/tamir"
|
||||
#chroot ${NEWROOT} sh -c "mkdir -p /run/lock/files.ldb && touch /run/lock/files.ldb/LOCK"
|
||||
echo "tamir" >> ${NEWROOT}/root/.xinitrc
|
||||
echo "exec start"$masa >> ${NEWROOT}/root/.xinitrc
|
||||
echo "tamir" >> ${NEWROOT}/home/$USERNAME/.xinitrc
|
||||
echo "exec start"$masa >> ${NEWROOT}/home/$USERNAME/.xinitrc
|
||||
|
||||
|
||||
# Enable sudo permission by default.
|
||||
if [ -f ${NEWROOT}/etc/sudoers ]; then
|
||||
echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> ${NEWROOT}/etc/sudoers
|
||||
fi
|
||||
|
||||
cp /run/initramfs/live/boot/kernel $NEWROOT/boot/kernel
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
[Unit]
|
||||
Description=Media check on %f
|
||||
DefaultDependencies=no
|
||||
Before=shutdown.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=no
|
||||
ExecStart=/bin/checkisomd5 --verbose %f
|
||||
StandardInput=tty-force
|
||||
StandardOutput=inherit
|
||||
StandardError=inherit
|
||||
TimeoutSec=0
|
||||
SuccessExitStatus=2
|
|
@ -1,75 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
modprobe usb_storage
|
||||
modprobe dm_mod
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
|
||||
# support legacy syntax of passing liveimg and then just the base root
|
||||
if getargbool 0 rd.live.image -d -y liveimg; then
|
||||
liveroot="live:$root"
|
||||
fi
|
||||
|
||||
if [ "${root%%:*}" = "live" ] ; then
|
||||
liveroot=$root
|
||||
fi
|
||||
|
||||
[ "${liveroot%%:*}" = "live" ] || exit 0
|
||||
|
||||
case "$liveroot" in
|
||||
live:LABEL=*|LABEL=*) \
|
||||
root="${root#live:}"
|
||||
root="$(echo $root | sed 's,/,\\x2f,g')"
|
||||
root="live:/dev/disk/by-label/${root#LABEL=}"
|
||||
rootok=1 ;;
|
||||
live:CDLABEL=*|CDLABEL=*) \
|
||||
root="${root#live:}"
|
||||
root="$(echo $root | sed 's,/,\\x2f,g')"
|
||||
root="live:/dev/disk/by-label/${root#CDLABEL=}"
|
||||
rootok=1 ;;
|
||||
live:UUID=*|UUID=*) \
|
||||
root="${root#live:}"
|
||||
root="live:/dev/disk/by-uuid/${root#UUID=}"
|
||||
rootok=1 ;;
|
||||
live:PARTUUID=*|PARTUUID=*) \
|
||||
root="${root#live:}"
|
||||
root="live:/dev/disk/by-partuuid/${root#PARTUUID=}"
|
||||
rootok=1 ;;
|
||||
live:PARTLABEL=*|PARTLABEL=*) \
|
||||
root="${root#live:}"
|
||||
root="live:/dev/disk/by-partlabel/${root#PARTLABEL=}"
|
||||
rootok=1 ;;
|
||||
live:/*.[Ii][Ss][Oo]|/*.[Ii][Ss][Oo])
|
||||
root="${root#live:}"
|
||||
root="liveiso:${root}"
|
||||
rootok=1 ;;
|
||||
live:/dev/*)
|
||||
rootok=1 ;;
|
||||
live:/*.[Ii][Mm][Gg]|/*.[Ii][Mm][Gg])
|
||||
[ -f "${root#live:}" ] && rootok=1 ;;
|
||||
esac
|
||||
|
||||
[ "$rootok" != "1" ] && exit 0
|
||||
|
||||
GENERATOR_DIR="$2"
|
||||
[ -z "$GENERATOR_DIR" ] && exit 1
|
||||
|
||||
[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR"
|
||||
|
||||
ROOTFLAGS="$(getarg rootflags)"
|
||||
{
|
||||
echo "[Unit]"
|
||||
echo "Before=initrd-root-fs.target"
|
||||
echo "[Mount]"
|
||||
echo "Where=/sysroot"
|
||||
echo "What=/dev/mapper/live-rw"
|
||||
[ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}"
|
||||
} > "$GENERATOR_DIR"/sysroot.mount
|
||||
|
||||
mkdir -p "$GENERATOR_DIR/dev-mapper-live\x2drw.device.d"
|
||||
{
|
||||
echo "[Unit]"
|
||||
echo "JobTimeoutSec=3000"
|
||||
} > "$GENERATOR_DIR/dev-mapper-live\x2drw.device.d/timeout.conf"
|
|
@ -1,18 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
case "$root" in
|
||||
live:/dev/*)
|
||||
{
|
||||
printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root %s"\n' \
|
||||
"${root#live:/dev/}" "${root#live:}"
|
||||
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root %s"\n' \
|
||||
"${root#live:/dev/}" "${root#live:}"
|
||||
} >> /etc/udev/rules.d/99-live-squash.rules
|
||||
wait_for_dev -n "${root#live:}"
|
||||
;;
|
||||
live:*)
|
||||
if [ -f "${root#live:}" ]; then
|
||||
/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root "${root#live:}"
|
||||
fi
|
||||
;;
|
||||
esac
|
|
@ -1,298 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
command -v unpack_archive >/dev/null || . /lib/img-lib.sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/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
|
||||
live_dir=$(getarg rd.live.dir -d live_dir)
|
||||
[ -z "$live_dir" ] && live_dir="LiveOS"
|
||||
squash_image=$(getarg rd.live.squashimg)
|
||||
[ -z "$squash_image" ] && squash_image="squashfs.img"
|
||||
|
||||
getargbool 0 rd.live.ram -d -y live_ram && live_ram="yes"
|
||||
getargbool 0 rd.live.overlay.reset -d -y reset_overlay && reset_overlay="yes"
|
||||
getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
|
||||
overlay=$(getarg rd.live.overlay -d overlay)
|
||||
getargbool 0 rd.writable.fsimg -d -y writable_fsimg && writable_fsimg="yes"
|
||||
overlay_size=$(getarg rd.live.overlay.size=)
|
||||
[ -z "$overlay_size" ] && overlay_size=512
|
||||
|
||||
getargbool 0 rd.live.overlay.thin && thin_snapshot="yes"
|
||||
|
||||
# CD/DVD media check
|
||||
[ -b $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
|
||||
if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
|
||||
check="yes"
|
||||
fi
|
||||
getarg rd.live.check -d check || check=""
|
||||
if [ -n "$check" ]; then
|
||||
type plymouth >/dev/null 2>&1 && plymouth --hide-splash
|
||||
if [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
p=$(dev_unit_name "$livedev")
|
||||
systemctl start checkisomd5@${p}.service
|
||||
else
|
||||
checkisomd5 --verbose $livedev
|
||||
fi
|
||||
if [ $? -eq 1 ]; then
|
||||
die "CD check failed!"
|
||||
exit 1
|
||||
fi
|
||||
type plymouth >/dev/null 2>&1 && plymouth --show-splash
|
||||
fi
|
||||
|
||||
ln -s $livedev /run/initramfs/livedev
|
||||
|
||||
# determine filesystem type for a filesystem image
|
||||
det_img_fs() {
|
||||
udevadm settle
|
||||
blkid -s TYPE -u noraid -o value "$1"
|
||||
}
|
||||
|
||||
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
|
||||
if [ -f $livedev ]; then
|
||||
# no mount needed - we've already got the LiveOS image in initramfs
|
||||
# check filesystem type and handle accordingly
|
||||
fstype=$(det_img_fs $livedev)
|
||||
case $fstype in
|
||||
squashfs) SQUASHED=$livedev;;
|
||||
auto) die "cannot mount live image (unknown filesystem type)" ;;
|
||||
*) FSIMG=$livedev ;;
|
||||
esac
|
||||
[ -e /sys/fs/$fstype ] || modprobe $fstype
|
||||
else
|
||||
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
|
||||
fi
|
||||
|
||||
# overlay setup helper function
|
||||
do_live_overlay() {
|
||||
# create a sparse file for the overlay
|
||||
# overlay: if non-ram overlay searching is desired, do it,
|
||||
# otherwise, create traditional overlay in ram
|
||||
OVERLAY_LOOPDEV=$( losetup -f )
|
||||
|
||||
l=$(blkid -s LABEL -o value $livedev) || l=""
|
||||
u=$(blkid -s UUID -o value $livedev) || u=""
|
||||
|
||||
if [ -z "$overlay" ]; then
|
||||
pathspec="/${live_dir}/overlay-$l-$u"
|
||||
elif ( echo $overlay | grep -q ":" ); then
|
||||
# pathspec specified, extract
|
||||
pathspec=$( echo $overlay | sed -e 's/^.*://' )
|
||||
fi
|
||||
|
||||
if [ -z "$pathspec" -o "$pathspec" = "auto" ]; then
|
||||
pathspec="/${live_dir}/overlay-$l-$u"
|
||||
fi
|
||||
devspec=$( echo $overlay | sed -e 's/:.*$//' )
|
||||
|
||||
# need to know where to look for the overlay
|
||||
setup=""
|
||||
if [ -n "$devspec" -a -n "$pathspec" -a -n "$overlay" ]; then
|
||||
mkdir -m 0755 /run/initramfs/overlayfs
|
||||
mount -n -t auto $devspec /run/initramfs/overlayfs || :
|
||||
if [ -f /run/initramfs/overlayfs$pathspec -a -w /run/initramfs/overlayfs$pathspec ]; then
|
||||
losetup $OVERLAY_LOOPDEV /run/initramfs/overlayfs$pathspec
|
||||
if [ -n "$reset_overlay" ]; then
|
||||
dd if=/dev/zero of=$OVERLAY_LOOPDEV bs=64k count=1 conv=fsync 2>/dev/null
|
||||
fi
|
||||
setup="yes"
|
||||
fi
|
||||
umount -l /run/initramfs/overlayfs || :
|
||||
fi
|
||||
|
||||
if [ -z "$setup" -o -n "$readonly_overlay" ]; then
|
||||
if [ -n "$setup" ]; then
|
||||
warn "Using temporary overlay."
|
||||
elif [ -n "$devspec" -a -n "$pathspec" ]; then
|
||||
warn "Unable to find persistent overlay; using temporary"
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((overlay_size*1024)) 2> /dev/null
|
||||
if [ -n "$setup" -a -n "$readonly_overlay" ]; then
|
||||
RO_OVERLAY_LOOPDEV=$( losetup -f )
|
||||
losetup $RO_OVERLAY_LOOPDEV /overlay
|
||||
else
|
||||
losetup $OVERLAY_LOOPDEV /overlay
|
||||
fi
|
||||
fi
|
||||
|
||||
# set up the snapshot
|
||||
sz=$(blockdev --getsz $BASE_LOOPDEV)
|
||||
if [ -n "$readonly_overlay" ]; then
|
||||
echo 0 $sz snapshot $BASE_LOOPDEV $OVERLAY_LOOPDEV N 8 | dmsetup create --readonly live-ro
|
||||
base="/dev/mapper/live-ro"
|
||||
over=$RO_OVERLAY_LOOPDEV
|
||||
else
|
||||
base=$BASE_LOOPDEV
|
||||
over=$OVERLAY_LOOPDEV
|
||||
fi
|
||||
|
||||
if [ -n "$thin_snapshot" ]; then
|
||||
modprobe dm_thin_pool
|
||||
mkdir /run/initramfs/thin-overlay
|
||||
|
||||
# In block units (512b)
|
||||
thin_data_sz=$(( $overlay_size * 1024 * 1024 / 512 ))
|
||||
thin_meta_sz=$(( $thin_data_sz / 10 ))
|
||||
|
||||
# It is important to have the backing file on a tmpfs
|
||||
# this is needed to let the loopdevice support TRIM
|
||||
dd if=/dev/null of=/run/initramfs/thin-overlay/meta bs=1b count=1 seek=$((thin_meta_sz)) 2> /dev/null
|
||||
dd if=/dev/null of=/run/initramfs/thin-overlay/data bs=1b count=1 seek=$((thin_data_sz)) 2> /dev/null
|
||||
|
||||
THIN_META_LOOPDEV=$( losetup --show -f /run/initramfs/thin-overlay/meta )
|
||||
THIN_DATA_LOOPDEV=$( losetup --show -f /run/initramfs/thin-overlay/data )
|
||||
|
||||
echo 0 $thin_data_sz thin-pool $THIN_META_LOOPDEV $THIN_DATA_LOOPDEV 1024 1024 | dmsetup create live-overlay-pool
|
||||
dmsetup message /dev/mapper/live-overlay-pool 0 "create_thin 0"
|
||||
|
||||
# Create a snapshot of the base image
|
||||
echo 0 $sz thin /dev/mapper/live-overlay-pool 0 $base | dmsetup create live-rw
|
||||
else
|
||||
#emergency_shell
|
||||
loadkeys trq
|
||||
ln -s /usr/sbin/dmsetup /sbin/
|
||||
modprobe dm_mod
|
||||
modprobe dm_multipath
|
||||
echo "ornek:echo 0 7273437 snapshot /dev/loop1 /dev/loop2 PO 8"
|
||||
echo 0 $sz snapshot $base $over PO 8 | dmsetup create live-rw &
|
||||
|
||||
fi
|
||||
|
||||
# Create a device that always points to a ro base image
|
||||
echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create --readonly live-base &
|
||||
ln -s /dev/dm-0 /dev/mapper/live-base
|
||||
ln -s /dev/dm-1 /dev/mapper/live-rw
|
||||
#emergency_shell
|
||||
}
|
||||
|
||||
# live cd helper function
|
||||
do_live_from_base_loop() {
|
||||
do_live_overlay
|
||||
}
|
||||
|
||||
# we might have a genMinInstDelta delta file for anaconda to take advantage of
|
||||
if [ -e /run/initramfs/live/${live_dir}/osmin.img ]; then
|
||||
OSMINSQFS=/run/initramfs/live/${live_dir}/osmin.img
|
||||
fi
|
||||
|
||||
if [ -n "$OSMINSQFS" ]; then
|
||||
# decompress the delta data
|
||||
dd if=$OSMINSQFS of=/run/initramfs/osmin.img 2> /dev/null
|
||||
OSMIN_SQUASHED_LOOPDEV=$( losetup -f )
|
||||
losetup -r $OSMIN_SQUASHED_LOOPDEV /run/initramfs/osmin.img
|
||||
mkdir -m 0755 -p /run/initramfs/squashfs.osmin
|
||||
mount -n -t squashfs -o ro $OSMIN_SQUASHED_LOOPDEV /run/initramfs/squashfs.osmin
|
||||
OSMIN_LOOPDEV=$( losetup -f )
|
||||
losetup -r $OSMIN_LOOPDEV /run/initramfs/squashfs.osmin/osmin
|
||||
umount -l /run/initramfs/squashfs.osmin
|
||||
fi
|
||||
|
||||
# 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}"
|
||||
if [ -n "$live_ram" ]; then
|
||||
echo "Copying live image to RAM..."
|
||||
echo "(this may take a few minutes)"
|
||||
dd if=$SQUASHED of=/run/initramfs/squashed.img bs=512 2> /dev/null
|
||||
echo "Done copying live image to RAM."
|
||||
SQUASHED="/run/initramfs/squashed.img"
|
||||
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
|
||||
|
||||
if [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
|
||||
FSIMG="/run/initramfs/squashfs/LiveOS/ext3fs.img"
|
||||
elif [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
|
||||
FSIMG="/run/initramfs/squashfs/LiveOS/rootfs.img"
|
||||
fi
|
||||
else
|
||||
# we might have an embedded fs image to use as rootfs (uncompressed live)
|
||||
if [ -e /run/initramfs/live/${live_dir}/ext3fs.img ]; then
|
||||
FSIMG="/run/initramfs/live/${live_dir}/ext3fs.img"
|
||||
elif [ -e /run/initramfs/live/${live_dir}/rootfs.img ]; then
|
||||
FSIMG="/run/initramfs/live/${live_dir}/rootfs.img"
|
||||
fi
|
||||
if [ -n "$live_ram" ]; then
|
||||
echo 'Copying live image to RAM...'
|
||||
echo '(this may take a few minutes)'
|
||||
dd if=$FSIMG of=/run/initramfs/rootfs.img bs=512 2> /dev/null
|
||||
echo 'Done copying live image to RAM.'
|
||||
FSIMG='/run/initramfs/rootfs.img'
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$FSIMG" ] ; then
|
||||
BASE_LOOPDEV=$( losetup -f )
|
||||
|
||||
if [ -n "$writable_fsimg" ] ; then
|
||||
# mount the provided filesystem read/write
|
||||
echo "Unpacking live filesystem (may take some time)"
|
||||
mkdir /run/initramfs/fsimg/
|
||||
if [ -n "$SQUASHED" ]; then
|
||||
cp -v $FSIMG /run/initramfs/fsimg/rootfs.img
|
||||
else
|
||||
unpack_archive $FSIMG /run/initramfs/fsimg/
|
||||
fi
|
||||
FSIMG=/run/initramfs/fsimg/rootfs.img
|
||||
fi
|
||||
if [ -n "$writable_fsimg" ] || [ -z "$SQUASHED" -a -n "$live_ram" ] ||
|
||||
[ "$overlay" = none -o "$overlay" = None -o "$overlay" = NONE ]; then
|
||||
losetup $BASE_LOOPDEV $FSIMG
|
||||
sz=$(blockdev --getsz $BASE_LOOPDEV)
|
||||
echo 0 $sz linear $BASE_LOOPDEV 0 | dmsetup create live-rw
|
||||
else
|
||||
# mount the filesystem read-only and add a dm snapshot for writes
|
||||
losetup -r $BASE_LOOPDEV $FSIMG
|
||||
do_live_from_base_loop
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -e "$SQUASHED" ] && umount -l /run/initramfs/squashfs
|
||||
|
||||
if [ -b "$OSMIN_LOOPDEV" ]; then
|
||||
# set up the devicemapper snapshot device, which will merge
|
||||
# the normal live fs image, and the delta, into a minimzied fs image
|
||||
echo "0 $( blockdev --getsz $BASE_LOOPDEV ) snapshot $BASE_LOOPDEV $OSMIN_LOOPDEV N 8" | dmsetup create --readonly live-osimg-min
|
||||
fi
|
||||
|
||||
ROOTFLAGS="$(getarg rootflags)"
|
||||
if [ -n "$ROOTFLAGS" ]; then
|
||||
ROOTFLAGS="-o $ROOTFLAGS"
|
||||
fi
|
||||
|
||||
ln -s /dev/mapper/live-rw /dev/root
|
||||
|
||||
if [ -z "$DRACUT_SYSTEMD" ]; then
|
||||
printf 'mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > $hookdir/mount/01-$$-live.sh
|
||||
fi
|
||||
|
||||
need_shutdown
|
||||
|
||||
exit 0
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "${root%%:*}" = "liveiso" ]; then
|
||||
{
|
||||
printf 'KERNEL=="loop-control", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root `/sbin/losetup -f --show %s`"\n' \
|
||||
${root#liveiso:}
|
||||
} >> /etc/udev/rules.d/99-liveiso-mount.rules
|
||||
fi
|
|
@ -1,36 +0,0 @@
|
|||
#!/bin/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
|
||||
losetup -f "/run/initramfs/isoscan/$isofile"
|
||||
rm -f -- "$job"
|
||||
exit 0
|
||||
else
|
||||
umount "/run/initramfs/isoscan"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
do_iso_scan
|
||||
|
||||
rmdir "/run/initramfs/isoscan"
|
||||
exit 1
|
|
@ -1,40 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
# a live host-only image doesn't really make a lot of sense
|
||||
[[ $hostonly ]] && return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
# if dmsetup is not installed, then we cannot support fedora/red hat
|
||||
# style live images
|
||||
echo dm rootfs-block img-lib
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
instmods squashfs loop iso9660
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple umount dmsetup blkid dd losetup grep blockdev find
|
||||
inst_multiple -o checkisomd5
|
||||
inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
|
||||
inst_hook cmdline 31 "$moddir/parse-iso-scan.sh"
|
||||
inst_hook pre-udev 30 "$moddir/dmsquash-live-genrules.sh"
|
||||
inst_hook pre-udev 30 "$moddir/dmsquash-liveiso-genrules.sh"
|
||||
inst_hook pre-pivot 20 "$moddir/apply-live-updates.sh"
|
||||
inst_script "$moddir/dmsquash-live-root.sh" "/sbin/dmsquash-live-root"
|
||||
inst_script "$moddir/iso-scan.sh" "/sbin/iso-scan"
|
||||
inst_script "$moddir/dmsquash-generator.sh" $systemdutildir/system-generators/dracut-dmsquash-generator
|
||||
inst_hook pre-pivot 10 "$moddir/ayarlar.sh"
|
||||
# should probably just be generally included
|
||||
inst_rules 60-cdrom_id.rules
|
||||
inst_simple "$moddir/checkisomd5@.service" "/etc/systemd/system/checkisomd5@.service"
|
||||
dracut_need_initqueue
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
#!/bin/sh
|
||||
# live images are specified with
|
||||
# root=live:backingdev
|
||||
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
|
||||
# support legacy syntax of passing liveimg and then just the base root
|
||||
if getargbool 0 rd.live.image -d -y liveimg; then
|
||||
liveroot="live:$root"
|
||||
fi
|
||||
|
||||
if [ "${root%%:*}" = "live" ] ; then
|
||||
liveroot=$root
|
||||
fi
|
||||
|
||||
[ "${liveroot%%:*}" = "live" ] || return 1
|
||||
|
||||
modprobe -q loop
|
||||
|
||||
case "$liveroot" in
|
||||
live:LABEL=*|LABEL=*) \
|
||||
root="${root#live:}"
|
||||
root="$(echo $root | sed 's,/,\\x2f,g')"
|
||||
root="live:/dev/disk/by-label/${root#LABEL=}"
|
||||
rootok=1 ;;
|
||||
live:CDLABEL=*|CDLABEL=*) \
|
||||
root="${root#live:}"
|
||||
root="$(echo $root | sed 's,/,\\x2f,g')"
|
||||
root="live:/dev/disk/by-label/${root#CDLABEL=}"
|
||||
rootok=1 ;;
|
||||
live:UUID=*|UUID=*) \
|
||||
root="${root#live:}"
|
||||
root="live:/dev/disk/by-uuid/${root#UUID=}"
|
||||
rootok=1 ;;
|
||||
live:PARTUUID=*|PARTUUID=*) \
|
||||
root="${root#live:}"
|
||||
root="live:/dev/disk/by-partuuid/${root#PARTUUID=}"
|
||||
rootok=1 ;;
|
||||
live:PARTLABEL=*|PARTLABEL=*) \
|
||||
root="${root#live:}"
|
||||
root="live:/dev/disk/by-partlabel/${root#PARTLABEL=}"
|
||||
rootok=1 ;;
|
||||
live:/*.[Ii][Ss][Oo]|/*.[Ii][Ss][Oo])
|
||||
root="${root#live:}"
|
||||
root="liveiso:${root}"
|
||||
rootok=1 ;;
|
||||
live:/dev/*)
|
||||
rootok=1 ;;
|
||||
live:/*.[Ii][Mm][Gg]|/*.[Ii][Mm][Gg])
|
||||
[ -f "${root#live:}" ] && rootok=1 ;;
|
||||
esac
|
||||
|
||||
[ "$rootok" = "1" ] || return 1
|
||||
|
||||
info "root was $liveroot, is now $root"
|
||||
|
||||
# make sure that init doesn't complain
|
||||
[ -z "$root" ] && root="live"
|
||||
|
||||
wait_for_dev -n /dev/mapper/live-rw
|
||||
|
||||
return 0
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/sh
|
||||
# live images are specified with
|
||||
# root=live:backingdev
|
||||
|
||||
isofile=$(getarg iso-scan/filename)
|
||||
|
||||
if [ -n "$isofile" ]; then
|
||||
/sbin/initqueue --settled --unique /sbin/iso-scan "$isofile"
|
||||
fi
|
Loading…
Reference in New Issue