onsdag 15 april 2015

Linux - Debian - Bash strip Build-Depends from apt-cache


.



http://pastebin.com/sEfas4sh



#/usr/bin/bash
#/usr/bin/sh
#
# Script: build-deps
# Author: hynten@speed-mailer.com
# Date: 2015-04-16 - 05   (ee = times edited)
#
# Purpose: run apt-cache showsrc and strip Depends
#
# Notes:
#
reset
echo "------------------------------------------"
echo "- BUILD-DEPENDS- hynten@speed-mailer.com -"
echo "-                                        -"
echo "- Strip Depends: from file session.log   -"
echo "-        source: apt-cache showrc        -"
echo "--2015------------------------------------"
echo "                                          "
 echo "Enter Package:"
        read package

  sudo apt-cache showsrc $package | grep ^Build-Depends > dep.log
 
 # NOW Strip The Shit of it! ..
  sed -i '/Script started/d' dep.log
  sed -i '/Script done/d' dep.log
  sed -i '/root@/d' dep.log
  sed -i  's/Build-Depends: //g' dep.log
  sed -i  's/Build-Depends-Indep: //g' dep.log
  sed -i  's/linux-any //g' dep.log
  sed -i  's/,//g' dep.log
  sed -e "s_: \"[a-zA-Z0-9]*\" _: _g" -i dep.log
  sed 's/linux-any/ /g' dep.log > dep2.log | mv dep2.log dep.log
 
echo "All Done!"  | sleep 1  | reset
echo "------------------------------------------"
echo "- BUILD-DEPENDS- hynten@speed-mailer.com -"
echo "-                                        -"
echo "- Strip Depends: from file session.log   -"
echo "-        source: apt-cache showrc        -"
echo "--2015------------------------------------"
echo "                                          "
cat dep.log
  #mv dep.log deps-$package.log
  #That's a good start to a nice script dont you think 
echo "                                           "

Inga kommentarer: