Skip to content

Commit

Permalink
Merge branch 'debian'
Browse files Browse the repository at this point in the history
Conflicts:
	debian/control
  • Loading branch information
evgeni committed Jun 26, 2015
2 parents 17381f9 + a09ea36 commit 0ed42c4
Show file tree
Hide file tree
Showing 25 changed files with 415 additions and 392 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
4.0.2-1
5.0~a3-1
11 changes: 2 additions & 9 deletions backend/initramfs-tools/live.hook
Expand Up @@ -105,16 +105,9 @@ manual_add_modules squashfs
manual_add_modules sqlzma
manual_add_modules unlzma

# Filesystem: aufs/overlayfs/unionfs
# Filesystem: aufs/overlay
manual_add_modules aufs
manual_add_modules overlayfs
manual_add_modules unionfs

# Filesystem: unionfs-fuse
if [ -x /usr/bin/unionfs-fuse ]
then
copy_exec /usr/bin/unionfs-fuse /bin
fi
manual_add_modules overlay

# Filesystem: vfat
manual_add_modules nls_cp437
Expand Down
31 changes: 31 additions & 0 deletions components/2010-remove-persistence
@@ -0,0 +1,31 @@
#!/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
}
2 changes: 1 addition & 1 deletion components/9990-cmdline-old
Expand Up @@ -266,7 +266,7 @@ Cmdline_old ()

if [ -z "${UNIONTYPE}" ]
then
UNIONTYPE="aufs"
UNIONTYPE="overlay"
export UNIONTYPE
fi

Expand Down
15 changes: 0 additions & 15 deletions components/9990-main.sh
Expand Up @@ -148,15 +148,6 @@ Live ()

log_end_msg

# unionfs-fuse needs /dev to be bind-mounted for the duration of
# live-bottom; udev's init script will take care of things after that
case "${UNIONTYPE}" in
unionfs-fuse)
mount -n -o bind /dev "${rootmnt}/dev"
;;
esac


# aufs2 in kernel versions around 2.6.33 has a regression:
# directories can't be accessed when read for the first the time,
# causing a failure for example when accessing /var/lib/fai
Expand Down Expand Up @@ -201,12 +192,6 @@ Live ()

Swap

case "${UNIONFS}" in
unionfs-fuse)
umount "${rootmnt}/dev"
;;
esac

exec 1>&6 6>&-
exec 2>&7 7>&-
kill ${tailpid}
Expand Down
54 changes: 15 additions & 39 deletions components/9990-misc-helpers.sh
Expand Up @@ -1292,62 +1292,38 @@ do_union ()
rw_opt="rw"
ro_opt="rr+wh"
noxino_opt="noxino"
;;

unionfs-fuse)
rw_opt="RW"
ro_opt="RO"
;;

*)
rw_opt="rw"
ro_opt="ro"
;;
esac

case "${UNIONTYPE}" in
unionfs-fuse)
unionmountopts="-o cow -o noinitgroups -o default_permissions -o allow_other -o use_ino -o suid"
unionmountopts="${unionmountopts} ${unionrw}=${rw_opt}"
unionmountopts="-o noatime,${noxino_opt},dirs=${unionrw}=${rw_opt}"
if [ -n "${unionro}" ]
then
for rofs in ${unionro}
do
unionmountopts="${unionmountopts}:${rofs}=${ro_opt}"
done
fi
( sysctl -w fs.file-max=391524 ; ulimit -HSn 16384
unionfs-fuse ${unionmountopts} "${unionmountpoint}" ) && \
( mkdir -p /run/sendsigs.omit.d
pidof unionfs-fuse >> /run/sendsigs.omit.d/unionfs-fuse || true )
;;

overlayfs)
# XXX: can multiple unionro be used? (overlayfs only handles two dirs, but perhaps they can be chained?)
# XXX: and can unionro be optional? i.e. can overlayfs skip lowerdir?
overlay)
# XXX: can multiple unionro be used? (overlay only handles two dirs, but perhaps they can be chained?)
# XXX: and can unionro be optional? i.e. can overlay skip lowerdir?
if echo ${unionro} | grep -q " "
then
panic "Multiple lower filesystems are currently not supported with overlayfs (unionro = ${unionro})."
panic "Multiple lower filesystems are currently not supported with overlay (unionro = ${unionro})."
elif [ -z "${unionro}" ]
then
panic "Overlayfs needs at least one lower filesystem (read-only branch)."
fi
unionmountopts="-o noatime,lowerdir=${unionro},upperdir=${unionrw}"
mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}"
;;

