[GIVEAWAY] pacman-wrapper shell functions

Hi all,
under http://pastebin.com/vikWUQiK you can find a set of pacman command wrappers that I have found out to be usefull to me.
I want to share and give other users the opportunity to benefit from it aswell as receiving some critics, ideas, comments and suggestions for improvement.
Brief description:
- upgrade only packages wanted by YOU with pacman-upgrade-explicit, else pacman-upgrade-all for system-wide upgrade (deps aswell)
- all atomic actions log the installed packages, before and after the action (good for debugging, sometimes pkg-names change, etc.)
- support for multithreaded and concurrent distfiles retrieval (requires aria2c to be installed, else wget is used by default)
These are things that I (almost always) want to do when using pacman and upgrading packages, so I decided to work with these wrapper functions whenever applicable instead with the (real/backend) pacman.
This is pretty much it for the beginning.
Enjoy & Bye,
Archytect.
UPDATE 1:
    date: Wed, Oct 12, 2011 11:42:33 AM CEST
    url: http://pastebin.com/A2tQaJgF
    changes/notes:
added *-preview functions for installs and upgrades
fixed pacman-fetch not being executed in xargs, because it is a function
Last edited by Archytect (2011-10-12 09:45:15)

keenerd wrote:This is fast. And fails even faster if you don't have sudo set up.  The one nice thing about yaourt is that if will check if you can sudo pacman, otherwise it asks for your root password.  I like this behavior.
I don't understand what you mean. I can run packer as non-root, and when it needs root access it asks me for my password. As far as I can tell, this is the same thing that yaourt does. Are you expecting it to do something else?
Mikko777 wrote:
1: yaourt -Syu --aur --devel --noconfirm    (--devel is nice)
2: on first install edit/ show pkgbuild
3: yaourt -C  <-- list and edit .pacnew files
4: vote for packages
Those are all great ideas. I will add my opinion as another packer user.
1. I've never used the "--devel" option. Does that mean, it will look for AUR packages that you installed that got the files out of a CVS repository, and download and install the super duper just-updated-at-two-in-the-morning version of it? If that's what it does, then I can imagine that being a nice feature, but it can also be done by doing "packer -S", right? As for "--noconfirm", packer seems pretty unobtrusive to me right now, so I don't really miss that option.
2. I'm confused. Packer asks me if I want to see the PKGBUILD when I install a package from the AUR. You mean, show the PKGBUILD instead of asking? Or, only show PKGBUILD on the first install?
3. I personally prefer to do "sudo updatedb && locate pacnew".
4. I never liked the "vote" feature on yaourt. I think it's confusing. If I just finished installing a package from the AUR, how do I know if I want to vote for it if I haven't used it yet? I prefer to use the program for a while, then use "aurvote".

