LinuxCzar

Engineering Software, Linux, and Observability. The website of Jack Neely.    

Found in an RPM .spec

Found in a %pre section of a binary RPM.  Things that are so bad….they get special recognition.

get_package_file()
{
  local tmp_dir=$1
  shift
  rpm_pid=`ps -p $$ -o ppid=`
  rpm_pid=`echo $rpm_pid`      ## trim leading/trailing blanks
  rpm_pathname=`ps -p $rpm_pid -o cmd= | \
                 sed -rn "s:^.+[ ]+([^ ]*EvilPackageName[^ ]+).*$:\1:p"`
  if [ "$rpm_pathname" ]
  then
      if [ -d /proc/$rpm_pid ]
          then
          test -d $tmp_dir || mkdir $tmp_dir
          if [ -d /proc/$rpm_pid/cwd ]
              then
              (cd $tmp_dir
                  (cd /proc/$rpm_pid/cwd; rpm2cpio $rpm_pathname) | \
                      cpio --quiet -id --no-absolute-filenames $1)
              return 0
          fi
      fi
  fi
  return 1
}

 Previous  Up  Next


comments powered by Disqus