*)
unionmountopts="-o noatime,${noxino_opt},dirs=${unionrw}=${rw_opt}"
if [ -n "${unionro}" ]
then
for rofs in ${unionro}
do
unionmountopts="${unionmountopts}:${rofs}=${ro_opt}"
done
panic "overlay needs at least one lower filesystem (read-only branch)."
fi
mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}"
# overlayfs requires:
# + a workdir to become mounted
# + workdir and upperdir to reside under the same mount
# + workdir and upperdir to be in separate directories
mkdir "${unionrw}/rw"
mkdir "${unionrw}/work"
unionmountopts="-o noatime,lowerdir=${unionro},upperdir=${unionrw}/rw,workdir=${unionrw}/work"
;;
esac

mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}"
}

get_custom_mounts ()
Expand Down
112 changes: 35 additions & 77 deletions components/9990-overlay.sh
Expand Up @@ -8,25 +8,12 @@ setup_unionfs ()
rootmnt="${2}"
addimage_directory="${3}"

case ${UNIONTYPE} in
aufs|unionfs|overlayfs)
modprobe -q -b ${UNIONTYPE}
modprobe -q -b ${UNIONTYPE}

if ! cut -f2 /proc/filesystems | grep -q "^${UNIONTYPE}\$" && [ -x /bin/unionfs-fuse ]
then
echo "${UNIONTYPE} not available, falling back to unionfs-fuse."
echo "This might be really slow."

UNIONTYPE="unionfs-fuse"
fi
;;
esac

case "${UNIONTYPE}" in
unionfs-fuse)
modprobe fuse
;;
esac
if ! cut -f2 /proc/filesystems | grep -q "^${UNIONTYPE}\$"
then
panic "${UNIONTYPE} not available."
fi

# run-init can't deal with images in a subdir, but we're going to
# move all of these away before it runs anyway. No, we're not,
Expand Down Expand Up @@ -123,22 +110,15 @@ setup_unionfs ()
;;
esac

case "${UNIONTYPE}" in
unionmount)
mpoint="${rootmnt}"
rootfslist="${rootmnt} ${rootfslist}"
;;

*)
mpoint="${croot}/${imagename}"
rootfslist="${mpoint} ${rootfslist}"
;;
esac
mpoint="${croot}/${imagename}"
rootfslist="${mpoint} ${rootfslist}"

mkdir -p "${mpoint}"
log_begin_msg "Mounting \"${image}\" on \"${mpoint}\" via \"${backdev}\""
mount -t "${fstype}" -o ro,noatime "${backdev}" "${mpoint}" || panic "Can not mount ${backdev} (${image}) on ${mpoint}"
log_end_msg
else
log_warning_msg "Could not find image '${image}'. Most likely it is listed in a .module file, perhaps by mistake."
fi
done
else
Expand Down Expand Up @@ -263,27 +243,24 @@ setup_unionfs ()
cow_mountopt="rw,noatime,mode=755"
fi

if [ "${UNIONTYPE}" != "unionmount" ]
if [ -n "${PERSISTENCE_READONLY}" ] && [ "${cowdevice}" != "tmpfs" ]
then
if [ -n "${PERSISTENCE_READONLY}" ] && [ "${cowdevice}" != "tmpfs" ]
then
mount -t tmpfs -o rw,noatime,mode=755 tmpfs "/live/overlay"
root_backing="/live/persistence/$(basename ${cowdevice})-root"
mkdir -p ${root_backing}
else
root_backing="/live/overlay"
fi
mount -t tmpfs -o rw,noatime,mode=755 tmpfs "/live/overlay"
root_backing="/live/persistence/$(basename ${cowdevice})-root"
mkdir -p ${root_backing}
else
root_backing="/live/overlay"
fi

