Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helpmessage from ln when used without parameter or with --help #47

Open
emdete opened this issue Sep 12, 2016 · 0 comments
Open

helpmessage from ln when used without parameter or with --help #47

emdete opened this issue Sep 12, 2016 · 0 comments

Comments

@emdete
Copy link

emdete commented Sep 12, 2016

i added some checks to solve it:

#!/bin/sh -e
# xdowngrade PKGS.xbps... - install XBPS package directly from .xbps file
help() {
    echo "Install XBPS package directly from .xbps file."
    echo "usage: $0 PKGS.xbps ..."
    rm -r $T
    exit 0
}
T=$(mktemp --tmpdir -d xdowngrade-$(date -I).XXXXXXXX)
pkg=
for f; do
    case $f in
        *.xbps)
            ln -s -r -t $T/ "$f"
            f=${f##*/}
            f=${f%.*.*}
            pkg="$pkg ${f%-*}"
        ;;
        *)
            echo "Wrong argument $f."
            help
        ;;
    esac
done
if [ ! -z "$pkg" ]; then
    xbps-rindex -a $T/*
    xbps-install -i -R $T -f $pkg
else
    help
fi
rm -r $T
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant