Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 40036 Details for
Bug 43146
Support for dm-crypt in baselayout
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
apply on top of tigger's patch
dm-crypt-alternate-confd.patch (text/plain), 8.31 KB, created by
Aron Griffis (RETIRED)
on 2004-09-20 15:34:19 UTC
(
hide
)
Description:
apply on top of tigger's patch
Filename:
MIME Type:
Creator:
Aron Griffis (RETIRED)
Created:
2004-09-20 15:34:19 UTC
Size:
8.31 KB
patch
obsolete
>Index: init.d/checkfs >=================================================================== >RCS file: /var/cvsroot/gentoo-src/rc-scripts/init.d/checkfs,v >retrieving revision 1.39 >diff -u -B -r1.39 checkfs >--- init.d/checkfs 16 Sep 2004 12:30:13 -0000 1.39 >+++ init.d/checkfs 20 Sep 2004 22:32:40 -0000 >@@ -179,69 +179,9 @@ > eend $? "Failed to setup the LVM" > fi > >- > ebegin 'Setting up dm-crypt mappings' >- >- if [ -f /etc/conf.d/cryptfs ] >- then >- cryptfs_status=0 >- >- /bin/egrep '^(mount|swap)' /etc/conf.d/cryptfs | \ >- while read mountline >- do >- mount= >- swap= >- options= >- pre_mount= >- >- eval ${mountline} >- >- if [ -n "${mount}" ] >- then >- target=${mount} >- [ -z "${options}" ] && options='-c aes -h sha1' >- elif [ -n "${swap}" ] >- then >- target=${swap} >- [ -z "${options}" ] && options='-c aes -h sha1 -d /dev/urandom' >- else >- ewarn "Invalid line in /etc/conf.d/cryptomount: ${mountline}" >- fi >- >- ! /bin/cryptsetup status ${target}|egrep '\<active:' > /dev/null >- configured=$? >- >- if [ ${configured} -eq 0 ] >- then >- einfo "dm-crypt map ${target}" >- if ! /bin/cryptsetup ${options} create ${target} ${source} >/dev/console </dev/console >- then >- ewarn "Failure configuring ${target}" >- cryptfs_status=1 >- else >- if [ -n "${swap}" ] >- then >- [ -z "${pre_mount}" ] && pre_mount='mkswap ${dev}' >- fi >- >- if [ -n "${pre_mount}" ] >- then >- dev="/dev/mapper/${target}" >- einfo " Running pre_mount commands on: ${target}" >- if ! eval "${pre_mount}" > /dev/null >- then >- ewarn "Failed to run pre_mount commands on: ${target}" >- cryptfs_status=1 >- fi >- fi >- fi >- else >- ewarn "dm-crypt mapping ${target} is already configured" >- cryptfs_status=1 >- fi >- done >- fi >- ewend ${cryptfs_status} 'Failed to setup a mapping or swap device.' >+ dm-crypt-start >+ ewend $? 'Failed to setup a mapping or swap device' > > if [ -f /fastboot -o -n "${CDBOOT}" ] > then >@@ -273,4 +213,89 @@ > fi > } > >+# Note: This function is exactly duplicated in localmount. If you change it >+# here, make sure to change it there also! >+dm-crypt-start() { >+ local cryptfs_status=0 >+ local mountline mount swap options pre_mount post_mount source >+ shopt -s extglob # for +(...) and friends >+ >+ if [ -f /etc/conf.d/cryptfs ]; then >+ while read mountline; do >+ # skip comments and blank lines, ignoring leading w/s >+ [[ ${mountline//[ ]/} == +(\#*|) ]] && continue >+ >+ # check for the start of a new mount/swap >+ if [[ ${mountline} == +(mount=*|swap=*) ]]; then >+ # If we have a mount queued up, then execute it >+ dm-crypt-execute >+ >+ # Prepare for the next mount/swap by setting defaults >+ unset mount swap options pre_mount post_mount source >+ eval "${mountline}" >+ if [[ -n ${mount} ]]; then >+ options='-c aes -h sha1' >+ elif [[ -n ${swap} ]]; then >+ options='-c aes -h sha1 -d /dev/urandom' >+ pre_mount='mkswap ${dev}' >+ else >+ # This should never happen... >+ ewarn "Strange! /etc/conf.d/cryptfs: ${mountline}" >+ fi >+ >+ # Check for an invalid setting >+ elif [[ ${mountline} != +(options=*|pre_mount=*|post_mount=*|source=*) ]]; then >+ ewarn "Skipping invalid line in /etc/conf.d/cryptfs: ${mountline}" >+ continue >+ elif [[ -z ${mount} && -z ${swap} ]]; then >+ ewarn "Ignoring setting outside mount/swap section: ${mountline}" >+ continue >+ fi >+ >+ # Queue this setting for the next call to dmcrypt-execute >+ eval "${mountline}" >+ done < /etc/conf.d/cryptfs >+ >+ # If we have a mount queued up, then execute it >+ dmcrypt-execute >+ fi >+ >+ return ${cryptfs_status} >+} >+ >+# Setup mappings for an individual mount/swap >+# >+# Note: This relies on variables localized in dm-crypt-start. This function >+# is quite different from the function by the same name in localmount... >+dm-crypt-execute() { >+ local dev target >+ >+ if [[ -n ${mount} ]]; then >+ target=${mount} >+ elif [[ -n ${swap} ]]; then >+ target=${swap} >+ else >+ return >+ fi >+ >+ if /bin/cryptsetup status ${target} | egrep -q '\<active:'; then >+ einfo "dm-crypt mapping ${target} is already configured" >+ return >+ fi >+ >+ ebegin "dm-crypt map ${target}" >+ /bin/cryptsetup ${options} create ${target} ${source} >/dev/console </dev/console >+ eend $? "failure running cryptsetup" >+ if [[ $? != 0 ]]; then >+ cryptfs_status=1 >+ else >+ if [[ -n ${pre_mount} ]]; then >+ dev="/dev/mapper/${target}" >+ ebegin " Running pre_mount commands for ${target}" >+ eval "${pre_mount}" > /dev/null >+ ewend $? || cryptfs_status=1 >+ fi >+ fi >+} >+ > # vim:ts=4 >Index: init.d/localmount >=================================================================== >RCS file: /var/cvsroot/gentoo-src/rc-scripts/init.d/localmount,v >retrieving revision 1.23 >diff -u -B -r1.23 localmount >--- init.d/localmount 16 Sep 2004 12:30:13 -0000 1.23 >+++ init.d/localmount 20 Sep 2004 22:32:40 -0000 >@@ -42,48 +42,91 @@ > /sbin/swapon -a &>/dev/null > eend 0 > >- # Run any post_mount commands for cryptfs >+ ebegin 'Running post_mount commands for dm-crypt' >+ dm-crypt-start >+ ewend $? 'Failed to run a post_mount command' >+} > >- if [ -f /etc/conf.d/cryptfs ] >- then >- ebegin "Running post_mount commands for cryptfs" >- >- /bin/egrep "^mount" /etc/conf.d/cryptfs | \ >- while read mountline >- do >- mount= >- mount_point= >- post_mount= >- >- eval ${mountline} >- >- target=${mount} >- >- ! /bin/cryptsetup status ${target}|egrep '\<active:' > /dev/null >- configured=$? >- >- if [ ${configured} -eq 1 ] >- then >- mount_point=`/bin/awk "/\/dev\/mapper\/${target}/ { print \\$2 }" /proc/mounts` >- if [ -n "${mount_point}" ] >- then >- if [ -n "${post_mount}" ] >- then >- if ! eval "${post_mount}" > /dev/null >- then >- ewarn "Failed to run post_mount commands on: ${target}" >- fi >- fi >+# Note: This function is exactly duplicated in localmount. If you change it >+# here, make sure to change it there also! >+dm-crypt-start() { >+ local cryptfs_status=0 >+ local mountline mount swap options pre_mount post_mount source >+ shopt -s extglob # for +(...) and friends >+ >+ if [ -f /etc/conf.d/cryptfs ]; then >+ while read mountline; do >+ # skip comments and blank lines, ignoring leading w/s >+ [[ ${mountline//[ ]/} == +(\#*|) ]] && continue >+ >+ # check for the start of a new mount/swap >+ if [[ ${mountline} == +(mount=*|swap=*) ]]; then >+ # If we have a mount queued up, then execute it >+ dm-crypt-execute >+ >+ # Prepare for the next mount/swap by setting defaults >+ unset mount swap options pre_mount post_mount source >+ eval "${mountline}" >+ if [[ -n ${mount} ]]; then >+ options='-c aes -h sha1' >+ elif [[ -n ${swap} ]]; then >+ options='-c aes -h sha1 -d /dev/urandom' >+ pre_mount='mkswap ${dev}' > else >- ewarn "Failed to find mount point to ${target}. Skipping" >+ # This should never happen... >+ ewarn "Strange! /etc/conf.d/cryptfs: ${mountline}" > fi >- else >- ewarn "Target ${target} wasn't mapped, skipping" >+ >+ # Check for an invalid setting >+ elif [[ ${mountline} != +(options=*|pre_mount=*|post_mount=*|source=*) ]]; then >+ ewarn "Skipping invalid line in /etc/conf.d/cryptfs: ${mountline}" >+ continue >+ elif [[ -z ${mount} && -z ${swap} ]]; then >+ ewarn "Ignoring setting outside mount/swap section: ${mountline}" >+ continue > fi > >- done >+ # Queue this setting for the next call to dmcrypt-execute >+ eval "${mountline}" >+ done < /etc/conf.d/cryptfs >+ >+ # If we have a mount queued up, then execute it >+ dmcrypt-execute > fi >+ >+ return ${cryptfs_status} > } > >+# Run any post_mount commands for an individual mount >+# >+# Note: This relies on variables localized in dm-crypt-start. This function >+# is quite different from the function by the same name in checkfs... >+dm-crypt-execute() { >+ local mount_point target >+ >+ if [[ -n ${mount} && -n ${post_mount} ]]; then >+ target=${mount} >+ else >+ return >+ fi >+ >+ if ! /bin/cryptsetup status ${target} | egrep -q '\<active:'; then >+ ewarn "Skipping unmapped target ${target}" >+ cryptfs_status=1 >+ return >+ fi >+ >+ mount_point=$(grep "/dev/mapper/${target}" /proc/mounts | cut -d' ' -f2) >+ if [[ -z ${mount_point} ]]; then >+ ewarn "Failed to find mount point for ${target}, skipping" >+ cryptfs_status=1 >+ fi >+ >+ if [[ -n ${post_mount} ]]; then >+ ebegin "Running post_mount commands for target ${target}" >+ eval "${post_mount}" >/dev/null >+ eend $? || cryptfs_status=1 >+ fi >+} > > # vim:ts=4
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 43146
:
26492
|
26567
|
26568
|
26578
|
26953
|
27067
|
27268
|
36320
|
36321
|
36322
|
36323
|
36463
|
36464
|
37800
|
40036
|
40037
|
40114