if [ "${cow_fstype}" = "nfs" ]
then
log_begin_msg \
"Trying nfsmount ${nfs_cow_opts} ${cowdevice} ${root_backing}"
nfsmount ${nfs_cow_opts} ${cowdevice} ${root_backing} || \
panic "Can not mount ${cowdevice} (n: ${cow_fstype}) on ${root_backing}"
else
mount -t ${cow_fstype} -o ${cow_mountopt} ${cowdevice} ${root_backing} || \
panic "Can not mount ${cowdevice} (o: ${cow_fstype}) on ${root_backing}"
fi
if [ "${cow_fstype}" = "nfs" ]
then
log_begin_msg \
"Trying nfsmount ${nfs_cow_opts} ${cowdevice} ${root_backing}"
nfsmount ${nfs_cow_opts} ${cowdevice} ${root_backing} || \
panic "Can not mount ${cowdevice} (n: ${cow_fstype}) on ${root_backing}"
else
mount -t ${cow_fstype} -o ${cow_mountopt} ${cowdevice} ${root_backing} || \
panic "Can not mount ${cowdevice} (o: ${cow_fstype}) on ${root_backing}"
fi

rootfscount=$(echo ${rootfslist} |wc -w)
Expand All @@ -310,34 +287,23 @@ setup_unionfs ()
cow_dirs="/"
fi

if [ "${cow_fstype}" != "tmpfs" ] && [ "${cow_dirs}" != "/" ] && [ "${UNIONTYPE}" = "unionmount" ]
then
true # FIXME: Maybe it does, I don't really know.
#panic "unionmount does not support subunions (${cow_dirs})."
fi

for dir in ${cow_dirs}; do
unionmountpoint="${rootmnt}${dir}"
mkdir -p ${unionmountpoint}
if [ "${UNIONTYPE}" = "unionmount" ]
cow_dir="/live/overlay${dir}"
rootfs_dir="${rootfs}${dir}"
mkdir -p ${cow_dir}
if [ -n "${PERSISTENCE_READONLY}" ] && [ "${cowdevice}" != "tmpfs" ]
then
# FIXME: handle PERSISTENCE_READONLY
unionmountopts="-t ${cow_fstype} -o noatime,union,${cow_mountopt} ${cowdevice}"
# unionmount only works with util-linux mount
mount.util-linux $unionmountopts "${unionmountpoint}"
do_union ${unionmountpoint} ${cow_dir} ${root_backing} ${rootfs_dir}
else
cow_dir="/live/overlay${dir}"
rootfs_dir="${rootfs}${dir}"
mkdir -p ${cow_dir}
if [ -n "${PERSISTENCE_READONLY}" ] && [ "${cowdevice}" != "tmpfs" ]
then
do_union ${unionmountpoint} ${cow_dir} ${root_backing} ${rootfs_dir}
else
do_union ${unionmountpoint} ${cow_dir} ${rootfs_dir}
fi
do_union ${unionmountpoint} ${cow_dir} ${rootfs_dir}
fi || panic "mount ${UNIONTYPE} on ${unionmountpoint} failed with option ${unionmountopts}"
done

# Remove persistence depending on boot parameter
Remove_persistence

# Correct the permissions of /:
chmod 0755 "${rootmnt}"

Expand All @@ -358,15 +324,7 @@ setup_unionfs ()
# do nothing # mount -o bind "${d}" "${live_rootfs}"
;;
*)
case "${UNIONTYPE}" in
unionfs-fuse)
mount -o bind "${d}" "${live_rootfs}"
;;

*)
mount -o move "${d}" "${live_rootfs}"
;;
esac
mount -o move "${d}" "${live_rootfs}"
;;
esac
done
Expand Down
4 changes: 4 additions & 0 deletions components/9990-select-eth-device.sh
Expand Up @@ -24,6 +24,10 @@ Select_eth_device ()
# we want to do some basic IP
modprobe -q af_packet

# Ensure all our net modules get loaded so we can actually compare MAC addresses...
udevadm trigger
udevadm settle

# Available Ethernet interfaces ?
l_interfaces=""

Expand Down

0 comments on commit 0ed42c4

Please sign in to comment.