#!/bin/bash # This is a script that can install, remove and update packages from source using only one command # Version: 0.1BETA # License: GPLv2 smver=0.1BETA pkgname=$2 prefix=/usr/bin # Functions - start function install { cd /var/sourcemake wget http://code-geek.baah.dk/sourcemake/packages/stable/$pkgname-*.tar.gz tar xvfz $pkgname-*.tar.gz cd /$pkgname-* ./configure --prefix=$prefix make || return 1 make install echo "If no errors come up here, the application is installed! :)" } function remove { cd /var/sourcemake/$pkgname-* make clean cd .. rm -R /$pkgname-* echo "If no errors are shown, the application has been removed! :)" } function update { cd /var/sourcemake/$pkgname-* make clean cd .. wget http://code-geek.baah.dk/sourcemake/packages/stable/$pkgname-*.tar.gz tar xvfz $pkgname-*.tar.gz cd /$pkgname-* ./configure --prefix=$prefix make || return 1 make install echo "If no errors are shown, the application has been updated to the newest version on this server! :)" } function about { echo "About Sourcemake:" echo "" echo "Name: Sourcemake" echo "Version: $smver" echo "Started by: Kris " echo "License: GPLv2" echo "" } function help { echo "Sourcemake help:" echo "" echo "Install: sourcemake install " echo "Remove: sourcemake remove " echo "Update: sourcemake update " echo "" echo "About: sourcemake about" echo "Help: sourcemake help" echo "" } # Functions - end # Install, remove, update, about and help - start if [ "$1" == "install" ] && [ "$pkgname" != "" ]; then install elif [ "$1" == "remove" ] && [ "$pkgname" != "" ]; then remove elif [ "$1" == "update" ] && [ "$pkgname" != "" ]; then update elif [ "$1" == "about" ]; then about elif [ "$1" == "help" ]; then help else help fi # Install, remove, update, about and help - end # End of script