# HG changeset patch # User Francisco J Ballesteros # Date 1315936753 -7200 # Node ID c74bbbef28adc7fcae002d791111b15e221dc772 # Parent 8dbeb266b7f655b4af4471da75df2ce1a6c6081a pm: improvements to install mostly None of them use UTF runes that are not likely to exist in some fonts. Install accepts -v to report the files installed while it goes. Install pulls if that's not done, instead of asking the user to do so. Install relies on tar T option instead of going file by file adjusting modes/gids. R=nix-dev, john CC=nix-dev http://codereview.appspot.com/5000045 diff -r 8dbeb266b7f6 -r c74bbbef28ad rc/bin/pm/clean --- a/rc/bin/pm/clean Tue Sep 13 09:50:46 2011 -0700 +++ b/rc/bin/pm/clean Tue Sep 13 19:59:13 2011 +0200 @@ -28,7 +28,7 @@ } cd $PKGROOT^/contrib/packages/^$PKGNAME - echo '•••Cleaning for package '^$PKGNAME^'•••' + echo '###Cleaning for package '^$PKGNAME^'###' # we're leaving this for now #rm -r root.tgz if (test -e root) { diff -r 8dbeb266b7f6 -r c74bbbef28ad rc/bin/pm/install --- a/rc/bin/pm/install Tue Sep 13 09:50:46 2011 -0700 +++ b/rc/bin/pm/install Tue Sep 13 19:59:13 2011 +0200 @@ -14,6 +14,12 @@ PKGSERVER=jfloren.net } +verb='' +if(~ $1 -v){ + verb=-v + shift +} + if (~ $#* 0) { echo Need at least one package name exit 'invalid arg' @@ -25,7 +31,7 @@ for (PKGNAME in $*) { @{ - echo '•••Installing package '^$PKGNAME^'•••' + echo '###Installing package '^$PKGNAME^'###' # Go to the directory if it exists if (! test -e $PKGROOT^/contrib/packages/^$PKGNAME) { @@ -36,19 +42,19 @@ # You need to do mk pull before running mk install if (! test -e root.tgz) { - echo $PKGNAME^: You must pull first! - exit + echo $PKGNAME^: pulling + if(! pm/pull $PKGNAME){ + echo pull of $PKGNAME failed >[1=2] + exit pull + } } if (grep '^'^$PKGNAME^'$' $ROOT^/contrib/packages/installed >[2=1] >/dev/null) { echo $PKGNAME^: already installed} if not { # Install all the dependencies - echo $PKGNAME^: Also installing dependencies: - for (i in `{cat dep}) { - echo ' * '^$i - } for (i in `{cat dep}) { if (! grep $i $ROOT^/contrib/packages/installed >[2=1] >/dev/null) { @{ + echo $PKGNAME^: Also installing dependency: $i cd $PKGROOT^/contrib/packages/$i pm/pull $i pm/install $i @@ -59,26 +65,9 @@ } } echo $PKGNAME^: Unpacking the root archive... - tar xzf root.tgz - for (i in `{ls -p root}) { - mkdir -p $ROOT^/$i - echo $PKGNAME^: Copying files to $ROOT^/$i - dircp root/$i $ROOT^/$i - } - # set permissions - echo -n $PKGNAME^: Setting permissions - awk '{ - perm = $3 - if ($3 ~ /20000000/) { - sub(/20000000/, "", perm) - } else if ($3 ~ /10000000/) { - sub(/10000000/, "", perm) - } - print "echo -n .;" - print "chmod "perm,"'$ROOT^/^'"$1";" - print "chgrp "$5,"'$ROOT^/^'"$1";" - }' < db | rc - echo + tar xzTf root.tgz + @{builtin cd root && tar cif /fd/1 .} | @ {builtin cd $ROOT && tar x$verb^Tf /fd/0} + # inform the world that this package is now installed echo $PKGNAME >> $ROOT^/contrib/packages/installed sort $ROOT^/contrib/packages/installed > /tmp/installed-sorted diff -r 8dbeb266b7f6 -r c74bbbef28ad rc/bin/pm/remove --- a/rc/bin/pm/remove Tue Sep 13 09:50:46 2011 -0700 +++ b/rc/bin/pm/remove Tue Sep 13 19:59:13 2011 +0200 @@ -21,7 +21,7 @@ for (PKGNAME in $*) { @{ - echo '•••Removing package '^$PKGNAME^'•••' + echo '###Removing package '^$PKGNAME^'###' # Go to the directory if it exists if (! test -e $PKGROOT^/contrib/packages/^$PKGNAME) { @@ -38,8 +38,8 @@ cp /tmp/installed-removed $ROOT^/contrib/packages/installed # ignore directories, remove regular files first echo -n $PKGNAME^: Removing regular files. + echo may take a while. be patient. for (i in `{awk '!/ - 20000000/{print $1}' < db}) { - echo -n . #echo rm -f $ROOT^/^$i rm -f $ROOT^/^$i }