mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-18 19:00:15 +00:00
Merge pull request #1464 from DerDanilo/customgitrepoandbranch
Customgitrepoandbranch
This commit is contained in:
commit
8833815983
2 changed files with 56 additions and 14 deletions
37
README.md
37
README.md
|
@ -62,32 +62,59 @@ even more conveniently.
|
|||
|
||||
## Installation
|
||||
|
||||
**Method 1**
|
||||
### Method 1 (standard)
|
||||
|
||||
```Shell
|
||||
curl -L https://install.pivpn.io | bash
|
||||
```
|
||||
|
||||
**Method 2 (direct link)**
|
||||
### Method 2 (direct link)
|
||||
|
||||
```Shell
|
||||
curl https://raw.githubusercontent.com/pivpn/pivpn/master/auto_install/install.sh | bash
|
||||
```
|
||||
|
||||
**Method 3 (clone repo)**
|
||||
### Method 3 (clone repo)
|
||||
|
||||
```Shell
|
||||
git clone https://github.com/pivpn/pivpn.git
|
||||
bash pivpn/auto_install/install.sh
|
||||
```
|
||||
|
||||
**To install from Test/Development branch**
|
||||
### To install from Test/Development branch
|
||||
|
||||
```shell
|
||||
curl -L https://test.pivpn.io | TESTING= bash
|
||||
```
|
||||
|
||||
### How it works
|
||||
### To install from custom git url and branch (for DEV)
|
||||
|
||||
This is inteded to be used when testing changes during
|
||||
development and **not** for standard installations.
|
||||
Without this the script will always checkout the master branch.
|
||||
|
||||
- Git repo can be pivpn or any other git repo (e.g. a fork).
|
||||
- Git branch can be specified as required
|
||||
|
||||
```shell
|
||||
# Syntax
|
||||
git clone < customgitrepourl >
|
||||
bash pivpn/auto_install/install.sh --giturl < customgitrepourl > --gitbranch < customgitbranch >
|
||||
|
||||
# Example
|
||||
git clone https://github.com/userthatforked/pivpn.git
|
||||
bash pivpn/auto_install/install.sh --giturl https://github.com/userthatforked/pivpn.git --gitbranch myfeaturebranch
|
||||
```
|
||||
|
||||
The unattended setup config also supports a custom giturl and branch.
|
||||
|
||||
```shell
|
||||
pivpnGitUrl="https://github.com/userthatforked/pivpn.git"
|
||||
pivpnGitBranch="myfeaturebranch"
|
||||
```
|
||||
|
||||
|
||||
## How it works
|
||||
|
||||
The script will first update your APT repositories, upgrade packages, and install WireGuard (default) or OpenVPN, which will take some time.
|
||||
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
|
||||
######## VARIABLES #########
|
||||
pivpnGitUrl="https://github.com/pivpn/pivpn.git"
|
||||
#pivpnGitUrl="/home/pi/repos/pivpn"
|
||||
# Uncomment to checkout a custom branch for local pivpn files
|
||||
#pivpnGitBranch="custombranchtocheckout"
|
||||
setupVarsFile="setupVars.conf"
|
||||
setupConfigDir="/etc/pivpn"
|
||||
tempsetupVarsFile="/tmp/setupVars.conf"
|
||||
|
@ -159,6 +160,8 @@ flagsCheck(){
|
|||
"--unattended" ) runUnattended=true; unattendedConfig="${!j}";;
|
||||
"--reconfigure" ) reconfigure=true;;
|
||||
"--show-unsupported-nics" ) showUnsupportedNICs=true;;
|
||||
"--giturl" ) pivpnGitUrl="${!j}";;
|
||||
"--gitbranch" ) pivpnGitBranch="${!j}";;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -1040,7 +1043,7 @@ updateRepo(){
|
|||
echo "::: Repairing an existing installation, not downloading/updating local repos"
|
||||
else
|
||||
# Pull the latest commits
|
||||
echo -n "::: Updating repo in $1..."
|
||||
echo -n "::: Updating repo in ${1} from ${2} ..."
|
||||
### FIXME: Never call rm -rf with a plain variable. Never again as SU!
|
||||
#$SUDO rm -rf "${1}"
|
||||
if test -n "$1"; then
|
||||
|
@ -1051,18 +1054,24 @@ updateRepo(){
|
|||
cd /usr/local/src && \
|
||||
$SUDO git clone -q --depth 1 --no-single-branch "${2}" "${1}" > /dev/null & spinner $!
|
||||
cd "${1}" || exit 1
|
||||
if [ -z "${TESTING+x}" ]; then
|
||||
echo " done!"
|
||||
if [ -n "${pivpnGitBranch}" ]; then
|
||||
echo "::: Checkout branch '${pivpnGitBranch}' from ${2} in ${1}..."
|
||||
${SUDOE} git checkout -q ${pivpnGitBranch}
|
||||
echo "::: Custom branch checkout done!"
|
||||
elif [ -z "${TESTING+x}" ]; then
|
||||
:
|
||||
else
|
||||
${SUDOE} git checkout test
|
||||
echo "::: Checkout branch 'test' from ${2} in ${1}..."
|
||||
${SUDOE} git checkout -q test
|
||||
echo "::: 'test' branch checkout done!"
|
||||
fi
|
||||
echo " done!"
|
||||
fi
|
||||
}
|
||||
|
||||
makeRepo(){
|
||||
# Remove the non-repos interface and clone the interface
|
||||
echo -n "::: Cloning $2 into $1..."
|
||||
echo -n "::: Cloning ${2} into ${1} ..."
|
||||
### FIXME: Never call rm -rf with a plain variable. Never again as SU!
|
||||
#$SUDO rm -rf "${1}"
|
||||
if test -n "$1"; then
|
||||
|
@ -1073,12 +1082,18 @@ makeRepo(){
|
|||
cd /usr/local/src && \
|
||||
$SUDO git clone -q --depth 1 --no-single-branch "${2}" "${1}" > /dev/null & spinner $!
|
||||
cd "${1}" || exit 1
|
||||
if [ -z "${TESTING+x}" ]; then
|
||||
echo " done!"
|
||||
if [ -n "${pivpnGitBranch}" ]; then
|
||||
echo "::: Checkout branch '${pivpnGitBranch}' from ${2} in ${1}..."
|
||||
${SUDOE} git checkout -q ${pivpnGitBranch}
|
||||
echo "::: Custom branch checkout done!"
|
||||
elif [ -z "${TESTING+x}" ]; then
|
||||
:
|
||||
else
|
||||
${SUDOE} git checkout test
|
||||
echo "::: Checkout branch 'test' from ${2} in ${1}..."
|
||||
${SUDOE} git checkout -q test
|
||||
echo "::: 'test' branch checkout done!"
|
||||
fi
|
||||
echo " done!"
|
||||
}
|
||||
|
||||
getGitFiles(){
|
||||
|
|
Loading…
Reference in a new issue