squidpm

the squid package manager
git clone git://squid-tech.com/squidpm.git
Log | Files | Refs | README | LICENSE

commit 490a7d5b16a3057a5a64dda72b0ec13fe3aae26a
parent 48d0988bf3c8a9257f00f429e967097a67a80f8b
Author: Josh Moore <jxm5210@rit.edu>
Date:   Wed, 15 Jan 2020 15:58:16 -0500

Add command: help

Diffstat:
Adocs/operations.txt | 12++++++++++++
Msquidpm.sh | 18+++++++++++-------
2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/docs/operations.txt b/docs/operations.txt @@ -0,0 +1,12 @@ +The Squid Package Manager - Operations + +install <package> - Install the package <package>. +uninstall <package> - Uninstall the package <package>. +update <package> - Update the package <package>. +check <package> - Return 1 if <package> is installed, 0 otherwise. +list - Print a list of currently installed packages. +help - Print this message. + +The 'all' package is a special target that performs the selected operation on +all available packages - be careful using it! + diff --git a/squidpm.sh b/squidpm.sh @@ -16,11 +16,15 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +#\TODO clean up commands + +# resolve the actual squidpm directory +SPMDIR=$(dirname $(readlink -f "$0")) if [ "$#" -eq 0 ]; then #\TODO detailed usage message echo "Squid Package Manager" - echo "usage: squidpm <operation> <package>" + echo "usage: squidpm <operation> [package]" exit fi @@ -29,18 +33,18 @@ if [ "$#" -gt 2 ]; then exit fi -# resolve the actual squidpm directory -SPMDIR=$(dirname $(readlink -f "$0")) - if [ "$#" -eq 1 ]; then if [ $1 = "list" ]; then # list all installed packages ls -1 $SPMDIR/repos/ - exit + elif [ $1 = "help" ]; then + # print the help message + cat $SPMDIR/docs/operations.txt else echo "Invalid operation '$1'." - exit fi + + exit fi @@ -83,7 +87,7 @@ elif [ $1 = "update" ]; then /bin/bash $SPMDIR/packages/$2 update elif [ $1 = "check" ]; then # check whether the package is installed - + if [[ -d $SPMDIR/repos/$2 ]]; then exit 1 else