Skip to content

Commit b1af1d7

Browse files
committed
Add argument for custom invidious repo/fork
- Added argument for custom invidious repo/fork with [ -r | --repo user/invidious ]
1 parent 2bc9796 commit b1af1d7

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ SWAP_OPTIONS=n \
7676
- For Captcha key, add `CAPTCHA_KEY=YOUR_CAPTCHA_KEY \` to options.
7777
- PostgreSQL password will be auto-generated.
7878
- For verbose output, use [ -v ] argument
79+
- Use a custom invidious repo/fork with [ -r | --repo user/invidious ]
7980
- installation log in invidious_installer.log
8081
- [./src/slib.sh](https://github.com/tmiland/invidious-installer/blob/main/src/slib.sh) function script is sourced remotely if not found locally
8182
- This script is a combination of functions for spinners, colors and logging

invidious_installer.sh

+20-4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ ARROW='➜'
5858
#WARNING='⚠'
5959
# Repo name
6060
REPO_NAME="tmiland/invidious-installer"
61+
# Invidious repo name
62+
IN_REPO=${IN_REPO:-iv-org/invidious}
6163
# Set username
6264
USER_NAME=invidious
6365
# Set userdir
@@ -108,10 +110,13 @@ usage() {
108110
printf " ${YELLOW}--help|-h${NORMAL} display this help and exit\\n"
109111
printf " ${YELLOW}--verbose|-v${NORMAL} increase verbosity\\n"
110112
printf " ${YELLOW}--banners|-b${NORMAL} disable banners\\n"
113+
printf " ${YELLOW}--repo|-r${NORMAL} select custom repo. E.G: user/invidious\\n"
111114
echo
112115
}
113116

114-
while [ $# != 0 ]; do
117+
POSITIONAL_ARGS=()
118+
119+
while [[ $# -gt 0 ]]; do
115120
case $1 in
116121
--help | -h)
117122
usage
@@ -125,18 +130,29 @@ while [ $# != 0 ]; do
125130
shift
126131
BANNERS=0
127132
;;
133+
--repo | -r) # Bash Space-Separated (e.g., --option argument)
134+
IN_REPO="$2" # Source: https://stackoverflow.com/a/14203146
135+
shift # past argument
136+
shift # past value
137+
;;
128138
--uninstall | -u)
129139
shift
130140
mode="uninstall"
131141
;;
132-
*)
142+
-*|--*)
133143
printf "Unrecognized option: $1\\n\\n"
134144
usage
135145
exit 1
136146
;;
147+
*)
148+
POSITIONAL_ARGS+=("$1") # save positional arg
149+
shift # past argument
150+
;;
137151
esac
138152
done
139153

154+
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
155+
140156
# Include functions
141157
if [[ -f ./src/slib.sh ]]; then
142158
. ./src/slib.sh
@@ -992,9 +1008,9 @@ fi
9921008
(
9931009
cd $USER_DIR >>"${RUN_LOG}" 2>&1 || exit 1
9941010

995-
log_debug "Downloading Invidious from GitHub"
1011+
log_debug "Download Invidious from github.com/${IN_REPO}"
9961012
run_ok "sudo -i -u invidious \
997-
git clone https://github.com/iv-org/invidious" "Cloning Invidious from GitHub"
1013+
git clone https://github.com/${IN_REPO}" "Cloning Invidious from github.com/${IN_REPO}"
9981014
cd - 1>/dev/null 2>&1 || exit 1
9991015
)
10001016
fi

0 commit comments

Comments
 (0)