* extfs/rpm: Modified workaround for spaces and single quotes in the path name.

This commit is contained in:
Andrew V. Samoilov 2004-08-22 22:38:49 +00:00
parent 8a410cf065
commit dbedd885e6
2 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2004-08-21 Pavel S. Shirshov <pavelsh@mail.ru>
* extfs/rpm: Modified workaround for spaces and single quotes
in the path name.
Based on patch from Jakub Jelinek <jakub@redhat.com>
2004-08-21 Pavel S. Shirshov <pavelsh@mail.ru> 2004-08-21 Pavel S. Shirshov <pavelsh@mail.ru>
* extfs/rpm: Don't show cpio contents in main rpm view. * extfs/rpm: Don't show cpio contents in main rpm view.

View File

@ -1,7 +1,7 @@
#! /bin/sh #! /bin/sh
# #
# Written by Erik Troan (ewt@redhat.com) 1996 # Written by Erik Troan (ewt@redhat.com) 1996
# Jakub Jelinek (jj@sunsite.mff.cuni.cz) 1996 # Jakub Jelinek (jj@sunsite.mff.cuni.cz) 1996,2004
# Tomasz K³oczko (kloczek@rudy.mif.pg.gda.pl) 1997 # Tomasz K³oczko (kloczek@rudy.mif.pg.gda.pl) 1997
# minor changes by Wojtek Pilorz (wpilorz@bdk.lublin.pl) 1997 # minor changes by Wojtek Pilorz (wpilorz@bdk.lublin.pl) 1997
# minor changes by Michele Marziani (marziani@fe.infn.it) 1997 # minor changes by Michele Marziani (marziani@fe.infn.it) 1997
@ -25,6 +25,10 @@ else
RPM="rpm" RPM="rpm"
fi fi
RPM2CPIO="rpm2cpio" RPM2CPIO="rpm2cpio"
SED="sed"
# Surround the whole filename with single quotes and handle specially
# \', ' and \ at the end of the string.
SEDCMD="s/\\(\\\\\\?\\)'/'\\1\\1\\\\''/g;s/\\\\\$/'\\\\\\\\'/;s/^/'/;s/\$/'/"
mcrpmfs_list () mcrpmfs_list ()
{ {
@ -34,7 +38,7 @@ mcrpmfs_list ()
if test -z "$MCFASTRPM"; then if test -z "$MCFASTRPM"; then
MCFASTRPM=$MCFASTRPM_DFLT MCFASTRPM=$MCFASTRPM_DFLT
fi fi
f="\"$1\"" f="`echo "$1" | $SED "$SEDCMD"`"
FILEPREF="-r--r--r-- 1 root root " FILEPREF="-r--r--r-- 1 root root "
DESC=`$RPM -qip "$f" 2>/dev/null` || { DESC=`$RPM -qip "$f" 2>/dev/null` || {
echo "$FILEPREF 0 "`date +"%b %d %H:%M"`" ERROR" echo "$FILEPREF 0 "`date +"%b %d %H:%M"`" ERROR"
@ -171,9 +175,10 @@ mcrpmfs_copyout ()
mcrpmfs_run () mcrpmfs_run ()
{ {
f="`echo "$1" | $SED "$SEDCMD"`"
case "$2" in case "$2" in
INSTALL) echo "Installing \"\"$1\"\""; $RPM -ivh "$1"; exit 0;; INSTALL) echo "Installing \"\"$f\"\""; $RPM -ivh "$1"; exit 0;;
UPGRADE) echo "Upgrading \"\"$1\"\""; $RPM -Uvh "$1"; exit 0;; UPGRADE) echo "Upgrading \"\"$f\"\""; $RPM -Uvh "$1"; exit 0;;
esac esac
} }