Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 179008 Details for
Bug 255528
sys-fs/cryptsetup: startup scripts are not POSIX compliant
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to make files/* in cryptsetup-1.0.6-r2 POSIX compliant
cryptsetup-1.0.6-r2-posix.patch (text/plain), 9.43 KB, created by
Martin Väth
on 2009-01-19 17:57:53 UTC
(
hide
)
Description:
Patch to make files/* in cryptsetup-1.0.6-r2 POSIX compliant
Filename:
MIME Type:
Creator:
Martin Väth
Created:
2009-01-19 17:57:53 UTC
Size:
9.43 KB
patch
obsolete
>--- 1.0.5-dm-crypt-stop.sh >+++ 1.0.5-dm-crypt-stop.sh >@@ -22,17 +22,17 @@ > eend $? "Failed to remove dm-crypt mapping for: ${target}" > done > >- if [[ -n $(/bin/egrep -e "^(source=)./dev/loop*" /etc/conf.d/dmcrypt) ]] ; then >+ if [ -n "$(/bin/egrep -e '^(source=)./dev/loop*' /etc/conf.d/dmcrypt)" ] ; then > einfo "Taking down any dm-crypt loop devices" > /bin/egrep -e "^(source)" /etc/conf.d/dmcrypt | while read sourceline > do > source= > eval ${sourceline} >- if [[ -n $(echo ${source} | grep /dev/loop) ]] ; then >+ case ${source} in */dev/loop*) > ebegin " Taking down ${source}" > /sbin/losetup -d ${source} > eend $? " Failed to remove loop" >- fi >+ ;; esac > done > fi > fi >--- 1.0.6-r2-dm-crypt-start.sh >+++ 1.0.6-r2-dm-crypt-start.sh >@@ -14,7 +14,7 @@ > dm_crypt_execute_dmcrypt() { > local dev ret mode foo > # some colors >- local red='\x1b[31;01m' green='\x1b[32;01m' off='\x1b[0;0m' >+ local red='\033[31;01m' green='\033[32;01m' off='\033[0;0m' > > if [ -n "$target" ]; then > # let user set options, otherwise leave empty >@@ -40,7 +40,7 @@ > return > fi > >- if [[ -n ${loop_file} ]] ; then >+ if [ -n "${loop_file}" ] ; then > dev="/dev/mapper/${target}" > ebegin " Setting up loop device ${source}" > /sbin/losetup ${source} ${loop_file} >@@ -63,12 +63,16 @@ > if [ -n "$key" ]; then > read_abort() { > local ans >- local prompt=" ${green}*${off} $1? (${red}yes${off}/${green}No${off}) " >- shift >- echo -n -e "${prompt}" >- if ! read -n 1 $* ans ; then >- local back=${prompt//?/\\b} >- echo -n -e "${back}" >+ local prompt=" ${green}*${off} %s? (${red}yes${off}/${green}No${off}) " >+ printf "${prompt}" "$1" >+ if ! read ans ; then >+ local prompttext=" * $1? (yes/No) $ans" >+ local back="" >+ while [ -n "$prompttext" ]; do >+ back="$back"'\b' >+ prompttext=${prompttext%?} >+ done >+ printf "${back}" > else > echo > fi >@@ -79,8 +83,8 @@ > } > > # Notes: sed not used to avoid case where /usr partition is encrypted. >- mode=${key/*:/} && ( [ "$mode" == "$key" ] || [ -z "$mode" ] ) && mode=reg >- key=${key/:*/} >+ mode=${key##*:} && ( [ "$mode" = "$key" ] || [ -z "$mode" ] ) && mode=reg >+ key=${key##*:} > case "$mode" in > gpg|reg) > # handle key on removable device >@@ -114,7 +118,7 @@ > && foo="mount failed" \ > || foo="mount source not found" > fi >- ((++i)) >+ i=$(( $i + 1 )) > read_abort "Stop waiting after $i attempts (${foo})" -t 1 && return > done > else # keyfile ! on removable device >@@ -136,17 +140,18 @@ > fi > ebegin "dm-crypt map ${target}" > einfo "cryptsetup will be called with : ${options} ${arg1} ${arg2} ${arg3}" >- if [ "$mode" == "gpg" ]; then >+ if [ "$mode" = "gpg" ]; then > : ${gpg_options:='-q -d'} > # gpg available ? > if type -p gpg >/dev/null ; then >- for (( i = 0 ; i < 3 ; i++ )) >+ i=0; while [ $i -lt 3 ] > do > # paranoid, don't store key in a variable, pipe it so it stays very little in ram unprotected. > # save stdin stdout stderr "values" > gpg ${gpg_options} ${key} 2>/dev/null | cryptsetup ${options} ${arg1} ${arg2} ${arg3} > ret="$?" > [ "$ret" -eq 0 ] && break >+ i=$(( $i + 1 )) > done > eend "${ret}" "failure running cryptsetup" > else >@@ -156,7 +161,7 @@ > einfo "If you have /usr on its own partition, try copying gpg to /bin ." > fi > else >- if [ "$mode" == "reg" ]; then >+ if [ "$mode" = "reg" ]; then > cryptsetup ${options} -d ${key} ${arg1} ${arg2} ${arg3} > ret="$?" > eend "${ret}" "failure running cryptsetup" >@@ -172,10 +177,10 @@ > fi > splash svc_input_end ${SVCNAME} >/dev/null 2>&1 > >- if [[ ${ret} != 0 ]] ; then >+ if [ ${ret} -ne 0 ] ; then > cryptfs_status=1 > else >- if [[ -n ${pre_mount} ]] ; then >+ if [ -n "${pre_mount}" ] ; then > dev="/dev/mapper/${target}" > ebegin " Running pre_mount commands for ${target}" > eval "${pre_mount}" > /dev/null >@@ -199,12 +204,12 @@ > fi > > mount_point=$(grep "/dev/mapper/${target}" /proc/mounts | cut -d' ' -f2) >- if [[ -z ${mount_point} ]] ; then >+ if [ -z "${mount_point}" ] ; then > ewarn "Failed to find mount point for ${target}, skipping" > cryptfs_status=1 > fi > >- if [[ -n ${post_mount} ]] ; then >+ if [ -n "${post_mount}" ] ; then > ebegin "Running post_mount commands for target ${target}" > eval "${post_mount}" >/dev/null > eend $? || cryptfs_status=1 >@@ -218,16 +223,19 @@ > echo "usage: strlen <variable_name>" > die > fi >- eval echo "\${#${1}}" >+ local s c >+ eval "s=\$$1" >+ c=0; while [ -n "$s" ]; do c=$(( $c + 1 )); s=${s%?}; done >+ echo $c > } > > # Lookup optional bootparams > parse_opt() { > case "$1" in > *\=*) >- local key_name="`echo "$1" | cut -f1 -d=`" >+ local key_name=${1%%=*} > local key_len=`strlen key_name` >- local value_start=$((key_len+2)) >+ local value_start=$(( $key_len + 2 )) > echo "$1" | cut -c ${value_start}- > ;; > esac >@@ -249,7 +257,7 @@ > esac > done > >-if [[ -f /etc/conf.d/dmcrypt ]] && [[ -x /sbin/cryptsetup ]] ; then >+if [ -f /etc/conf.d/dmcrypt ] && [ -x /sbin/cryptsetup ] ; then > ebegin "Setting up dm-crypt mappings" > > # Fix for baselayout-1.12.10 (bug 174256) >@@ -257,7 +265,7 @@ > > while read targetline ; do > # skip comments and blank lines >- [[ ${targetline}\# == \#* ]] && continue >+ case ${targetline} in ''|'#'*) continue;; esac > > # check for the start of a new target/swap > case ${targetline} in >@@ -270,7 +278,7 @@ > ;; > > gpg_options=*|remdev=*|key=*|loop_file=*|options=*|pre_mount=*|post_mount=*|source=*) >- if [[ -z ${target} && -z ${swap} ]] ; then >+ if [ -z "${target}" ] && [ -z "${swap}" ] ; then > ewarn "Ignoring setting outside target/swap section: ${targetline}" > continue > fi >--- dm-crypt-start.sh >+++ dm-crypt-start.sh >@@ -9,17 +9,17 @@ > dm-crypt-execute-checkfs() { > local dev target ret > >- if [[ -n ${loop_file} ]] ; then >+ if [ -n "${loop_file}" ] ; then > dev="/dev/mapper/${target}" > ebegin " Setting up loop device ${source}" > /sbin/losetup ${source} ${loop_file} > fi > >- if [[ -n ${mount} ]] ; then >+ if [ -n "${mount}" ] ; then > target=${mount} > : ${options:='-c aes -h sha1'} >- [[ -n ${key} ]] && : ${gpg_options:='-q -d'} >- elif [[ -n ${swap} ]] ; then >+ [ -n "${key}" ] && : ${gpg_options:='-q -d'} >+ elif [ -n "${swap}" ] ; then > target=${swap} > : ${options:='-c aes -h sha1 -d /dev/urandom'} > : ${pre_mount:='mkswap ${dev}'} >@@ -34,16 +34,16 @@ > > splash svc_input_begin checkfs > ebegin "dm-crypt map ${target}" >- if [[ -z ${key} ]] ; then >+ if [ -z "${key}" ] ; then > /bin/cryptsetup ${options} create ${target} ${source} >/dev/console </dev/console > ret=$? > eend ${ret} "failure running cryptsetup" > else >- if type -p gpg >/dev/null ; then >+ if command -v gpg >/dev/null 2>&1; then > ret=1 >- while [[ ${ret} -gt 0 ]] ; do >+ while [ ${ret} -gt 0 ] ; do > keystring=$(gpg ${gpg_options} ${key} 2>/dev/null </dev/console) >- if [[ -z ${keystring} ]] ; then >+ if [ -z "${keystring}" ] ; then > ret=5 > else > echo ${keystring} | /bin/cryptsetup ${options} create ${target} ${source} >@@ -57,10 +57,10 @@ > fi > splash svc_input_end checkfs > >- if [[ ${ret} != 0 ]] ; then >+ if [ ${ret} -ne 0 ] ; then > cryptfs_status=1 > else >- if [[ -n ${pre_mount} ]] ; then >+ if [ -n "${pre_mount}" ] ; then > dev="/dev/mapper/${target}" > ebegin " Running pre_mount commands for ${target}" > eval "${pre_mount}" > /dev/null >@@ -75,7 +75,7 @@ > dm-crypt-execute-localmount() { > local mount_point target > >- if [[ -n ${mount} && -n ${post_mount} ]] ; then >+ if [ -n "${mount}" ] && [ -n "${post_mount}" ] ; then > target=${mount} > else > return >@@ -88,12 +88,12 @@ > fi > > mount_point=$(grep "/dev/mapper/${target}" /proc/mounts | cut -d' ' -f2) >- if [[ -z ${mount_point} ]] ; then >+ if [ -z "${mount_point}" ] ; then > ewarn "Failed to find mount point for ${target}, skipping" > cryptfs_status=1 > fi > >- if [[ -n ${post_mount} ]] ; then >+ if [ -n "${post_mount}" ] ; then > ebegin "Running post_mount commands for target ${target}" > eval "${post_mount}" >/dev/null > eend $? || cryptfs_status=1 >@@ -103,12 +103,12 @@ > local cryptfs_status=0 > local gpg_options key loop_file mount mountline options pre_mount post_mount source swap > >-if [[ -f /etc/conf.d/cryptfs ]] && [[ -x /bin/cryptsetup ]] ; then >+if [ -f /etc/conf.d/cryptfs ] && [ -x /bin/cryptsetup ] ; then > ebegin "Setting up dm-crypt mappings" > > while read mountline ; do > # skip comments and blank lines >- [[ ${mountline}\# == \#* ]] && continue >+ case ${mountline} in ''|'#'*) continue;; esac > > # check for the start of a new mount/swap > case ${mountline} in >@@ -121,7 +121,7 @@ > ;; > > gpg_options=*|key=*|loop_file=*|options=*|pre_mount=*|post_mount=*|source=*) >- if [[ -z ${mount} && -z ${swap} ]] ; then >+ if [ -z "${mount}" ] && [ -z "${swap}" ] ; then > ewarn "Ignoring setting outside mount/swap section: ${mountline}" > continue > fi >--- dm-crypt-stop.sh >+++ dm-crypt-stop.sh >@@ -32,17 +32,17 @@ > eend $? "Failed to remove dm-crypt mapping for: ${target}" > done > >- if [[ -n $(/bin/egrep -e "^(source=)./dev/loop*" /etc/conf.d/cryptfs) ]] ; then >+ if [ -n "$(/bin/egrep -e '^(source=)./dev/loop*' /etc/conf.d/cryptfs)" ] ; then > einfo "Taking down any dm-crypt loop devices" > /bin/egrep -e "^(source)" /etc/conf.d/cryptfs | while read sourceline > do > source= > eval ${sourceline} >- if [[ -n $(echo ${source} | grep /dev/loop) ]] ; then >+ case ${source} in */dev/loop*) > ebegin " Taking down ${source}" > /sbin/losetup -d ${source} > eend $? " Failed to remove loop" >- fi >+ ;; esac > done > fi > fi
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 255528
:
179008
|
179385
|
181693
|
204660
|
259555
|
259747
|
298255