Similar Messages

  • Terminate shell function with ctrl-c

    Hi everyone,
    I'm having a problem with exiting a shell function. Maybe you can help.
    What i want is the function to exit when i hit Ctrl-C.
    Right now, if i press ^c it terminates only the current command and jumps to the next one.
    I thought this would work but it doesn't:
    trap '{ echo "Hey, you pressed Ctrl-C. Time to quit." ; exit 1; }' INT
    respectively
    trap 'exit' INT
    The whole function:
    setup () {
    echo -n "intial-setup: user1 or user2? "
    read answer
    case "$answer" in
    user1|u1|"") echo "Proceeding with setup for user1"
    echo "Creating user demian, directories and password"
    useradd -m -G many,groups -s /bin/bash user1 ; passwd user1 ; mkdir /a/few/user1/ /specific/folders
    echo "Downloading and installing packages"
    pacman -Syy many programs ; yaourt -Sy --aur a few more programs
    user2|u2|"") echo "Proceeding with setup for user2"
    echo "Creating user user2, directories and password"
    useradd -m -G many,groups -s /bin/bash user2 ; passwd user2 ; mkdir /a/few/user2/ /specific/folders
    echo "Downloading and installing packages"
    pacman -Syy many different programs ; yaourt -Sy --aur a few more programs
    *) echo "Unknown parameter. Exiting."
    esac
    Any ideas?
    Greets,
    demian
    Last edited by demian (2010-04-15 13:51:24)

    Thanks. If I've placed the EOT right in the following example it doesn't work though - meaning it doesn't exit the script.
    esac
    EOT
    Regards,
    demian
    Last edited by demian (2010-04-16 09:03:13)

  • Packer - New bash aur+pacman wrapper (replaces poorly written yaourt)

    There are some people who wish to keep aur and pacman separate. For those people there is aurget and slurpy.
    There are others who wish to integrate them  for certain tasks like myself. For those people there really is only yaourt which is excruciatingly slow and in many ways bloated. For instance, why would you need to use yaourt -R package ever? All that happens when you do that is it calls pacman. What a joke.
    I contend that an aur+pacman wrapper only need to perform 4 major functions.
    1) Search pacman and aur at the same time with one query (-Ss)
    2) Get info from packages in the repository (-Si)
    3) Install packages from either (especially be able to handle the dependencies of aur packages which can sometimes have other dependencies on aur which themselves might have dependencies on aur, etc.) (-S)
    4) Update packages at the same time (again with an interest of handling aur packages which might have new dependencies in newer versions and such) (-Su)
    If you agree with this or just are curious and want to test my program, please download the script from my github and leave feedback. This is a pretty early release (just began working on it 3 days ago), but all four of those functionalities are implemented. There will be cosmetic changes for sure to come and please comment on what you think those should be or any other bugs or problems you might have had.
    github link
    aur link
    packer wiki
    EDIT:
    I have forked pacdiffviewer from yaourt and modified it to work as a stand alone program due to many people saying they coud not switch from yaourt because it has pacdiffviewer. To avoid path conflicts, I have named it pacdiff.
    github link
    aur link
    forum post about pacdiff
    EDIT: Title edited due to gratuitous number of complaints.
    Last edited by bruenig (2010-04-22 02:04:13)

    keenerd wrote:This is fast. And fails even faster if you don't have sudo set up.  The one nice thing about yaourt is that if will check if you can sudo pacman, otherwise it asks for your root password.  I like this behavior.
    I don't understand what you mean. I can run packer as non-root, and when it needs root access it asks me for my password. As far as I can tell, this is the same thing that yaourt does. Are you expecting it to do something else?
    Mikko777 wrote:
    1: yaourt -Syu --aur --devel --noconfirm    (--devel is nice)
    2: on first install edit/ show pkgbuild
    3: yaourt -C  <-- list and edit .pacnew files
    4: vote for packages
    Those are all great ideas. I will add my opinion as another packer user.
    1. I've never used the "--devel" option. Does that mean, it will look for AUR packages that you installed that got the files out of a CVS repository, and download and install the super duper just-updated-at-two-in-the-morning version of it? If that's what it does, then I can imagine that being a nice feature, but it can also be done by doing "packer -S", right? As for "--noconfirm", packer seems pretty unobtrusive to me right now, so I don't really miss that option.
    2. I'm confused. Packer asks me if I want to see the PKGBUILD when I install a package from the AUR. You mean, show the PKGBUILD instead of asking? Or, only show PKGBUILD on the first install?
    3. I personally prefer to do "sudo updatedb && locate pacnew".
    4. I never liked the "vote" feature on yaourt. I think it's confusing. If I just finished installing a package from the AUR, how do I know if I want to vote for it if I haven't used it yet? I prefer to use the program for a while, then use "aurvote".

  • JPublisher generated wrapper package function name contains "ORIG_PKG"$FN

    jPublisher generated wrapper package function name contains "ORIG_PKG"$FN
    which shows compilation error as
    Compilation errors for PACKAGE BODY <schema>.JPUB_PLSQL_WRAPPER
    Error: PLS-00181: unsupported preprocessor directive '$FN'
    Line: 2699
    Text: FUNCTION "ORIG_PKG"$FN (P_SOURCE VARCHAR2,
    Along with this, the generated .sqlj file have a calling sqlj content having the same format as
    #sql [getConnectionContext()] __jPt_result = { VALUES(JPUB_PLSQL_WRAPPER."ORIG_PKG"$FN( ...
    This also show sqlj compilation error such as
    Error(91,5): Expected "$FN" and found ")" instead.
    and a warning
    Warning(91,5): Invalid SQL syntax at:
    JPUB_PLSQL_WRAPPER."ORIG_PKG"$FN(
    ^^^^
    Encountered "$FN" :
    Was expecting one of:
    <EOF>
    "AND" ...
    "BETWEEN" ...
    "IN" ...
    "IS" ...
    "LIKE" ...
    "NOT" ...
    "OR" ...
    "ROW" ...
    "AT" ...
    "MOD" ...
    "RANGE" ...
    <CONCAT_OP_> ...
    Any suggestion would be helpful. thank you.

    Just to put a proper closure to this thread, there were 2 issues with the Jdev version I was using (11.1.2.0.0)
    1) Wrapper for PL/SQL not getting generated properly.
    2) Webservice proxies are not getting generated properly.
    The 2 issues were taken care by generating the wrapper and proxy on a much higher version of Jdev.

  • How di I enter a sub-shell in a shell-function

    Hi Community,
    I'm searching for a quick and dirty solution to determine the folder size in a specific location. I tried to do this job in a for-loop but I ran into trouble with folders containing a space in it's name. So I changed the environment variable IFS (Internal Field Separator) to a new-line only instead the default whitespace. But after this I have to leave the shell to get rid of the user-defined IFS variable. Yes I could write the IFS variable in another (auxiliary) variable first to set it back to the default value after running the for-loop but this isn't a quick and dirty solution just for a short look to the folder size in a one line command.
    So the one liner looks like:
    IFS=$'\n' && for i in `ls`; do du -hs "$i"; done
    With the result that the IFS variable changed for this session to a single new line. So I tried to define a shell-function who switch to a sub-shell, set temporary the IFS variable, run the for-loop and exit the sub-shell:
    $ foldersize()
    > {
    > /bin/bash
    > IFS=$'\n'
    > for i in `ls`; do
    > du -hs $i;
    > done
    > exit
    > }
    But running the function it only switch to the sub-shell and nothing more happens:
    $ foldersize
    bash-3.2$
    So my question is how can I switch in a sub-shell using in a shell function?
    Thx & Bye Tom

    What is wrong with
    du -hs *
    if you want to call it 'foldersize' you can create an alias
    alias foldersize='du -hs *'
    If you really want to do your loop, you could try something like
    foldersize()
        ls -1 "$@" | while read file
        do
            du -hs "$file"
        done
    The 'while' loop is running in a sub-shell, so any shell variable changes made in the sub-shell will not be visible when you finish.  For that you could use the following notation:
    foldersize()
        while read file
        do
            do -hs "$file"
        done <  <(ls -1 "$@")
    Which will run the 'ls' in a sub-process and the 'while' loop will be run in the current shell invocation, and thus any shell variable changes made in the 'while' loop will be available when the loop finishes.
    If you just want to do it your way, and do not need any shell variable changes returned to the invoking shell you could use:
    foldersize()
        ( IFS=$'\n'
          for i in `ls "$@"`; do
            du -hs $i;
          done
    Where everything inside the (...) will be run in a sub-shell, and all variable changes will not show up in the invoking shell.
    Then again, you could have just put 'foldersize' in its own script file, made the file executable, and placed the script in $HOME/bin, then added $HOME/bin to your PATH environment variable, and when the script is invoked, it too will run in its own sub-shell.  Simple
    #!/usr/bin/env bash
    IFS=$'\n'
    for i in `ls "$@"`; do
        du -hs $i;
    done
    The "$@" syntax says if there are any function arguments substute them here and preserve any white space.  The syntax includes the "..." as well as the $@.  All 4 characters need to be specified as "$@" to get the white space preserving effect.  And if there are no function arguments, then it is as if the 'ls' command was specified without additional arguments, as you have used it.  This gives you the ability to get the folder size of the current directory as well as specify any directory you choose.
    NOTE:  All of the above should work as shown, most without the need for IFS
    Message was edited by: BobHarris

  • SaveSyu - a pacman wrapper to savely upgrade your system

    This wrapper will evaluate the "upgrade level" of every packages that could be upgraded.
    The "upgrade level" is defined as follows:
    Assuming version number looks like x.y.z-p. And we consider that:
    x is a major version number, y is a normal version number, and z is a minor version number, and p is a packaging version number.
    If a version number looks like 1-2, we consider 1 is the major.
    And if it looks like 1.2-3, we consider 1 is the major, and 2 is the normal.
    And if it looks like 1.2.3.4-5, we consider 1 is the major, 2.3 is the normal, and 4 is the minor.
    And,
    level 19: packaging change
                 x1=x2 y1=y2 z1=z2, only p1 != p2
    level 25: minor upgrade
                 x1=x2 y1=y2, z1 != z2, but 1 week old
    level 29: minor upgrade
                 x1=x2 y1=y2, z1 != z2
    level 35: normal upgrade
                 x1=x2, y1!=y2, but 2 weeks old
    level 39: normal upgrade
                 x1=x2, y1!=y2
    level 45: major upgrade
                 x1!=x2, but 4 weeks old
    level 49: major upgrade, x1!=x2
    While invoking, you should specify a threshold that you think is save to upgrade, and the wrapper - saveSyu, will invoke pacman to upgrade only those packages under the threshold.
    Here comes...
    #!/bin/bash
    # save upgrade
    # we can create some upgrade policy, for example:
    # the package is one month old, or
    # the package is a "packaging upgrade" (which means "the same
    # software version", different "packaging version"), or
    # the package is a "minor upgrade", x.y.z -> x.y.?
    # the package is not in core (nor extra)
    # function(s)
    # assume version number looks like x.y.z-p
    # others include:
    # x.y.y.z-p
    # x.y-p
    # y-p
    # level 19: packaging change, x1=x2 y1=y2 z1=z2, only p1 != p2
    # level 25: minor upgrade, x1=x2 y1=y2, z1 != z2, but 1 week old
    # level 29: minor upgrade, x1=x2 y1=y2, z1 != z2
    # level 35: normal upgrade, x1=x2, y1!=y2, but 2 weeks old
    # level 39: normal upgrade, x1=x2, y1!=y2
    # level 45: major upgrade, x1!=x2, but 4 weeks old
    # level 49: major upgrade, x1!=x2
    # other criteria including:
    # which repository (not in core, in community, etc.)
    # minor upgrade, but packaging number is not 1 (which means it has been (bug) fixed)
    evaluate_upgrade_level() {
    # init
    ONE_WEEK=$((1 * 7 * 24 * 60 * 60))
    TWO_WEEKS=$((2 * $ONE_WEEK))
    FOUR_WEEKS=$((4 * $ONE_WEEK))
    old_ver=$1
    new_ver=$2
    repo=$3
    date=$(date -d "$4" +%s)
    now=$(date +%s)
    # parse
    old_tmp=${old_ver%-*}
    old_pkg=${old_ver#$old_tmp-}
    old_major=${old_tmp%%.*}
    old_minor=${old_tmp##*.}
    old_normal=${old_tmp#$old_major.}
    old_normal=${old_normal%.$old_minor}
    echo old_ver=$old_ver major=$old_major normal=$old_normal minor=$old_minor pkg=$old_pkg
    new_tmp=${new_ver%-*}
    new_pkg=${new_ver#$new_tmp-}
    new_major=${new_tmp%%.*}
    new_minor=${new_tmp##*.}
    new_normal=${new_tmp#$new_major.}
    new_normal=${new_normal%.$new_minor}
    echo new_ver=$new_ver major=$new_major normal=$new_normal minor=$new_minor pkg=$new_pkg
    age=$(($now - $date))
    echo date=$date now=$now age=$age
    if [ "$old_major" = "$new_major" -a "$old_normal" = "$new_normal" -a "$old_minor" = "$new_minor" ] ; then
    level=19
    elif [ "$old_major" = "$new_major" -a "$old_normal" = "$new_normal" ] ; then
    if [ $age -gt $ONE_WEEK ] ; then
    level=25
    else
    level=29
    fi
    elif [ "$old_major" = "$new_major" ] ; then
    if [ $age -gt $TWO_WEEKS ] ; then
    level=35
    else
    level=39
    fi
    else
    if [ $age -gt $FOUR_WEEKS ] ; then
    level=45
    else
    level=49
    fi
    fi
    echo level=$level
    return $level
    # init
    SUDO=sudo
    PACMAN=pacman
    ARCH=i686
    TMP_FILE=/tmp/$(basename $0).tmp
    if [ 0 -eq $# ] ; then
    echo usage: $0 threshold
    exit 4
    fi
    threshold=$1
    # get upgrade list
    "$SUDO" "$PACMAN" -Syu --print-uris | grep ".pkg.tar.gz$" >"$TMP_FILE"
    targets=""
    # analyse "upgrade level"
    while read uri ; do
    pkg=$(basename "$uri")
    pkg=${pkg%-$ARCH.pkg.tar.gz}
    pkg=${pkg%.pkg.tar.gz}
    name=${pkg%-*-*}
    new_ver=${pkg#$name-}
    old_ver=$("$PACMAN" -Qi "$name" | grep "^Version")
    old_ver=$(echo $old_ver)
    old_ver=${old_ver#Version : }
    repo=$(basename $(dirname $(dirname $(dirname "$uri"))))
    date=$("$PACMAN" -Si "$name" | grep "^Build Date")
    date=$(echo $date)
    date=${date#Build Date : }
    echo name=$name repo=$repo old_ver=$old_ver new_ver=$new_ver date=$date
    evaluate_upgrade_level "$old_ver" "$new_ver" "$repo" "$date"
    level=$?
    if [ $level -lt $threshold ] ; then
    echo save
    targets="$targets $name"
    fi
    echo
    done <"$TMP_FILE"
    # do it!
    echo $targets
    "$SUDO" "$PACMAN" -S $targets
    Last edited by bsdson.tw (2008-11-07 10:14:36)

    nice idea! but i like to live life on the edge
    will be useful for server stuff. will give it a spin when i set up my server with arch

  • Slow and insecure but feature-rich pacman wrapper in bash

    This project of mine started because I want to compile my packages in a way that lets me delete gnome apps. Here's the problem: I see that evince depends on gnome-keyring, gnome-keyring depends on gconf and alltray depends on gconf. This leads me to think that if I recompile evince to not use gnome-keyring and recompile alltray to not use gconf, I can delete gconf.
    NO!
    I have to recompile evince to not use gconf as well because little do I know from pacman's dependency handling... gconf is a direct (but second level) dependency of evince as it's compiled as well.
    This is a pretty standard problem. It's the reason why debian dependency lists are so damn long. I don't want Arch to move to a system like that... well sort of. Here's what I did. I made a script that acts just like pacman but when you tell it to download and install a package, it tells pacman to only download that package into a separate cache, then it extracts the package, finds all dynamic executables in the package, uses ldd to determine their library dependencies, uses pacman -Qo to find packages that own these dependencies (and caches them in a file so they can be looked up more quickly in the future), applies some other enhancements that should be visible in the script, then adds the new dependencies to the depends array and makes sure that none are duplicated. It also formats the array so that it goes (original clean dependency list) kernel26 (new list). That way it can parse queries as well so -Qi will omit all the dependencies after kernel26 and the Required By section while -Qii shows everything. This is the perfect compromise for me. Not sure if it will be for you.
    Other things it does:
    * Checks if AUR packages need updating (but doesn't update them)
    * Takes out docs and gconf schemas
    * Cleans up man pages so there's no /usr/man and just /usr/share/man/man*
    * Convers /usr/share/man/locale/man1/whatever.1.gz to /usr/share/man/man1/whatever-locale.1.gz
    * Converts info pages to man pages with info2man and puts them in man9
    * Gzips all man pages
    * Allows replacing packages with -U
    * Package specific stuff like disabling the firefox error console.
    Regretably I had to make it play around with the md5sums. This essentially makes them useless but if I don't do this reinstalling a package that is in the main cache because this script put it there fails due to corruption. So you might want to get rid of this "feature" and probably the firefox / uvesafb /gstreamer / info2man stuff but this is cool so tell me what you think of it.
    #!/bin/bash
    function aur_check {
    STARTDIR=`pwd`
    cd /var/cache/pacman
    for r in `pacman -Qmq`; do
    wget "http://aur.archlinux.org/packages/$r/$r/PKGBUILD" >/dev/null 2>&1
    if [ $? -eq 0 ]; then
    LOCAL_VERSION_REL=`'pacman' -Q $r | awk '{print $2}'`
    LOCAL_VERSION=`echo $LOCAL_VERSION_REL| sed -e 's/-.*//g'`
    REMOTE_VERSION=`cat PKGBUILD | grep -E '^pkgver=' | sed -e 's/pkgver=//g' | sed -e 's/[ ]*//g'`
    REMOTE_REL=`cat PKGBUILD | grep -E '^pkgrel=' | sed -e 's/pkgrel=//g'`
    if [[ "$LOCAL_VERSION" < "$REMOTE_VERSION" ]]; then
    printf "warning: $r: ignoring package upgrade ($LOCAL_VERSION_REL => ${REMOTE_VERSION}-${REMOTE_REL})\n"
    fi
    rm PKGBUILD
    fi
    done
    cd $STARTDIR
    function sync_check {
    STARTDIR=`pwd`
    cd /var/cache/pacman
    IGNORED_PACKAGES=`cat /etc/pacman.conf | grep -E '^IgnorePkg' | sed -e 's/IgnorePkg[ ]*=[ ]*//g'`
    for s in $IGNORED_PACKAGES; do
    REMOTE_VERSION_STRING=`'pacman' -Si $s 2>/dev/null | grep -E '^Version'`
    if [ $? -eq 0 ]; then
    REMOTE_VERSION_REL=`echo $REMOTE_VERSION_STRING | awk '{print $3}'`
    LOCAL_VERSION_STRING=`'pacman' -Q $s 2>/dev/null`
    if [ $? -eq 0 ]; then
    LOCAL_VERSION_REL=`echo $LOCAL_VERSION_STRING | awk '{print $2}'`
    printf "warning: $s: ignoring package upgrade ($LOCAL_VERSION_REL => $REMOTE_VERSION_REL)\n"
    fi
    fi
    done
    cd $STARTDIR
    function remove_crap {
    # No docs or schemas.
    rm -rf 2>/dev/null ./usr/share/doc
    rm -rf 2>/dev/null ./usr/share/gtk-doc
    rm -rf 2>/dev/null ./etc/gconf
    # Please delete this file. It is not necessary for linking the library.
    find . -name "*.la" -exec rm {} \;
    # Only one man directory please.
    if [ -d ./usr/man ]; then
    if [ ! -d ./usr/share ]; then
    mkdir ./usr/share
    fi
    mv ./usr/man ./usr/share/man
    fi
    if [ -d ./usr/share/man ]; then
    cd ./usr/share/man
    ls | grep 'cat' | xargs rm -rf
    if [ -d ./man ]; then
    mv ./man/* .
    rm -rf ./man
    fi
    # Imposes what I consider to be a better naming convention for some reason.
    for t in `ls`; do
    if [ $t != 'man0' ] && [ $t != 'man1' ] && [ $t != 'man2' ] && [ $t != 'man3' ] && [ $t != 'man4' ] && [ $t != 'man5' ] && [ $t != 'man6' ] && [ $t != 'man7' ] && [ $t != 'man8' ] && [ $t != 'man9' ] && [ $t != 'mann' ] && [ $t != 'manm' ]; then
    cd $t
    for u in `ls`; do
    cd $u
    for v in `ls`; do
    SECOND_LAST_EXTENSION=`echo $v | sed -e 's/\.gz$//g' | rev | sed -e 's/\..*//g' | rev`
    PREFIX=`echo $v | sed -e 's/\.gz$//g' | sed -e "s/\.${SECOND_LAST_EXTENSION}//g"`
    SUFFIX=`echo $v | sed -e "s/$PREFIX//g"`
    if [ ! -h $v ]; then
    install -D $v ../../${u}/${PREFIX}-${t}${SUFFIX}
    else
    TARGET=`readlink $v`
    TARGET_SECOND_LAST_EXTENSION=`echo $TARGET | sed -e 's/\.gz$//g' | rev | sed -e 's/\..*//g' | rev`
    TARGET_PREFIX=`echo $TARGET | sed -e 's/\.gz$//g' | sed -e "s/\.${TARGET_SECOND_LAST_EXTENSION}//g"`
    TARGET_SUFFIX=`echo $TARGET | sed -e "s/${TARGET_PREFIX}//g"`
    install -d ../../${u}
    ln -s ${TARGET_PREFIX}-${t}${TARGET_SUFFIX} ../../${u}/${PREFIX}-${t}${SUFFIX}
    fi
    done
    cd ..
    done
    cd ..
    rm -rf $t
    fi
    done
    # Now that it is nicely organized we can gzip everything and add symlinks.
    for x in `ls`; do
    cd $x
    for y in `ls`; do
    echo $y | grep -q -E '\.gz$'
    if [ $? -ne 0 ]; then
    gzip $y >/dev/null 2>&1
    SECOND_LAST_EXTENSION=`echo $y | rev | sed -e 's/\..*//g' | rev`
    PREFIX=`echo $y | sed -e "s/\.${SECOND_LAST_EXTENSION}//g"`
    NEW_NAME=`echo $PREFIX | sed -e 's/\./-/g'`
    if [ $NEW_NAME != $PREFIX ]; then
    ln -s ${y}.gz ${NEW_NAME}.${SECOND_LAST_EXTENSION}.gz
    fi
    else
    SECOND_LAST_EXTENSION=`echo $y | sed -e 's/\.gz$//g' | rev | sed -e 's/\..*//g' | rev`
    PREFIX=`echo $y | sed -e 's/\.gz//g' | sed -e "s/\.${SECOND_LAST_EXTENSION}//g"`
    NEW_NAME=`echo $PREFIX | sed -e 's/\./-/g'`
    if [ $NEW_NAME != $PREFIX ]; then
    ln -s ${y} ${NEW_NAME}.${SECOND_LAST_EXTENSION}.gz
    fi
    fi
    done
    cd ..
    done
    cd ../../..
    fi
    # Converts info pages to man pages in the man9 directory
    if [ -d ./usr/share/info ]; then
    if [ -d ./usr/share/man ]; then
    mkdir ./usr/share/man/man9
    else
    mkdir ./usr/share/man
    mkdir ./usr/share/man/man9
    fi
    cd ./usr/share/info
    for z in `ls`; do
    echo $z | grep -q -E '\.gz$'
    if [ $? -eq 0 ]; then
    NAME=`echo $z | sed -e 's/\.gz$//g'`
    NEWNAME=`echo $NAME | sed -e 's/\./-/g'`
    gunzip $z
    info2man $NAME > ../man/man9/${NEWNAME}
    gzip ../man/man9/${NEWNAME} >/dev/null 2>&1
    else
    NEWNAME=`echo $z | sed -e 's/\./-/g'`
    info2man $z > ../man/man9/${NEWNAME}
    gzip ../man/man9/${NEWNAME} >/dev/null 2>&1
    fi
    done
    cd ../../..
    rm -rf ./usr/share/info
    fi
    function install_with_u {
    ULTIMATE_ANSWER="y"
    # Checks if there are package conflicts
    CONFLICTS=`cat .PKGINFO | grep 'conflict = ' | awk '{print $3}'`
    ACTUAL_CONFLICTS=""
    for p in $CONFLICTS; do
    VERSION_CHECK=0
    CONFLICTING_PACKAGE=`echo $p | sed -r 's/(>|=|<).*//g'`
    # Checks if these conflicts actually affect packages on the system
    'pacman' -Q $CONFLICTING_PACKAGE >/dev/null 2>&1
    if [ $? -eq 0 ]; then
    AFFECTED=1
    if [ ${#p} -gt ${#CONFLICTING_PACKAGE} ]; then
    AFFECTED=0
    # If a version is specified, finds it out and sees if we're affected
    CONFLICTING_VERSION_STRING=${p:${#CONFLICTING_PACKAGE}:${#p}-${#CONFLICTING_PACKAGE}}
    RELATION=${CONFLICTING_VERSION_STRING:1:2}
    if [ "$RELATION" = "=" ]; then
    RELATION=${CONFLICTING_VERSION_STRING:0:1}${RELATION}
    CONFLICTING_VERSION=${CONFLICTING_VERSION_STRING:2:${#CONFLICTING_VERSION_STRING}-2}
    else
    RELATION=${CONFLICTING_VERSION_STRING:0:1}
    CONFLICTING_VERSION=${CONFLICTING_VERSION_STRING:1:${#CONFLICTING_VERSION_STRING}-1}
    fi
    ACTUAL_VERSION=`pacman -Q $CONFLICTING_PACKAGE | awk '{print $2}'`
    if [ "$RELATION" = ">" ]; then
    if [[ "$ACTUAL_VERSION" > "$CONFLICTING_VERSION" ]]; then
    AFFECTED=1
    fi
    elif [ "$RELATION" = "<" ]; then
    if [[ "$ACTUAL_VERSION" < "$CONFLICTING_VERSION" ]]; then
    AFFECTED=1
    fi
    elif [ "$RELATION" = ">=" ]; then
    if [ "$ACTUAL_VERSION" >= "$CONFLICTING_VERSION" ]; then
    AFFECTED=1
    fi
    elif [ "$RELATION" = "<=" ]; then
    if [ "$ACTUAL_VERSION" <= "$CONFLICTING_VERSION" ]; then
    AFFECTED=1
    fi
    else
    if [ "$ACTUAL_VERSION" = "$CONFLICTING_VERSION" ]; then
    AFFECTED=1
    fi
    fi
    fi
    if [ $AFFECTED -ne 0 ]; then
    ACTUAL_CONFLICTS="$ACTUAL_CONFLICTS $CONFLICTING_PACKAGE"
    printf ":: ${1} conflicts with ${CONFLICTING_PACKAGE}. Remove ${CONFLICTING_PACKAGE}? [Y/n] "
    read ANSWER
    if [ $ANSWER != "Y" ] && [ $ANSWER != "y" ]; then
    ULTIMATE_ANSWER="n"
    break
    fi
    fi
    fi
    done
    if [ $ULTIMATE_ANSWER = "y" ]; then
    for q in $ACTUAL_CONFLICTS; do
    'pacman' -Rd ${q}
    done
    return 0
    fi
    return 1
    function get_deps {
    PACKAGE_NAME=`cat .PKGINFO | grep 'pkgname = ' | sed -e 's/pkgname = //g'`
    # Does a few package specific things
    if [ $PACKAGE_NAME = "kernel26" ]; then
    ln -s /etc/uvesafb.conf /etc/uvesafb
    elif [ $PACKAGE_NAME = "firefox" ]; then
    cd ./usr/lib
    FIREFOX_DIR=`ls | grep 'firefox'`
    if [ $? -eq 0 ]; then
    cd $FIREFOX_DIR/chrome
    jar -xf ./browser.jar
    rm ./browser.jar
    sed -i -e '/console.xul/s/^/\/\//g' ./content/browser/browser.js
    jar -cf browser.jar content
    rm -r content
    cd ../..
    fi
    cd ../..
    elif [ $PACKAGE_NAME = "gstreamer0.10-good-plugins" ]; then
    rm ./usr/lib/gstreamer0.10/libgstesd.so
    fi
    POSSIBLE_LIBS=`find . -type f | grep -E '(\.so\.|\.so$)'`
    POSSIBLE_BINS=`find . -type f | grep -v 'PKGINFO' | grep -v -E '\/.*\.[a-zA-Z0-9]+$' | grep -v 'LICENSE'`
    POSSIBLE_ELFS="$POSSIBLE_LIBS $POSSIBLE_BINS"
    DEPS=""
    # Makes a list of all the direct dependencies
    for i in $POSSIBLE_ELFS; do
    #echo "SCANNING: $i"
    ldd $i >/dev/null 2>&1
    if [ $? -eq 0 ]; then
    # Caches the shared libraries in a file to make it easier for everything else to look them up
    DIRNAME=`dirname ${i:1:${#i}}`
    echo "$i" | grep -q ".so"
    if [ $? -eq 0 ]; then
    if [ "$DIRNAME" = "/lib" ] || [ "$DIRNAME" = "/usr/lib" ]; then
    grep -q "${i:1:${#i}} $PACKAGE_NAME" /var/cache/pacman/quicklookup
    # If this package's library assigned to this package was not found...
    if [ $? -ne 0 ]; then
    grep -q "${i:1:${#i}}" /var/cache/pacman/quicklookup
    # It may have been assigned to another package so we change that
    if [ $? -eq 0 ]; then
    sed -i -e "/${i:1:${#i}}/d" /var/cache/pacman/quicklookup
    fi
    # Otherwise we just assign it to this package
    echo "${i:1:${#i}} $PACKAGE_NAME" >> /var/cache/pacman/quicklookup
    fi
    fi
    fi
    # Figures out what packages own the library dependencies
    POSSIBLE_DEPS=`ldd $i 2>/dev/null | grep '=> ' | grep -v '=> ' | sed -e 's/.* => //g' | sed -e 's/ (.*//g'`
    for j in $POSSIBLE_DEPS; do
    DIRNAME=`dirname $j`
    if [ "$DIRNAME" = "/lib" ] || [ "$DIRNAME" = "/usr/lib" ]; then
    OWNER=`grep "$j" /var/cache/pacman/quicklookup`
    # The owner of the dep is either already in the quicklookup file
    if [ $? -eq 0 ]; then
    OWNER=`echo $OWNER | awk '{print $2}'`
    DEPS="$DEPS $OWNER"
    else
    # Or it's part of the current package
    BASENAME=`basename $j`
    find . -name ${BASENAME} | grep -q "${BASENAME}"
    if [ $? -eq 0 ]; then
    echo "$j $PACKAGE_NAME" >> /var/cache/pacman/quicklookup
    else
    # Or we figure out its owner with pacman and put it in the quicklookup file
    OWNER=`'pacman' -Qoq $j 2>/dev/null`
    if [ $? -eq 0 ]; then
    echo "$j $OWNER" >> /var/cache/pacman/quicklookup
    DEPS="$DEPS $OWNER"
    fi
    fi
    fi
    fi
    done
    fi
    done
    # Sticks a "kernel26" between the old dependencies and the new dependencies
    CURRENT_DEPS=`cat .PKGINFO | grep -E '^depend = ' | sed -e 's/depend = //g'`
    DEPS="$CURRENT_DEPS kernel26a $DEPS"
    # Puts them into the PKGINFO file so that all depend lines are contiguous
    grep -q -E '^depend = ' .PKGINFO
    if [ $? -eq 0 ]; then
    FIRST_DEPEND_LINE_NUMBER=`grep -n -E '^depend = ' .PKGINFO | head -1 | sed -e 's/:.*//g'`
    LAST_DEPEND_LINE_NUMBER=`grep -n -E '^depend = ' .PKGINFO | tail -1 | sed -e 's/:.*//g'`
    LAST_LINE_NUMBER=`wc -l .PKGINFO | awk '{print $1}'`
    (( DIFFERENCE=$LAST_LINE_NUMBER-$LAST_DEPEND_LINE_NUMBER ))
    cat .PKGINFO | tail -${DIFFERENCE} > .PKGINFO-3
    touch .PKGINFO-2
    (( FIRST_DEPEND_LINE_NUMBER-- ))
    cat .PKGINFO | head -${FIRST_DEPEND_LINE_NUMBER} > .PKGINFO-1
    else
    cp .PKGINFO .PKGINFO-1
    touch .PKGINFO-2
    touch .PKGINFO-3
    fi
    for k in $DEPS; do
    echo "depend = $k" >> .PKGINFO-2
    done
    # This is all so we don't get mesa and mesa=7.5 in the same dep array
    cat .PKGINFO-2 | awk '{print $3}' | sed -r 's/(>=|>|=|<|<=)/ \1/g' > .RAW-DEPS
    cat .RAW-DEPS | awk '{print $1}' > .COL-1
    cat .RAW-DEPS | awk '{print $2}' > .COL-2
    # Got this from sed1line.txt... it removes duplicate lines
    sed -i -n 'G; s/\n/&&/; /^\([ -~]*\n\).*\n\1/d; s/\n//; h; P' .COL-1
    paste --delimiter="" .COL-1 .COL-2 > .RAW-DEPS
    sed -i -e "/${PACKAGE_NAME}/d" .RAW-DEPS
    sed -i -e 's/kernel26a/kernel26/g' .RAW-DEPS
    sed -e 's/^/depend = /g' .RAW-DEPS > .PKGINFO-2
    sed -i -e "/depend =[ ]*$/d" .PKGINFO-2
    cat .PKGINFO-1 .PKGINFO-2 .PKGINFO-3 > .PKGINFO
    rm .PKGINFO-1 .PKGINFO-2 .PKGINFO-3 .RAW-DEPS .COL-1 .COL-2
    function do_install {
    STARTDIR=`pwd`
    cd /var/cache/pacman/tmp
    for l in `ls -tr`; do
    TEMP_DIR=`echo $l | sed -r 's/(-i686|-x86_64|-any|)\.pkg\.tar\.gz//g'`
    # Extracts the package and makes the necessary modifications to it
    mkdir $TEMP_DIR
    mv $l $TEMP_DIR
    cd $TEMP_DIR
    tar -xf $l >/dev/null 2>&1
    rm $l
    remove_crap
    get_deps
    # Retars the package and installs it
    if [ -e .INSTALL ]; then
    tar -cf $l .INSTALL .PKGINFO * >/dev/null 2>&1
    else
    tar -cf $l .PKGINFO * >/dev/null 2>&1
    fi
    # Installs it and puts it in the cache
    install_with_u $l
    if [ $? -eq 0 ]; then
    'pacman' -Udf $l
    else
    mv $l ../../pkg
    cd ..
    rm -r $TEMP_DIR
    break;
    fi
    mv $l ../../pkg
    cd ..
    rm -r $TEMP_DIR
    done
    cd $STARTDIR
    function get_answer {
    read ANSWER
    echo $ANSWER > /var/cache/pacman/answer
    echo $ANSWER
    if [ "$1" = "-Syu" ]; then
    sync_check
    aur_check
    'pacman' --cachedir /var/cache/pacman/tmp -Syuw
    do_install
    elif [ "$1" = "-Su" ]; then
    sync_check
    aur_check
    'pacman' --cachedir /var/cache/pacman/tmp -Suw
    do_install
    elif [ "$1" = "-S" ]; then
    shift
    PACKAGE_ARRAY=""
    # If something we're installing is in the cache... move it to the temporary cache
    for n in $@; do
    if [ ${n:0:1} != "-" ]; then
    NUM_MATCHES=`ls -1 /var/cache/pacman/pkg | grep -E "^${n}-" | wc -l`
    for o in `seq 1 $NUM_MATCHES`; do
    POSSIBLE_MATCH=`ls /var/cache/pacman/pkg | grep -E "^${n}-" -m${o} | tail -1`
    HYPHENS=`echo $POSSIBLE_MATCH | sed -e "s/${n}//g" | grep -o "-" | wc -l`
    if [ $HYPHENS -le 3 ]; then
    mv /var/cache/pacman/pkg/${POSSIBLE_MATCH} /var/cache/pacman/tmp
    # Changes the stored md5sum temporarily - I don't know a better way to do this
    TEMP_DIR=`echo ${POSSIBLE_MATCH} | sed -r 's/(-i686|-x86_64|-any|)\.pkg\.tar\.gz//g'`
    find /var/lib/pacman/sync -name $TEMP_DIR | grep -q $TEMP_DIR
    if [ $? -eq 0 ]; then
    MD5SUM=`md5sum /var/cache/pacman/tmp/${POSSIBLE_MATCH} | awk '{print $1}'`
    REPOS=`find /var/lib/pacman/sync -name $TEMP_DIR | sed -e 's/\// /g' | awk '{print $5}'`
    sed -i '/%MD5SUM%/G' /var/lib/pacman/sync/$REPOS/$TEMP_DIR/desc
    MD5_LINE_NUMBER=`grep -n '%MD5SUM%' /var/lib/pacman/sync/$REPOS/$TEMP_DIR/desc | sed -e 's/:.*//g'`
    (( MD5_LINE_NUMBER++ ))
    sed -i -e "${MD5_LINE_NUMBER}s/.*/${MD5SUM}/" /var/lib/pacman/sync/$REPOS/$TEMP_DIR/desc
    PACKAGE_ARRAY="${PACKAGE_ARRAY} ${REPOS}/${TEMP_DIR}"
    fi
    break;
    fi
    done
    fi
    done
    # Pacman is run and then a function reads a y or an n from stdin and passes it to pacman's stdin
    get_answer | 'pacman' --cachedir /var/cache/pacman/tmp -Sw $@
    # The function also saves it in a file so we know whether to proceed or cancel because pacman was cancelled
    LETTER=`cat /var/cache/pacman/answer`
    if [ "$LETTER" != "y" ] || [ "$LETTER" != "Y" ]; then
    do_install
    else
    # If anything got moved to the temporary cache for this it is sent back to the main one
    FILES_IN_CACHE=`ls /var/cache/pacman/tmp | wc -l`
    if [ $FILES_IN_CACHE -ne 0 ]; then
    mv /var/cache/pacman/tmp/* /var/cache/pacman/pkg
    fi
    fi
    # Changes all the md5sums back
    for w in $PACKAGE_ARRAY; do
    MD5_LINE_NUMBER=`grep -n '%MD5SUM%' /var/lib/pacman/sync/$w/desc | sed -e 's/:.*//g'`
    (( MD5_LINE_NUMBER++ ))
    sed -i -e "${MD5_LINE_NUMBER}d" /var/lib/pacman/sync/$w/desc
    done
    elif [ "$1" = "-U" ]; then
    STARTDIR=`pwd`
    TEMP_DIR=`echo $2 | sed -r 's/(-i686|-x86_64|-any|)\.pkg\.tar\.gz//g'`
    mkdir /var/cache/pacman/$TEMP_DIR
    cp "$2" /var/cache/pacman/$TEMP_DIR
    cd /var/cache/pacman/$TEMP_DIR
    tar -xf $2 >/dev/null 2>&1
    rm $2
    get_deps
    # Retars the package and installs it
    if [ -e .INSTALL ]; then
    tar -cf $2 .INSTALL .PKGINFO * >/dev/null 2>&1
    else
    tar -cf $2 .PKGINFO * >/dev/null 2>&1
    fi
    install_with_u $2
    if [ $? -eq 0 ]; then
    'pacman' -U $2
    fi
    cd ..
    rm -r $TEMP_DIR
    cd $STARTDIR
    elif [ "$1" = "-Qi" ] || [ "$1" = "-Qii" ]; then
    INITIAL_ARG=$1
    shift
    if [ "$INITIAL_ARG" = "-Qi" ]; then
    'pacman' -Qi $@ > /var/cache/pacman/tempquery
    else
    'pacman' -Qii $@ > /var/cache/pacman/tempquery
    fi
    if [ $? -ne 0 ] || [ ! -e /var/cache/pacman/tempquery ]; then
    exit 1
    fi
    # Filters out all deps after kernel26 for a regular query
    # Filters out all deps before kernel26 for a verbose query
    if [ $? -eq 0 ]; then
    START_LINE_NUMBER=`cat /var/cache/pacman/tempquery | grep -n 'Depends On' | sed -e 's/:.*//g'`
    LINE_NUMBER=$START_LINE_NUMBER
    (( LINE_NUMBER=$LINE_NUMBER+1 ))
    cat /var/cache/pacman/tempquery | head -${LINE_NUMBER} | tail -1 | grep ':'>/dev/null 2>&1
    while [ $? -ne 0 ]; do
    (( LINE_NUMBER=$LINE_NUMBER+1 ))
    cat /var/cache/pacman/tempquery | head -${LINE_NUMBER} | tail -1 | grep ':'>/dev/null 2>&1
    done
    (( END_LINE_NUMBER=$LINE_NUMBER-1 ))
    (( DIFFERENCE=$LINE_NUMBER-$START_LINE_NUMBER ))
    OLD_DEP_LIST=`cat /var/cache/pacman/tempquery | head -${END_LINE_NUMBER} | tail -${DIFFERENCE} | sed -e 's/.* : //g' | sed -e 's/ //g'`
    for k in $OLD_DEP_LIST; do
    if [ "$INITIAL_ARG" = "-Qi" ]; then
    if [ "$k" != "kernel26" ]; then
    NEW_DEP_LIST="$NEW_DEP_LIST $k"
    else
    break
    fi
    else
    if [ "$k" != "kernel26" ]; then
    NEW_DEP_LIST="$NEW_DEP_LIST $k"
    fi
    fi
    done
    fi
    # Removes the old deps array and replaces it with the new one
    sed -i -e "${START_LINE_NUMBER},${END_LINE_NUMBER}d" /var/cache/pacman/tempquery
    (( START_LINE_NUMBER=$START_LINE_NUMBER-1 ))
    END_LINE_NUMBER=`wc -l /var/cache/pacman/tempquery | awk '{print $1}'`
    (( DIFFERENCE=$END_LINE_NUMBER-$START_LINE_NUMBER ))
    cat /var/cache/pacman/tempquery | head -${START_LINE_NUMBER} > /var/cache/pacman/tempquery-1
    cat /var/cache/pacman/tempquery | tail -${DIFFERENCE} > /var/cache/pacman/tempquery-3
    CURRENT_LINE=""
    CURRENT_LINE_NUMBER=1
    for m in $NEW_DEP_LIST; do
    if (( ${#CURRENT_LINE}+${#m}+1<=63 )); then
    CURRENT_LINE="$CURRENT_LINE $m"
    else
    if [ $CURRENT_LINE_NUMBER -eq 1 ]; then
    printf "Depends On :$CURRENT_LINE\n" >> /var/cache/pacman/tempquery-2
    else
    printf "\t\t$CURRENT_LINE\n" >> /var/cache/pacman/tempquery-2
    fi
    CURRENT_LINE=" $m"
    CURRENT_LINE_NUMBER=0
    fi
    done
    if [ $CURRENT_LINE_NUMBER -eq 1 ]; then
    printf "Depends On :$CURRENT_LINE\n" >> /var/cache/pacman/tempquery-2
    else
    printf "\t\t$CURRENT_LINE\n" >> /var/cache/pacman/tempquery-2
    fi
    cat /var/cache/pacman/tempquery-1 /var/cache/pacman/tempquery-2 /var/cache/pacman/tempquery-3 > /var/cache/pacman/tempquery
    # Removes the requirements array for a regular query
    if [ "$INITIAL_ARG" = "-Qi" ]; then
    START_LINE_NUMBER=`cat /var/cache/pacman/tempquery | grep -n 'Required By' | sed -e 's/:.*//g'`
    LINE_NUMBER=$START_LINE_NUMBER
    (( LINE_NUMBER=$LINE_NUMBER+1 ))
    cat /var/cache/pacman/tempquery | head -${LINE_NUMBER} | tail -1 | grep ':'>/dev/null 2>&1
    while [ $? -ne 0 ]; do
    (( LINE_NUMBER++ ))
    cat /var/cache/pacman/tempquery | head -${LINE_NUMBER} | tail -1 | grep ':'>/dev/null 2>&1
    done
    (( END_LINE_NUMBER=$LINE_NUMBER-1 ))
    sed -i -e "${START_LINE_NUMBER},${END_LINE_NUMBER}d" /var/cache/pacman/tempquery
    fi
    cat /var/cache/pacman/tempquery
    rm /var/cache/pacman/tempquery /var/cache/pacman/tempquery-1 /var/cache/pacman/tempquery-2 /var/cache/pacman/tempquery-3
    elif [ "$1" = "-Scc" ]; then
    LINE_NUMBER=0
    for z in `cat /var/cache/pacman/quicklookup | awk '{print $1}'`; do
    (( LINE_NUMBER++ ))
    if [ ! -e $z ]; then
    sed -i -e "${LINE_NUMBER}d" /var/cache/pacman/quicklookup
    (( LINE_NUMBER-- ))
    fi
    done
    'pacman' -Scc
    else
    'pacman' $@
    fi
    Last edited by ConnorBehan (2009-09-19 00:42:48)

    rls wrote:ABS is fine, but unless I am mistaken, it does nothing to ensure the configure and make stages go smoothly. It is a good way to integrate "home-rolled" packages into the Arch system.
    hmmmm... I could be wrong because I've never used Gentoo, but if you make a package that doesn't already exist for Gentoo, does it do anything to make sure the compilation goes smoothly?  If the package exists, then there is a way to build the package that has been tested by somebody else. This is how ABS works too; if a PKGBUILD exists, you can be reasonably sure it will work.
    I can't imagine a program that can automatically fix or recover from compiler or Makefile errors. If it does, then... wow.
    I assume that Gentoo has a larger package base than Arch, but let's not get into that discussiong again!
    Xentacs script is basically designed to allow you to choose whether you are going to install from source or binary. Assuming the PKGBUILDS are in order (which for arch repository programs they are, because the binaries were built from them!), this should work as flawlessly as installing from binaries.
    Dusty

  • Oracle UI Shell Functional Pattern

    Problem Description
    A chief challenge in UI development is rational consistency -- providing the user with predictable locations and behaviors for the most salient features.
    Technical Pattern Description
    The Oracle ADF UI Shell is a template that provides guidance to development teams working towards a consistent UI for their customers. Because it is reinforced in code, it augments the probability that UI specifications will be followed. The primary assumption of the Oracle ADF UI Shell is that each page based on the template will represent a significant module of an application, if not separate applications. As a consequence, the "boilerplate" portion of the UI (e.g., branding, ubiquitous controls, obligatory legal statements) are more easily held consistent in form, placement, and function -- as they are defined once. The more interactive portion of the application -- features and functions that define the application -- are presented in the "workarea" of the template. The Oracle ADF UI Shell template identifies those areas through named facets (e.g., navigation) and regions (e.g., dynamic tabs). Nearly all, if not all, of the product's value add can be surfaced in regions of a single page as bounded ADF taskflows. In the end, customers enjoy a more predictable user experience.
    Click here to see the document that describes this pattern.

    I have already tested my understanding on the taskFlow binding "*parametersMap*" attribute above and it works!
    First, I added an additional parameter in line with the tabContext parameter to my custom dynamicTabShellDefinition.xml. The parameter binding section will be as follows:
    <parameters>
        <parameter id="tabContext" value="${viewScope.tabContext}"/>
        <parameter id="parameterMap" value="${requestScope.parameterMap}"/>
      </parameters>Note that instead of using ${viewScope.parameterMap}, I used ${requestScope.parameterMap} because it seems that when I passed a viewScope parameter from a backingBean inside one of my bounded task flows, it will not reach the initialization of my target task flow in the separate tab.
    Second, I redefined all my taskFlow bindings to define the "*parametersMap*" attribute value to "*#{bindings.parameterMap}*". Please see below a redefined taskFlow definition:
    <taskFlow id="r0"
                  taskFlowId="${viewScope.tabContext.taskflowIds[0]}"
                  activation="deferred"
                  xmlns="http://xmlns.oracle.com/adf/controller/binding"
                  parametersMap="#{bindings.parameterMap}">
          <parameters>
            <parameter id="tabContext" value="${bindings.tabContext}"
                       xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
          </parameters>
    </taskFlow>With the steps above, I could already define any parameter that I need in the bounded taskflow: Please see below for a sample parameter definition:
    <input-parameter-definition id="__2">
          <name id="__3">employeeId</name>
          <value>#{pageFlowScope.employeeId}</value>
          <required/>
    </input-parameter-definition>Just be sure that before you invoke the backing bean method that will call the TabContext addTab() method you already put the employeeId into the parameterMap and set the parameterMap into requestScope:
            Map<String, Object> parameterMap = new HashMap<String, Object>();
            parameterMap.put("employeeId",employee.getId());
            JSFUtils.setRequestAttribute("parameterMap", parameterMap);//JSFUtils is a utility class from FOD
            //direct or indirect call to the TabContext addTab() method hereI hope this will help others too.
    regards,
    pino

  • Pacman wrapper to allow source builds (srcpac)

    This is mostly just something that I did because I had never written a wrapper for pacman before and wanted to see if it worked with the current pacman feature set.
    It's 1:30ish in the morning, so my eyes are a little blurry.
    The wrapper is called srcpac.  It's version 0.1 at this point
    The code is quite ugly because I threw it together in the past 3 hours, but my inital tests have been successes.
    Now, for the pitch.  Imagine if you could use pacman to install binary packages as well as build those same packages from source (with your own optimizations).  Not only that, but upgrades remembered which packages were precompiled and which were compiled on the spot.
    Now, imagine that pacman didn't actually handle that, because the hard-core KISS people would complain too much and you wouldn't be able to think while you watch gcc output flash by.  Imagine instead a wrapper around pacman that handled it for you.
    Enter srcpac.  Lights brighten, music comes to a peak, close up!
    srcpac acts exactly the same as pacman (well, it should anyway), except you get this little extra flag -b (or --build) tacked on to -S (--sync) to build from source instead of install from a binary package.
    Let's see an example:
    srcpac -Sb w3m
    will compile w3m, install it, and remember that it was compiled
    srcpac -Sybu
    will upgrade all the packages that need upgrading by building them and remember that they were compiled (be careful with this one, it will include packages that weren't previously compiled).
    srcpac -Syu
    will upgrade all binary packages by installing binaries and upgrade all source packages by compiling from source.
    srcpac -Qi w3m adds an extra line too, "Source", with a simple yes or no.
    Which packages are source and which aren't are stored in /var/lib/srcpac just as files.  If the file exists, then the package was a source package (so it's easy to fix it if srcpac gets confused, also it doesn't touch anything pacman uses).
    While I can guarantee that this wrapper won't break your packages (because it uses pacman and makepkg to do all of it's package related stuff), I can't guarantee it'll work 100% correctly (it's 1:45 now!).
    If anyone is interested, the script is available here: http://xentac.net/svn/arch-tools/srcpac/tags/0.1/srcpac
    Yes, it's in bash.
    Feel free to tell me problems you run into using this tool.  Remember, if you use pacman instead of using srcpac, then all the packages will continue installing as binary packages.
    BEWARE: the -r option isn't fully implemented and may install to / in some cases, I'm pretty sure I don't ever write to / when -r is specified, but I can't be sure.
    .:edit - changed title to show srcpac name - dibble:.

    rls wrote:ABS is fine, but unless I am mistaken, it does nothing to ensure the configure and make stages go smoothly. It is a good way to integrate "home-rolled" packages into the Arch system.
    hmmmm... I could be wrong because I've never used Gentoo, but if you make a package that doesn't already exist for Gentoo, does it do anything to make sure the compilation goes smoothly?  If the package exists, then there is a way to build the package that has been tested by somebody else. This is how ABS works too; if a PKGBUILD exists, you can be reasonably sure it will work.
    I can't imagine a program that can automatically fix or recover from compiler or Makefile errors. If it does, then... wow.
    I assume that Gentoo has a larger package base than Arch, but let's not get into that discussiong again!
    Xentacs script is basically designed to allow you to choose whether you are going to install from source or binary. Assuming the PKGBUILDS are in order (which for arch repository programs they are, because the binaries were built from them!), this should work as flawlessly as installing from binaries.
    Dusty

  • Using power shell function and SQL Table

    I have a table holding file path of over 1 million documents. so like column one is documentID and column two is full file path.
    Now, I want to get the file size of each of the documents. I have a function in power shell that gets the size of a file given file path.
    My problem, is I do not know how to use that function and the table to get the size of each of the files(documents).
    Help Much Appreciated!!
    ebro

    I am not clear with your questions sir. Do you mean the category this question belongs too? If so, may be some body could help redirect the question to the appropriate place.
    So what category does this belong too CM12 or Powershell?
    http://www.enhansoft.com/

  • Wrapper C function for Hilscher(C​IF50PB) card API functions

    Hi,
    I'm finding difficulty while dealing with the array element in the below structure during wrapper DLL creation. 
    typedef struct tagVERSIONINFO {
    unsigned long ulDate;
    unsigned long ulDeviceNo;
    unsigned long ulSerialNo;
    unsigned long ulReserved;
    unsigned char abPcOsName0[4];
    unsigned char abPcOsName1[4];
    unsigned char abPcOsName2[4];
    unsigned char abOemIdentifier[4];
    } VERSIONINFO;
    Can anybody help in this regard

    Padmavathi,
    I'm not really sure what you are asking here.  Are you having trouble calling this DLL in LabVIEW or are you trying to create a DLL from LabVIEW to call from elsewhere?
    If you let us know what you are trying to do and specifically what problems you are running into it will be easier for us to help you.
    Regards,
    Simon H
    Applications Engineer
    National Instruments
    http://www.ni.com/support/

  • Gnome-Shell functionality in Openbox?

    Hey,
    i just tried out gnome3 and i really liked some of its features.
    I particularly liked that you could "switch desktop modes" from normal viewing/working to (re-)arranging windows (which are sized down to have a nice overview of all open windows) on workspaces by moving the mouse to the top left corner.
    Do you know of a way to emulate similar behaviour in Openbox?
    Anything that comes close, really. As long as it gives me the option to
    a) get an overview of all open windows _simultaneously_ (alt+tab doesn't quite do it for me)
    b) maybe let me arrange those windows in workspaces
    Doesn't have to be as pretty
    Regards,
    demian
    Last edited by demian (2011-05-06 20:14:33)

    enable a composite manager, a good one for open box is cairo-compmgr
    https://wiki.archlinux.org/index.php/Cairo_Compmgr
    When installed and running I believe win+e key shows all windows like gnome-shell or compiz-fusion

  • Shell function doesn't open audigy creative mixe

    Can anybody explain why the visual basic 'shell' command doesn't appear to open up the 'creative mixer 'window although it works perfectly with 'Creative Recorder' - I have found no reference to this in any vb forum so far. Any help would be appreciated.
    Message Edited by colin37 on 0-07-200705:0 AM
    Message Edited by colin37 on 0-07-200705: AM

    Below VBScript opens the Surround Mixer panel. Maybe you get some ideas from that code.
    '----- Start Of Script -----
    Option Explicit
    Dim WshShell
    Set WshShell = CreateObject("WScript.Shell" )
    ' Start up the Surround Mixer
    WshShell.CurrentDirectory = "C:\Program Files\Creative\SBAudigy2Zs\Surround Mixer"
    WshShell.Run "SurMixer.exe"
    While WshShell.AppActivate( "Surround Mixer" ) = FALSE
    wscript.sleep 200
    WshShell.AppActivate "Surround Mixer"
    Wend
    WScript.Quit(0)
    '----- End Of Script -----
    jutapaMessage Edited by jutapa on 0-07-200703:32 PM

  • Pacman alpm issue, vercmd missing, after rescue from install CD

    Hi
    I wanted to remove all packages from my system and reinstall from scratch
    So i used the pacman tip from the wiki to reinstall all packages on the system
    but changed it to remove instead -R instead of -S, little did i think ...
    everything on the system was removed, except running processes.
    i had no ls etc, no pacman and so on.
    So i created a arch cd from another computer and booted on it on my arch install computer.
    then i was advised on the archlinux irc. todo a chroot mount and  use pacman to install base-devel (+ base)
    Hence i did that, ... after a long long while i succeed.
    i first got chroot /mnt  no /bin/bash mesage when trying to start the chroot.
    So i copied the files shown via: ldd /bin/bash & ldd /usr/bin/pacman
    then i mount:
    mount /dev/sda1 /mnt/
    mount /dev/sda5 /mnt/boot
    mount /dev/sda6 /mnt/usr/
    mount /dev/sda7 /mnt/var/
    (i didnt mount /home).
    then
    $ chroot /mnt
    From here i use pacman to install packages
    pacman -S base-devel  - runs fine.
    pacman -S base           - i miss one package file (dcrond - i think)
    Then instead i go the the very fine wiki again, and see how to install all local packages.
    and use that.
    However now i get messages under the pacman install of the type .
    /tmp/alpm_QWYZ/.INSTALL: line xyz: vercmp: command not found.
    ------------- || -------------------------: line xyz: [: : integer expression expected
    I can't find out where this message comes from, i can find no vercmp comand
    (maybe a shell function?)
    I get lots of other similar errors.
    ============================
    At last there are al those /etc files which got .pacsave endings, should i think about them?
    Here some more errors from a "pacman -S base" via the arch CD and chroot
    find: /sys/devices no such file or directory
    Which: no /pcmcia-socket-startup.staic in (/sbin)
    ERROR: '/sbin/pcmcia-socket-startup.static' is not a file
    + some related files /sbin/pcmcia-**
    ============================
    If i reboot and enter my system on its harddisk instead of via the CD.
    I get SH:   not able to change group (-1) : inappropiate ioctl for device.
    This error message is by memory, since i just borked something else.
    and couldnt load system on harddisk, somehow the kernel has misplaced itself...
    ============================
    Ok more information:
    I succeded in booting via hardisk, and it looked very promising.
    However ...
    Console messages:
    device-mapper: ioctl: 4:15.0-ioctl .....
    Waiting 10 seconds for device ...
    :: running hook [resume]
    Waiting 10 seconds for device ...
    Root device ´´ doesnt exist, attempting to create it
    ERROR: failed to parse block device ids for ´´
    ERROR: unable to detect or create root device
    .. some general info stuff
    You are being dropped to a recovery console
    regards mic
    Last edited by cognacc (2009-10-19 17:42:18)

    Thanks John, Bill and Graffiti for your interest!
    The original install, many years ago, was of an education version from a local college. As updates became available thorough the update manager, they were installed. As stated above, it updated though 6.0 to 6.6, and then on to 7, eventually to 7.1! I can only repeat what happened, but not explain it. I thought nothing of it at the time, as it was all being managed by the update manager. I agree that this last seems to be more an upgrade than an update, but... what can I say? What happened is what happened, and it happened as I described it.
    But not's get hung up on the history! Now that I seem to have solved the original issue of not getting past the message that 'a more functional version has been detected', how does one solve the 'invalid serial number' issue that occurs when attempting to reinstall 6.0? Delete the Acrobat registry keys from HKLM and HKCU, and possibly anywhere else? The former didn't work yet, so, where else? Maybe there is an 'update' folder hanging around somewhere with a registry reference that needs to be deactivated?  Something like {AC76BA86-0000-0000-7AC5-6028747ADE00}?
    Any further thoughts? And thanks for the input, it really is appreciated!

  • [Solved] Shell: Is there a difference between / and // in directories?

    Hello:
    I'm making this tiny program in Shell:
    # Function.
    # NAME: chk_df
    # Synopsis:
    # Check if a local directory (dirName) exist and has a file (fileName).
    # The return codes are the following:
    # 99 : dirName does not exists
    # 0 : dirName exists and has fileName
    # 1 : dirName exists and has not fileName
    # Parameters:
    # In values: dirName <string> fileName <string>
    # Out values: returnCode <int>
    # How to use:
    # chk_df dirName fileName
    chk_df(){
    # Check the number of arguments that could be passed.
    # In this case, two, dirName, fileNAme.
    if [[ ${#@} != 2 ]]; then
    echo "Error ...Use [Funtion]: chk_df <dirName> <fileName>"
    echo "Ex: chk_df /foo lola.txt"
    exit
    fi
    DIR=$1
    FILE=$2
    [[ ! -d $DIR ]] && return 99
    [[ -d $DIR && ! -e $DIR/$FILE ]] && return 1
    [[ -d $DIR && -e $DIR/$FILE ]] && return 0
    Because I need to check if a file is in a directory, I did this (horrible?) patch $DIR/$FILE , but things like this could happen:
    I) If we do: chk_df /foo lola.txt
    We get: /foo/lola.txt
    II) If we do: chk_df /foo/ lola.txt
    We get: /foo//lola.txt [Notice the //]
    In both cases the code seems to work. Why?
    Could I leave it like that or it will bring problems? Is there a difference? UNIX assume it to the right way?
    EXTRA QUESTION: why I can not do the returns with negative numbers? This is:   return -1
    Thank you.
    Last edited by gromlok (2011-11-07 15:48:44)

    If this script is bash only, you could use bash parameter expansion to get rid of any number of //:
    $ DIR="/long//numerous//doubleslashed/path/to/"
    $ FILE="file"
    $ MYPATH="$DIR/$FILE"
    $ cd $MYPATH
    bash: cd: /long//numerous//doubleslashed/path/to//file: No such file or directory
    $ cd ${MYPATH//\/\//\/}
    bash: cd: /long/numerous/doubleslashed/path/to/file: No such file or directory
    See http://mywiki.wooledge.org/BashGuide/Pa … _Expansion if you want a better explanation.
    Edit: changed variable name from PATH to MYPATH.  Boy was I surprised by bash: pacman: command not found
    Last edited by alphaniner (2011-11-07 17:26:02)

Maybe you are looking for

  • SpryMenuBar, problems with Submenu

    Hi, everyone, I am new to Spry widgets. I am working with CS5. I have a problem with the only submenu I want to have for this site (in French). Instead of explaining, I attached a grab. My problme is clearly showing: the border of the submenu is offs

  • SAPScript:  why the window only show the LAST line

    Dears, In my form, one of the window only show the LAST line of the it. I have set the window enough space,  also when  debuging the program , open_form, write_form, all of those sy-subrc = 0. both static texts and dynamic texts are set  in the windo

  • RSPAN Broadcast, impact network intermitten

    HI All, I've configured RSPAN on the customer network. The impact is, there's a network intermitten on the customer network. And the source problem is broadcast traffic from the destination port on the RSPAN. Is anyone found out broadcast problem whi

  • Getting pcs:foreach to iterate a Javascript array

    Dear Experts, I've got a selection list in a content item, and I can happily use <pcs:foreach> to iterate over it. So now, I would like to add an additional item to that which the user has selected, or get rid of some of the items. I have been able t

  • STO with delivery and Billing

    HI, STO with delivery and Billing Material is valuated in MAP When doing PGI system picks the MAP of the issuing batch and this is what SAP provided Nw we need to transfer(PGI) @ the purchase price of the material in the supplying plant How to config