Fix install options
This commit is contained in:
parent
ce4bf5ea95
commit
5be2abe9cc
4 changed files with 34 additions and 18 deletions
|
|
@ -23,15 +23,11 @@ Optional:
|
|||
wget http://zawz.net/zpkg/install.sh
|
||||
sh install.sh
|
||||
```
|
||||
> By default the config is installed to /etc/zpkg
|
||||
> By default the config is installed to /etc/zpkg.
|
||||
> This can be changed with the -c option
|
||||
|
||||
If you wish to use another repository, substitute `zawz.net/zpkg` for your desired target
|
||||
|
||||
|
||||
#### Installing to a custom location
|
||||
|
||||
Add the -c option to the install script to specify a custom config path for the install
|
||||
|
||||
### Uninstalling
|
||||
|
||||
```shell
|
||||
|
|
|
|||
|
|
@ -4,10 +4,11 @@
|
|||
|
||||
ssh="$SSH_USER@$SSH_ADDR"
|
||||
|
||||
DIR=tmp
|
||||
PKG=zpkg
|
||||
DEST=/usr/local/bin
|
||||
BASHDEST=/etc/bash_completion.d
|
||||
|
||||
random_string()
|
||||
{
|
||||
tr -cd '[:alnum:]' < /dev/urandom | head -c$1
|
||||
}
|
||||
|
||||
# build
|
||||
./compile.sh || exit $?
|
||||
|
|
@ -16,7 +17,11 @@ BASHDEST=/etc/bash_completion.d
|
|||
ssh "$ssh" mkdir -p "$PKG_PATH" || exit $?
|
||||
scp .config server_scripts/* "$ssh":~/ || exit $?
|
||||
|
||||
fullpath="$DIR/$PKG/ROOT"
|
||||
PKG=zpkg
|
||||
DEST=/usr/local/bin
|
||||
BASHDEST=/etc/bash_completion.d
|
||||
tmpdir="/tmp/zpkg$(random_string 5)"
|
||||
fullpath="$tmpdir/$PKG/ROOT"
|
||||
# setup package sources
|
||||
mkdir -p "$fullpath$DEST" || exit $?
|
||||
mkdir -p "$fullpath$BASHDEST" || exit $?
|
||||
|
|
@ -24,13 +29,13 @@ cp completion/zpkg.bash "$fullpath$BASHDEST" || exit $?
|
|||
mv zpkg "$fullpath$DEST" || exit $?
|
||||
# create and send package
|
||||
(
|
||||
cd tmp/zpkg || exit $?
|
||||
cd "$tmpdir/$PKG" || exit $?
|
||||
tar -cvJf zpkg.tar.xz * || exit $?
|
||||
# send package
|
||||
scp zpkg.tar.xz "$ssh":~/"$PKG_PATH" || exit $?
|
||||
)
|
||||
# cleanup
|
||||
rm -rd "$DIR"
|
||||
rm -rd "$tmpdir"
|
||||
# update database
|
||||
ssh "$ssh" sh database_update.sh || exit $?
|
||||
# generate install script
|
||||
|
|
|
|||
|
|
@ -11,6 +11,20 @@ cat .config >> install.sh
|
|||
# body
|
||||
echo '
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "$(basename "$0")" [option...]
|
||||
echo "
|
||||
Options:
|
||||
-h Show this help message
|
||||
-c <path> Use this path as config"
|
||||
}
|
||||
|
||||
random_string()
|
||||
{
|
||||
tr -cd '[:alnum:]' < /dev/urandom | head -c$1
|
||||
}
|
||||
|
||||
config_path=/etc/zpkg
|
||||
|
||||
while getopts ":hc:" opt;
|
||||
|
|
@ -51,22 +65,23 @@ sudo mkdir -p "$config_path" || exit $?
|
|||
sudo mv zpkg.conf "$config_path" || exit $?
|
||||
|
||||
# download zpkg
|
||||
mkdir -p tmp || exit $?
|
||||
tmpdir=/tmp/zpkg$(random_string 5)
|
||||
mkdir -p "$tmpdir" || exit $?
|
||||
(
|
||||
cd tmp || exit $?
|
||||
cd "$tmpdir" || exit $?
|
||||
if ! wget "$HTTP_ADDR/$HTTP_PATH/zpkg.tar.xz" -q -O "zpkg.tar.xz"
|
||||
then
|
||||
echo "Cannot reach $HTTP_ADDR/$HTTP_PATH" > /dev/stderr
|
||||
exit 1
|
||||
fi
|
||||
tar xf zpkg.tar.xz || exit $?
|
||||
tar -xf zpkg.tar.xz || exit $?
|
||||
|
||||
# install zpkg package
|
||||
ROOT/usr/local/bin/zpkg install zpkg || exit $?
|
||||
)
|
||||
|
||||
# cleanup
|
||||
rm -rd tmp || exit $?
|
||||
rm -rd "$tmpdir" || exit $?
|
||||
zpkg update-database >/dev/null || exit $?
|
||||
|
||||
' >> install.sh
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ Admin operations:
|
|||
Options:
|
||||
-h Display this help
|
||||
-c <path> Custom config path
|
||||
-f Force run when root
|
||||
-f Force running even when root
|
||||
'
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue