You are not logged in.

#1 2008-11-26 16:54:32

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

What am I missing out on ??

I have used arch for a longish time, but I've never had the time to delve into all the weird and wonderful applications.
To me, arch is a tool and I use but a small fraction of what's out there.
Which is why I sometimes wonder if there truly are apps that I might find useful and I just have not been aware of them ...

At home I am restricted by a satellite broadband provider who limits me to 300 megs in 24 hours - eeek!
So - what I do is having my own repo mirror at work with nightly updates, then I carry those home on a portable usb-drive.

I have two scripts which will compare the repo with what's installed on my computer(s) and give me a listing of package name and description of what is available but not installed.
Others may find those two scripts handy, so I present them here - my own li'l way of paying back to the arch community.

archie_packages.sh (as you can see - I'm really only concerned about 'extra' - feel free to tailor to _your_ needs)

#!/bin/sh
say()    { echo -en "$*" >&2; }
die()    { say "$*\n"; cleanup; exit 1; }

# reformatter
home=`dirname $0`
reformatter=$home/archie_reformat.sh
test -f $reformatter || die "-- cannot find '$reformatter'"

# architecture
cpu=`uname -m`

# scratch-files & tidy-up
t1=/tmp/tf-1.$$
t2=/tmp/tf-2.$$
curd=`pwd`
cleanup() { rm -f $t1 $t2 >/dev/null 2>/dev/null; cd $curd; }
trap "{ cleanup; }" SIGHUP SIGINT SIGQUIT SIGTERM SIGKILL

# check what we are running here ...
test -f /etc/arch-release; then
    distro=archlinux
    repo=/usb/linux/$distro/packages/$cpu/extra
    ftype=".pkg.tar.gz"
else    die "-- you _must_ be running 'archlinux'!!"; fi
cd $repo || die "-- '$repo' - no such directory!"

# pick out all files from repo
if test $# -eq 0; then
    files="`ls *$ftype 2>/dev/null | sort`"
else
    files=""
    while test $# -gt 0; do
        files="$files `ls $1*$ftype 2>/dev/null`"
        shift
    done
    files="`echo $files | tr ' ' '\n' | sort | uniq`"
fi
test "~$files" = "~" && die "-- no files in repo!"


# make packages out of files ...
packages=""
for f in $files; do
    a=${f%$ftype}
    test "$a" = "$f" && continue
    b=${a%-$cpu}
    test "$b" = "$a" && {
        b=${a%-NOARCH}
        test "$b" = "$a" && continue
    }
    packages="$packages $b"
done
packages="`echo $packages | tr ' ' '\n' | sort | uniq`"

echo $packages | tr ' ' '\n' >$t2
pacman -Q | tr ' ' '-' >$t1
todo="`diff $t1 $t2 | grep '^> ' | sed -e 's/^> //'`"
test "~$todo" = "~" && die "-- no uninstalled packages"

files=""
for p in $todo; do
    f=$p-${cpu}${ftype}
    if test -f $f; then
        files="$files $f"
    else
        f=$p-NOARCH${ftype}
        test -f $f && files="$files $f"
    fi
done
test "~$files" = "~" && die "-- no files-from-packages"

pacman -Qip $files | sh $reformatter

Then the reformatter - archie_reformat.sh ....

#!/bin/sh
awk 'BEGIN { sot = 18 }{
    if ($0 == "") { flag = 0; next }
    if (substr($0,1,4) == "Name") {
        flag = 0
        printf "\n%s", substr($0,sot)
        next
    }
    if (substr($0,1,7) == "Version") {
        printf " %s\n", substr($0,sot)
        next
    }
    if (substr($0,1,11) == "Description") {
        flag = 1
        printf "#  %s\n", substr($0,sot)
        next
    }
    if (flag) {
        if ($0 == "" || substr($0,1,1) != " ") flag = 0
        else    printf "#  %s\n", substr($0,sot)
    }
}'

So there you are! They have served me well enough.
Obviously, these are only of use if you have your own repo mirror!

Offline

#2 2008-11-26 18:26:16

SiC
Member
From: Liverpool, England
Registered: 2008-01-10
Posts: 430

Re: What am I missing out on ??

Nice work smile

Offline

#3 2008-11-26 18:59:34

finferflu
Forum Fellow
From: Manchester, UK
Registered: 2007-06-21
Posts: 1,899
Website

Re: What am I missing out on ??

Nice! Moving to Community Contributions smile


Have you Syued today?
Free music for free people! | Earthlings

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery

Offline

Board footer

Powered by FluxBB