# begin copying (or uncompressing)
mkdir "${copyto}"
echo "mount -t ${fstype} ${mount_options} ${dev} ${copyto}"
- mount -t "${fstype}" ${mount_options} "${dev}" "${copyto}"
+ mount -n -t "${fstype}" ${mount_options} "${dev}" "${copyto}"
if [ "${extension}" = "tgz" ]
then
cd "${copyto}"
tar zxf "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
rm -f "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
- mount -r -o move "${copyto}" "${rootmnt}"
+ mount -n -r -o move "${copyto}" "${rootmnt}"
cd "${OLDPWD}"
else
if [ -n "${MODULETORAMFILE}" ]
livefs_root
umount ${copyfrom}
- mount -r -o move ${copyto} ${copyfrom}
+ mount -n -r -o move ${copyto} ${copyfrom}
fi
rmdir ${copyto}
{
rc=1
dest="${mountpoint}/${LIVE_MEDIA_PATH}"
- mount -t ramfs ram "${mountpoint}"
+ mount -n -t ramfs ram "${mountpoint}"
mkdir -p "${dest}"
for webfile in HTTPFS FTPFS FETCH
if [ -n "${fstype}" ]
then
# Copying stuff...
- mount -t "${fstype}" -o ro,noatime "${fromdev}" "${tomount}"
+ mount -n -t "${fstype}" -o ro,noatime "${fromdev}" "${tomount}"
cp -a "${tomount}"/* ${todir}
umount "${tomount}"
else
mkdir -p "${croot}/${imagename}"
log_begin_msg "Mounting \"${image}\" on \"${croot}${imagename}\" via \"${backdev}\""
- mount -t "${fstype}" -o ro,noatime "${backdev}" "${croot}/${imagename}" || panic "Can not mount ${backdev} (${image}) on ${croot}/${imagename}" && rofsstring="${croot}/${imagename}=${roopt}:${rofsstring}" && rofslist="${croot}/${imagename} ${rofslist}"
+ mount -n -t "${fstype}" -o ro,noatime "${backdev}" "${croot}/${imagename}" || panic "Can not mount ${backdev} (${image}) on ${croot}/${imagename}" && rofsstring="${croot}/${imagename}=${roopt}:${rofsstring}" && rofslist="${croot}/${imagename} ${rofslist}"
log_end_msg
fi
done
nfsmount ${nfs_cow_opts} ${cowdevice} /cow || \
panic "Can not mount ${cowdevice} (n: ${cow_fstype}) on /cow"
else
- mount -t ${cow_fstype} -o ${cow_mountopt} ${cowdevice} /cow || \
+ mount -n -t ${cow_fstype} -o ${cow_mountopt} ${cowdevice} /cow || \
panic "Can not mount ${cowdevice} (o: ${cow_fstype}) on /cow"
fi
fi
exposedrootfs=${rofslist%% }
- mount --bind ${exposedrootfs} ${rootmnt} || \
+ mount -n --bind ${exposedrootfs} ${rootmnt} || \
panic "bind mount of ${exposedrootfs} failed"
cow_dirs='/var/tmp /var/lock /var/run /var/log /var/spool
for dir in ${cow_dirs}; do
mkdir -p /cow${dir}
- mount -t ${UNIONTYPE} \
+ mount -n -t ${UNIONTYPE} \
-o rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro \
${UNIONTYPE} "${rootmnt}${dir}" || \
panic "mount ${UNIONTYPE} on ${rootmnt}${dir} failed with option \
rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro"
done
else
- mount -t ${UNIONTYPE} -o noatime,dirs=/cow=rw:${rofsstring} \
+ mount -n -t ${UNIONTYPE} -o noatime,dirs=/cow=rw:${rofsstring} \
${UNIONTYPE} "${rootmnt}" || panic "mount ${UNIONTYPE} on \
${rootmnt} failed with option noatime,dirs=/cow=rw:${rofsstring}"
fi
# tmpfs file systems
touch /etc/fstab
mkdir -p "${rootmnt}/live"
- mount -t tmpfs tmpfs ${rootmnt}/live
+ mount -n -t tmpfs tmpfs ${rootmnt}/live
# Adding other custom mounts
if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
if [ -b "${homecow}" ]
then
- mount -t $(get_fstype "${homecow}") -o rw,noatime "${homecow}" "${rootmnt}/home"
+ mount -n -t $(get_fstype "${homecow}") -o rw,noatime "${homecow}" "${rootmnt}/home"
export HOMEMOUNTED=1 # used to proper calculate free space in do_snap_copy()
else
log_warning_msg "Unable to find the persistent home medium"
;;
*)
- mount -o move "${d}" "${rootmnt}/live/${d##*/}"
+ mount -n -o move "${d}" "${rootmnt}/live/${d##*/}"
;;
esac
done
# shows cow fs on /cow for use by live-snapshot
mkdir -p "${rootmnt}/live/cow"
- mount -o move /cow "${rootmnt}/live/cow" >/dev/null 2>&1 || mount -o bind /cow "${rootmnt}/live/cow" || log_warning_msg "Unable to move or bind /cow to ${rootmnt}/live/cow"
+ mount -n -o move /cow "${rootmnt}/live/cow" >/dev/null 2>&1 || mount -n -o bind /cow "${rootmnt}/live/cow" || log_warning_msg "Unable to move or bind /cow to ${rootmnt}/live/cow"
}
check_dev ()
if [ -d "${devname}" ]
then
- mount -o bind "${devname}" $mountpoint || continue
+ mount -n -o bind "${devname}" $mountpoint || continue
if is_live_path $mountpoint
then
if is_supported_fs ${fstype}
then
- mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
+ mount -n -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
if is_live_path ${mountpoint} && \
([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})
# Arrange for shells on virtual consoles, rather than login prompts
-if [ -z "${NOAUTOLOGIN}" ]
+if [ -z "${NOAUTOLOGIN}" ] && [ -n "${USERNAME}" ]
then
- if [ -n "${USERNAME}" ]
+ if [ ! -z "${LIVE_GETTY}" ]
then
- if [ ! -z "${LIVE_GETTY}" ]
+ if echo "${DEFCONSOLE}" | grep -qs ttyS
then
- if echo "${DEFCONSOLE}" | grep -qs ttyS
+ # AUTOMATIC SERIAL CONSOLE #
+ PORT=$(echo "${DEFCONSOLE}" | \
+ sed -e 's%,.*%%')
+ SPEED=$(echo "${DEFCONSOLE}" | \
+ sed -e 's%ttyS[0-9]\+,%%' \
+ -e's%\([0-9]\+\).*%\1%')
+
+ if ! ( sed -n -e'/^[^#]/p' /root/etc/inittab | grep -qs ":respawn:/sbin/getty.*${PORT}" )
then
- # AUTOMATIC SERIAL CONSOLE #
- PORT=$(echo "${DEFCONSOLE}" | \
- sed -e 's%,.*%%')
- SPEED=$(echo "${DEFCONSOLE}" | \
- sed -e 's%ttyS[0-9]\+,%%' \
- -e's%\([0-9]\+\).*%\1%')
-
- if ! ( sed -n -e'/^[^#]/p' /root/etc/inittab | grep -qs ":respawn:/sbin/getty.*${PORT}" )
- then
- IDs="A B C D E F G H I J K L M N O P Q R S T Q U V V X Y Z 0 1 2 3 4 5 6 7 8 9"
-
- for ID1 in ${IDs}
+ IDs="A B C D E F G H I J K L M N O P Q R S T Q U V V X Y Z 0 1 2 3 4 5 6 7 8 9"
+
+ for ID1 in ${IDs}
+ do
+ for ID2 in ${IDs}
do
- for ID2 in ${IDs}
- do
- ID="${ID1}${ID2}"
-
- if ! grep "^${ID}:" /etc/inittab
- then
- #make sure it is not already in use
- break 2
- fi
- done
- done
+ ID="${ID1}${ID2}"
- echo "${ID}:2345:respawn:/sbin/live-getty -L ${PORT} ${SPEED} vt100" >> /root/etc/inittab
- fi
- fi
+ if ! grep "^${ID}:" /etc/inittab
+ then
+ #make sure it is not already in use
+ break 2
+ fi
+ done
+ done
- if [ -f /root/etc/inittab ]
- then
- sed -i -e'/^[^#]/s%respawn:/sbin/getty%respawn:/sbin/live-getty%' /root/etc/inittab
- fi
- else
- if [ -f /root/etc/inittab ]
- then
- sed -i -e "s|^\([^:]*:[^:]*:[^:]*\):.*getty.*\<\(tty[0-9]*\).*$|\1:/bin/login -f ${USERNAME} </dev/\2 >/dev/\2 2>\&1|" /root/etc/inittab
+ echo "${ID}:2345:respawn:/sbin/live-getty -L ${PORT} ${SPEED} vt100" >> /root/etc/inittab
fi
+ fi
- if [ "/root/etc/event.d/tty*" != "$(echo /root/etc/event.d/tty*)" ]
- then
- for f in /root/etc/event.d/tty*
- do
- sed -i -e "s|^respawn.*|respawn /bin/login -f ${USERNAME} </dev/$(basename ${f}) > /dev/$(basename ${f}) 2>\&1|" ${f}
- done
- fi
+ if [ -f /root/etc/inittab ]
+ then
+ sed -i -e'/^[^#]/s%respawn:/sbin/getty%respawn:/sbin/live-getty%' /root/etc/inittab
+ fi
+ else
+ if [ -f /root/etc/inittab ]
+ then
+ sed -i -e "s|^\([^:]*:[^:]*:[^:]*\):.*getty.*\<\(tty[0-9]*\).*$|\1:/bin/login -f ${USERNAME} </dev/\2 >/dev/\2 2>\&1|" /root/etc/inittab
fi
- # Since we use autologin, lastlog doesn't make sense on the console.
- sed -i '/^[^#].*pam_lastlog\.so/s/^/# /' /root/etc/pam.d/login
+ if [ "/root/etc/event.d/tty*" != "$(echo /root/etc/event.d/tty*)" ]
+ then
+ for f in /root/etc/event.d/tty*
+ do
+ sed -i -e "s|^respawn.*|respawn /bin/login -f ${USERNAME} </dev/$(basename ${f}) > /dev/$(basename ${f}) 2>\&1|" ${f}
+ done
+ fi
fi
+
+ # Since we use autologin, lastlog doesn't make sense on the console.
+ sed -i '/^[^#].*pam_lastlog\.so/s/^/# /' /root/etc/pam.d/login
fi
# do not try to remove files if using file-rc