Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have modified an already available wrapper to execute the process in a safer manner. The containing script cat-s the body into an executable script under /usr/bin/.


#!/bin/bash

# dpkg-url #

color= reset=
if [[ -t 1 ]]; then
color=$(tput setaf 6)
reset=$(tput sgr0);
fi

echo "${color}Adding 'dpkg-url' command alias..."${reset}

cat > /usr/bin/dpkg-url << 'FILE'
#!/bin/bash

# dpkg-url #

COUNT=0

for package in "${urls[@]}"; do
    if [[ $package = *http* ]]; then 
    urls+=("$package")
    fi

    dpkg_url="$dpkg_url "$package""
done

# Remove beginning and trailing spaces #

url=$(echo "$url" | sed -e 's/^ //g' -e 's/ $//g')

if [[ ! -z "$url" ]]; then
    directory=$(mktemp -d);
        trap 'rm -rf "$directory"' EXIT

    cd "$directory" || exit
        for package in "$url"; do
            wget ""$package""
        done
    dpkg $dpkg_url "$directory"/*.deb
else
    dpkg $dpkg_url
fi
FILE

sudo chmod +x /usr/bin/dpkg-url

exit

When calling the command I end up getting this error:

dpkg: error: need an action option

Type dpkg --help for help about installing and deinstalling packages [*];
Use `dselect' or `aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;

Options marked [*] produce a lot of output - pipe it through `less' or `more' !

Any help would be appreciated. Thanks

share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.