1
0
mirror of https://github.com/elisspace/rtinst.git synced 2026-08-29 15:44:06 +00:00
* Update rtsetup

* Update rtsetup

* Update rtsetup

* Update rtsetup

* Delete rtgetscripts

* Update rtversion

* Update rtinst

* Update rtsetup

* Update rtsetup

* Update rtsetup
This commit is contained in:
arakasi72
2017-08-17 11:08:18 +01:00
committed by GitHub
parent cf266ca2d9
commit 0a511bdbfe
4 changed files with 31 additions and 69 deletions

26
rtsetup
View File

@@ -13,6 +13,19 @@ PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
rundir=$(dirname $(readlink -f $0))
branch=$1
# function to ask user for y/n response
ask_user(){
local answer
while true
do
read answer
case $answer in [Yy]* ) return 0 ;;
[Nn]* ) return 1 ;;
* ) echo "Enter y or n";;
esac
done
}
if [ "$(id -u)" != "0" ]; then
echo "Must be run as root, directly or with sudo"
exit 1
@@ -34,6 +47,19 @@ if [ -d /etc/rtinst ] && [ -z $branch ]; then
branch=$(basename "$(git symbolic-ref -q HEAD)")
if [ -z $branch ]; then
branch=$(git describe --tags --exact-match)
if [ ${branch:0:1} = v ]; then
latest=$(basename "$(git ls-remote --tags https://github.com/arakasi72/rtinst.git | grep -o 'refs/tags/v.*' | sort -V | tail -1)")
if [ $branch != $latest ]; then
echo "Updating from $branch to $latest"
branch=$latest
else
echo "Already using the latest version, rtinst $branch"
echo -n "Do you wish to reinstall rtinst y/n? "
if ! ask_user; then
exit
fi
fi
fi
fi
if [ $(git ls-remote --tags --heads https://github.com/arakasi72/rtinst.git $branch | wc -l) -eq 0 ]; then
echo "$branch has been deleted, using latest numbered release instead"

View File

@@ -1,65 +0,0 @@
#!/bin/bash
######################################################################
#
# Copyright (c) 2015 arakasi72 (https://github.com/arakasi72)
#
# --> Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
#
######################################################################
PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
if [ "$(id -u)" != "0" ]; then
echo "Must be run as root, directly or with sudo"
exit 1
fi
if [ ! -d /etc/rtinst ]; then
git clone https://github.com/arakasi72/rtinst.git /etc/rtinst
fi
cd /etc/rtinst
branch=$(basename "$(git symbolic-ref -q HEAD)")
# if branch is empty then it is a tag
if [ -z $branch ]; then
branch=$(git describe --tags --exact-match)
if [ ${branch:0:1} = v ]; then
latest=$(basename "$(git ls-remote --tags https://github.com/arakasi72/rtinst.git | grep -o 'refs/tags/v.*' | sort -V | tail -1)")
if [ $branch = $latest ]; then
echo "Already using the latest release: $branch"
exit
fi
# update to latest release
echo "rtinst updating from $branch to $latest"
cd
rm -fr /etc/rtinst
git clone -q https://github.com/arakasi72/rtinst.git /etc/rtinst
cd /etc/rtinst
git checkout -q $latest
branch=$(git describe --tags --exact-match)
echo "rtinst $branch installed"
cd
ln -sf /etc/rtinst/scripts/* /usr/local/bin
ln -sf /etc/rtinst/rtsetup /usr/local/bin
exit
else
echo "$branch is not a branch, or a numbered release"
echo "Run rtsetup if you want to switch to another build"
exit
fi
fi
if [ $(git ls-remote --heads https://github.com/arakasi72/rtinst.git $branch | wc -l) -eq 0 ]; then
echo "$branch no longer appears to exist"
echo "run rtsetup to reset branch"
else
git fetch --all
git reset --hard origin/$branch > /dev/null 2>&1
git pull origin $branch
ln -sf /etc/rtinst/scripts/* /usr/local/bin
ln -sf /etc/rtinst/rtsetup /usr/local/bin
fi

View File

@@ -52,7 +52,7 @@ portdefault=1
skip_rt=1
sshport=''
rudevflag=0
rudevflag=1
passfile='/etc/nginx/.htpasswd'
package_list="sudo nano autoconf build-essential ca-certificates comerr-dev curl cfv dtach htop irssi libcloog-ppl-dev libcppunit-dev libcurl3 libncurses5-dev libterm-readline-gnu-perl libsigc++-2.0-dev libperl-dev libtool libxml2-dev ncurses-base ncurses-term ntp patch pkg-config $phpver-fpm $phpver $phpver-cli $phpver-dev $phpver-curl $geoipver $phpver-mcrypt $phpver-xmlrpc python-scgi screen subversion texinfo unzip zlib1g-dev libcurl4-openssl-dev mediainfo python-software-properties software-properties-common aptitude $phpver-json nginx-full apache2-utils git libarchive-zip-perl libnet-ssleay-perl libhtml-parser-perl libxml-libxml-perl libjson-perl libjson-xs-perl libxml-libxslt-perl libjson-rpc-perl libarchive-zip-perl"
Install_list=""
@@ -226,7 +226,7 @@ else
fi
# get options
OPTS=$(getopt -n "$0" -o dltryu:p:w: --long "dload,log,ssh-default,rutorrent-stable,force-yes,user:,password:,webpass:" -- "$@")
OPTS=$(getopt -n "$0" -o dltrmyu:p:w: --long "dload,log,ssh-default,rutorrent-stable,rutorrent-master,force-yes,user:,password:,webpass:" -- "$@")
eval set -- "$OPTS"
@@ -236,6 +236,7 @@ while true; do
-l | --log ) logfile="$HOME/rtinst.log"; shift ;;
-t | --ssh-default ) portdefault=0; shift;;
-r | --rutorrent-stable ) rudevflag=1; shift;;
-m | --rutorrent-master ) rudevflag=0; shift;;
-y | --force-yes ) forceyes=0; shift;;
-u | --user ) user="$2"; shift; shift;;
-p | --password ) unixpass="$2"; shift; shift;;

View File

@@ -48,10 +48,10 @@ if [ -z $branch ]; then
if [ $branch = $latest ]; then
echo "This is the latest release"
else
echo "Use rtgetscripts to update to rtinst $latest"
echo "Use rtsetup to update to rtinst $latest"
fi
fi
else
echo "Current Branch: $branch"
echo "Use rtgetscripts to update branch"
echo "Use rtsetup to update branch"
fi