9 copyto
="${copyfrom}_swap"
11 if [ -z "${MODULETORAM}" ]
13 size
=$
(fs_size
"" ${copyfrom}/ "used")
15 MODULETORAMFILE
="${copyfrom}/${LIVE_MEDIA_PATH}/${MODULETORAM}"
17 if [ -f "${MODULETORAMFILE}" ]
19 size
=$
( expr $
(ls -la ${MODULETORAMFILE} |
awk '{print $5}') / 1024 + 5000 )
21 log_warning_msg
"Error: toram-module ${MODULETORAM} (${MODULETORAMFILE}) could not be read."
26 if [ "${copytodev}" = "ram" ]
29 freespace
=$
(awk '/^MemFree:/{f=$2} /^Cached:/{c=$2} END{print f+c}' /proc
/meminfo
)
30 mount_options
="-o size=${size}k"
35 # it should be a writable block device
36 if [ -b "${copytodev}" ]
40 fstype
=$
(get_fstype
"${dev}")
41 freespace
=$
(fs_size
"${dev}")
43 log_warning_msg
"${copytodev} is not a block device."
48 if [ "${freespace}" -lt "${size}" ]
50 log_warning_msg
"Not enough free ${free_string} (${freespace}k free, ${size}k needed) to copy live media in ${copytodev}."
55 if [ -z "${mount_options}" ] && [ -n "${ramdisk_size}" ]
57 # FIXME: should check for wrong values
58 mount_options
="-o size=${ramdisk_size}"
61 # begin copying (or uncompressing)
63 log_begin_msg
"mount -t ${fstype} ${mount_options} ${dev} ${copyto}"
64 mount
-t "${fstype}" ${mount_options} "${dev}" "${copyto}"
66 if [ "${extension}" = "tgz" ]
69 tar zxf
"${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
70 rm -f "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
71 mount
-r -o move
"${copyto}" "${rootmnt}"
74 if [ -n "${MODULETORAMFILE}" ]
78 echo " * Copying $MODULETORAMFILE to RAM" 1>/dev
/console
79 rsync
-a --progress ${MODULETORAMFILE} ${copyto} 1>/dev
/console
# copy only the filesystem module
81 cp ${MODULETORAMFILE} ${copyto} # copy only the filesystem module
86 echo " * Copying whole medium to RAM" 1>/dev
/console
87 rsync
-a --progress ${copyfrom}/* ${copyto} 1>/dev
/console
# "cp -a" from busybox also copies hidden files
89 mkdir
-p ${copyto}/${LIVE_MEDIA_PATH}
90 cp -a ${copyfrom}/${LIVE_MEDIA_PATH}/* ${copyto}/${LIVE_MEDIA_PATH}
91 if [ -e ${copyfrom}/${LIVE_MEDIA_PATH}/.disk
]
93 cp -a ${copyfrom}/${LIVE_MEDIA_PATH}/.disk ${copyto}
99 mount
-r -o move
${copyto} ${copyfrom}