squidpm

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

commit ae2aff991f869a039d4b107628d9dfee8f52e895
parent 6d17b7579681598ed6deb9977a94388aa8408762
Author: Josh Moore <jxm5210@rit.edu>
Date:   Tue, 14 Jan 2020 18:19:12 -0500

Remove root requirement from main script

Diffstat:
MREADME.md | 14+++++++-------
Mpackages/direwolf | 2+-
Mpackages/squidpm | 8++++----
Msquidpm.sh | 9++-------
4 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/README.md b/README.md @@ -8,17 +8,17 @@ To install squidpm for the first time, run these commands: ``` git clone https://github.com/joshiemoore/squidpm.git cd squidpm -sudo ./squidpm.sh install squidpm +./squidpm.sh install squidpm ``` -This will create all the symlinks necessary to run squidpm. After that, you will be able to simply run `sudo squidpm <operation> [package]` to perform package management operations. Note that all packages will be downloaded to the `squidpm/repos/` directory, so be sure to clone this repository in a location that has enough free space for what you're trying to do. +This will create all the symlinks necessary to run squidpm. After that, you will be able to simply run `squidpm <operation> [package]` to perform package management operations. Note that all packages will be downloaded to the `squidpm/repos/` directory, so be sure to clone this repository in a location that has enough free space for what you're trying to do. ### Operations Here is a list of currently supported operations. -* `install <package>` - Install a package. Look in the `packages/` directory to see which packages are currently available. -* `uninstall <package>` - Uninstall a package. -* `update <package>` - Download/install updates for a package. -* `check <package>` - Returns exit code 1 if \<package\> is installed, 0 otherwise. -* `list` - Print a list of currently installed squidpm packages. +* `squidpm install <package>` - Install a package. Look in the `packages/` directory to see which packages are currently available. +* `squidpm uninstall <package>` - Uninstall a package. +* `squidpm update <package>` - Download/install updates for a package. +* `squidpm check <package>` - Returns exit code 1 if \<package\> is installed, 0 otherwise. +* `squidpm list` - Print a list of currently installed squidpm packages. The `all` package is a special target that lets you perform the selected operation on all available packages. There is no confirmation, and squidpm really will update/uninstall all installed packages or install all packages in the squidpm repository, so make sure you really want to do what you're doing! diff --git a/packages/direwolf b/packages/direwolf @@ -17,7 +17,7 @@ if [ $1 == "install" ]; then # installation behavior for this package make - make install + sudo make install make install-conf echo "Installed direwolf." elif [ $1 == "uninstall" ]; then diff --git a/packages/squidpm b/packages/squidpm @@ -13,16 +13,16 @@ cd $mydir/../ if [ $1 == "install" ]; then # installation behavior for this package # create symlinks - ln -s $PWD/squidpm.sh /usr/bin/squidpm - ln -s $PWD $PWD/repos/squidpm + sudo ln -s $PWD/squidpm.sh /usr/bin/squidpm + sudo ln -s $PWD $PWD/repos/squidpm echo "Installed squidpm!" elif [ $1 == "uninstall" ]; then # uninstallation behavior for this package # remove symlinks - rm /usr/bin/squidpm - rm $PWD/repos/squidpm + sudo rm /usr/bin/squidpm + sudo rm $PWD/repos/squidpm echo "Uninstalled squidpm." elif [ $1 == "update" ]; then diff --git a/squidpm.sh b/squidpm.sh @@ -27,12 +27,6 @@ if [ "$#" -gt 2 ]; then exit fi -# make sure the user is root -if [[ $EUID > 0 ]]; then - echo "This operation requires root." - exit -fi - # resolve the actual squidpm directory SPMDIR=$(dirname $(readlink -f "$0")) @@ -87,7 +81,8 @@ elif [ $1 == "update" ]; then /bin/sh $SPMDIR/packages/$2 update elif [ $1 == "check" ]; then # check whether the package is installed - if [[ -d $SPMDIR/repos/$2 ]]; then + +if [[ -d $SPMDIR/repos/$2 ]]; then exit 1 else exit 0