Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 123897 Details for
Bug 156431
ebuild for userspace suspend (uswsusp)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Script for resume-initrd generation.
create-resume-initrd.sh (text/plain), 2.49 KB, created by
Ole Christian Tvedt
on 2007-07-04 20:25:34 UTC
(
hide
)
Description:
Script for resume-initrd generation.
Filename:
MIME Type:
Creator:
Ole Christian Tvedt
Created:
2007-07-04 20:25:34 UTC
Size:
2.49 KB
patch
obsolete
>#!/bin/bash > >CONFIG_FILE="/etc/suspend.conf" >RESUME="/usr/sbin/resume" > ># ># Output usage on invalid arguments. ># >if [ ${#} -ne 1 ]; then > echo -e "Usage:\n ${0} <outputfile>\n" 1>&2 > echo "Normally, one would do something like:" 1>&2 > echo -e " ${0} /boot/resume-initrd\n" 1>&2 > echo "Remember to set up your bootloader. Grub example:" 1>&2 > echo " title=Gentoo Linux 2.6.20-r8" 1>&2 > echo " root (hd0,0)" 1>&2 > echo " kernel /kernel-2.6.20-gentoo-r8 root=/dev/hdc3" 1>&2 > echo " initrd /resume-initrd" 1>&2 > exit 1 >fi > ># ># Valid outfile? ># >touch "${1}" || exit 1 >OUTFILE="${1}" > ># ># Make sure there is a config file. ># >if [ ! -f "${CONFIG_FILE}" ]; then > echo "Error: Could not find config file at ${CONFIG_FILE}!" 1>&2 > exit 1 >fi > ># ># Get values from CONFIG_FILE ># >RESUME_DEVICE="$(cat "${CONFIG_FILE}" | sed -ne 's/^[ \t]*resume[ \t]\+device[ \t]*\=[ \t]*\([^ \t].*\)$/\1/p')" >INITRD_SIZE="$(cat "${CONFIG_FILE}" | sed -ne 's/^[ \t]*image[ \t]\+size[ \t]*\=[ \t]*\([^ \t].*\)$/\1/p')" > ># ># Default value ># >if [ -z "${INITRD_SIZE}" ]; then > INITRD_SIZE="2000k" >fi > ># ># Validate variables ># >if [ ! -b ${RESUME_DEVICE} ]; then > echo "Error: Device ${RESUME_DEVICE} does not exist!" 1>&2 > echo "Check your configuration (${CONFIG_FILE})." 1>&2 > exit 1 >fi >if [ ! -f ${RESUME} ]; then > RESUME="$(which resume 2> /dev/null)" >fi >if [ ! -f ${RESUME} ]; then > echo "Error: Could not find resume executable!" 1>&2 > exit 1 >fi > ># ># Create temporary files ># >TMP_FILE="$(mktemp -t initrd_dat.XXXXXX)" >MOUNT_POINT="$(mktemp -dt initrd_mnt.XXXXXX)" > ># ># Create and mount image ># >dd if=/dev/zero of="${TMP_FILE}" bs="${INITRD_SIZE}" count=1 >/sbin/mke2fs -F -m0 "${TMP_FILE}" >mount -t ext2 -o loop "${TMP_FILE}" "${MOUNT_POINT}" > ># ># Copy contents to image ># >if [ "$?" = "0" ]; then > mkdir "${MOUNT_POINT}/dev" > mkdir "${MOUNT_POINT}/proc" > mkdir "${MOUNT_POINT}/etc" > > cp -R /dev/console "${MOUNT_POINT}/dev/" > cp -R /dev/snapshot "${MOUNT_POINT}/dev/" > cp -R /dev/random "${MOUNT_POINT}/dev/" > cp -R /dev/urandom "${MOUNT_POINT}/dev/" > cp -R "${RESUME_DEVICE}" "${MOUNT_POINT}/dev/" > cp "${CONFIG_FILE}" "${MOUNT_POINT}/etc/" > cp "${RESUME}" "${MOUNT_POINT}/resume" > ln -s resume "${MOUNT_POINT}/linuxrc" > ># ># Copy result to OUTFILE. ># > umount "${MOUNT_POINT}" > if [ -s "${OUTFILE}" ]; then > mv "${OUTFILE}" "${OUTFILE}.orig" > fi > chmod 644 "${TMP_FILE}" > mv "${TMP_FILE}" "${OUTFILE}" > >else > echo "Error: Could not mount ${TMP_FILE} on ${MOUNT_POINT}!" 1>&2 >fi > ># Clean up >rmdir "${MOUNT_POINT}" > >exit 0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 156431
:
102855
|
102856
|
123896
|
123897
|
124984
|
124985
|
124988
|
124989
|
129971
|
129972
|
130866
|
130871
|
130872