diff options
author | krebs <krebs@fuerkrebs> | 2011-10-13 13:20:02 -0400 |
---|---|---|
committer | krebs <krebs@fuerkrebs> | 2011-10-13 13:20:02 -0400 |
commit | 6caf0d1c502ba9eb6d41aa9a80cb8a350164846d (patch) | |
tree | 28237066c93656fe75b2fcc7fb1eec0a2b800888 /punani/bin | |
parent | fa7213811c2c77b9f2097c11c8a072265d8a3ac2 (diff) | |
parent | 1cff2a9d548336ddcd8a2d732ed2cd348c8e6b79 (diff) |
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'punani/bin')
-rwxr-xr-x | punani/bin/punani | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/punani/bin/punani b/punani/bin/punani index 954eca43..058331f1 100755 --- a/punani/bin/punani +++ b/punani/bin/punani @@ -29,6 +29,7 @@ guess_system() fi } + arch_aur_helper() { # pacman is the last fallback helper @@ -43,6 +44,7 @@ arch_aur_helper() echo "!! no helper found, this should never happen(tm)." return 1 } + handle_system () { case "$system" in (*arch-like*) @@ -57,7 +59,7 @@ handle_system () { # get dependencies : # we need pkgfile if ! [ `which pkgfile` ] ; then - pacman -S --noconfirm pkgtools + pacman -S --needed --noconfirm pkgtools pkgfile -u fi punani_Scientist_update() { @@ -65,7 +67,7 @@ handle_system () { pkgtool -u } punani_Scientist_search() { - pkgfile $1 + pkgfile -s -b $1 if [ "${hard-}" ] ; then mgr=`arch_aur_helper` $mgr -Ss $1 @@ -79,9 +81,17 @@ handle_system () { # # when trying harder it tries to load the package with the given name directly via yaourt echo "** trying to find package with given file" - if pacman -S `pkgfile $1` ; then - echo "++ finished" - exit 0 + pkgs=$(pkgfile -s -b -r $1 | tr "\n" "|" ) + if [ "$pkgs" ];then + echo "** found one or more packages matching, skip the ones you do not need!" + OLDIFS=$IFS + IFS='|' + for to_install in $pkgs;do + if pacman -S --needed "$to_install"; then + echo "++ finished" + fi + done + IFS=$OLDIFS else echo "!! nothing found in base repos" if [ "${hard-}" ] ; then @@ -116,9 +126,9 @@ handle_system () { # apt-get () { echo $@; } #fi if ! which apt-file; then - echo "installing dependencies: apt-file" + echo "** installing dependencies: apt-file" apt-get install --yes apt-file - echo "update the apt-file tool" + echo "** update the apt-file tool" apt-file update fi punani_Scientist_update() { @@ -127,15 +137,24 @@ handle_system () { } punani_Scientist_search() { - apt-file search -l -x /$1\$ && exit 0 + apt-file search -l -x $1\$ && exit 0 if [ "${hard-}" ] ; then apt-cache search $1 fi } punani_Engineer_insert() { echo "trying to install $1" - if apt-get install `apt-file search -l -x /$1\$`;then - echo "++ finished" + pkgs=$(apt-file search -l -x $1\$ | tr "\n" "|" ) + if [ "$pkgs" ];then + echo "** found one or more packages matching, skip the ones you do not need!" + OLDIFS=$IFS + IFS='|' + for to_install in $pkgs;do + if apt-get install $to_install;then + echo "++ finished" + fi + done + IFS=$OLDIFS else if [ "${hard-}" ] ; then echo "** trying harder" |