* postinstall: Add function print_flags and call where appropriate.

Omit system and cygdrive flag when testing cygdrive flags.
This commit is contained in:
Corinna Vinschen 2008-04-07 16:37:20 +00:00
parent f7852548bb
commit f471ca85e1
2 changed files with 19 additions and 12 deletions

View File

@ -1,3 +1,8 @@
2008-04-07 Corinna Vinschen <corinna@vinschen.de>
* postinstall: Add function print_flags and call where appropriate.
Omit system and cygdrive flag when testing cygdrive flags.
2008-04-07 Christopher Faylor <me+cygwin@cgf.cx> 2008-04-07 Christopher Faylor <me+cygwin@cgf.cx>
Add miscfuncs.h to files as needed throughout. Add miscfuncs.h to files as needed throughout.

View File

@ -12,6 +12,15 @@ export PATH="/bin:$PATH"
DEVDIR=/dev DEVDIR=/dev
print_flags ()
{
(( $1 & 0x0002 )) && echo -n "binary" || echo -n "text"
(( $1 & 0x0010 )) && echo -n ",exec"
(( $1 & 0x0040 )) && echo -n ",cygexec"
(( $1 & 0x0100 )) && echo -n ",notexec"
(( $1 & 0x0800 )) && echo -n ",managed"
}
# Create fstab file if it doesn't exist. # Create fstab file if it doesn't exist.
if [ -e "/etc/fstab" -a ! -f "/etc/fstab" ] if [ -e "/etc/fstab" -a ! -f "/etc/fstab" ]
then then
@ -130,11 +139,7 @@ EOF
psx="${subkey// /\\040}" psx="${subkey// /\\040}"
flags=$(regtool -q get "$key\\$subkey\flags") flags=$(regtool -q get "$key\\$subkey\flags")
echo -n "${nat} ${psx} some_fs " echo -n "${nat} ${psx} some_fs "
(( $flags & 0x0002 )) && echo -n "binary" || echo -n "text" print_flags $flags
(( $flags & 0x0010 )) && echo -n ",exec"
(( $flags & 0x0040 )) && echo -n ",cygexec"
(( $flags & 0x0100 )) && echo -n ",notexec"
(( $flags & 0x0800 )) && echo -n ",managed"
echo " 0 0" echo " 0 0"
fi >> /etc/fstab fi >> /etc/fstab
done done
@ -145,17 +150,14 @@ EOF
cygd="" cygd=""
prefix=$(regtool -q get "$key\cygdrive prefix") prefix=$(regtool -q get "$key\cygdrive prefix")
flags=$(regtool -q get "$key\cygdrive flags") # Don't take system and cygdrive flags into account when testing
if [ -n "$prefix" -a \( "$prefix" != "/cygdrive" -o "$flags" -ne 42 \) ] if [ -n "$prefix" \
-a \( "$prefix" != "/cygdrive" \ -o "$(( $flags & ~0x28 ))" -ne 2 \) ]
then then
cygd="1" cygd="1"
psx="${prefix// /\\040}" psx="${prefix// /\\040}"
echo -n "none ${psx} cygdrive " echo -n "none ${psx} cygdrive "
(( $flags & 0x0002 )) && echo -n "binary" || echo -n "text" print_flags $flags
(( $flags & 0x0010 )) && echo -n ",exec"
(( $flags & 0x0040 )) && echo -n ",cygexec"
(( $flags & 0x0100 )) && echo -n ",notexec"
(( $flags & 0x0800 )) && echo -n ",managed"
echo ",user 0 0" echo ",user 0 0"
fi >> /etc/fstab fi >> /etc/fstab