summarylogtreecommitdiffstats
path: root/functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 'functions.sh')
-rw-r--r--functions.sh73
1 files changed, 35 insertions, 38 deletions
diff --git a/functions.sh b/functions.sh
index dcac4f3ad1c0..39082286b739 100644
--- a/functions.sh
+++ b/functions.sh
@@ -1,48 +1,45 @@
#!/usr/bin/env bash
-function changePath(){
- # check the groups of the current loggedin users
- groups | grep -q -E '(\s|^)jdownloader(\s|$)' >/dev/null
- if [ "$?" -eq 0 ] || isRoot ; then
- export JD_SCOPE="global"
- echo "[global JDownloader scope]"
- umask u=rwx,g=rwx,o=rx
- cd '/opt/JDownloader'
- else
- export JD_SCOPE="user"
- echo "[user JDownloader scope]"
- mkdir -p "${HOME}/.jd"
- cd "${HOME}/.jd"
- fi
+function changePath() {
+ # check the groups of the current loggedin users
+ groups | grep -q -E '(\s|^)jdownloader(\s|$)' >/dev/null
+ if [ "$?" -eq 0 ] || isRoot ; then
+ export JD_SCOPE="global"
+ echo "[global JDownloader scope]"
+ umask u=rwx,g=rwx,o=rx
+ cd '/opt/JDownloader'
+ else
+ export JD_SCOPE="user"
+ echo "[user JDownloader scope]"
+ mkdir -p "${HOME}/.jd"
+ cd "${HOME}/.jd"
+ fi
}
-function changeUser(){
- if isRoot ; then
- #restart as user jdownloader
- echo "changing to user \"jdownloader\""
- runuser jdownloader -c "/bin/bash $0 $@" -s /bin/bash
- exit $?
- fi
-
+function changeUser() {
+ if isRoot; then
+ # restart as user jdownloader
+ echo "changing to user \"jdownloader\""
+ runuser jdownloader -c "/bin/bash $0 $@" -s /bin/bash
+ exit $?
+ fi
}
-function isRoot(){
- if [ "$(id -u)" -eq "0" ]; then
- return 0
- fi
- return 2
+function isRoot() {
+ if [ "$(id -u)" -eq "0" ]; then
+ return 0
+ fi
+ return 2
}
-
-function downloadJDownloader(){
- changePath
- if [ ! -f "JDownloader.jar" ]; then
- wget -O JDownloader.jar http://installer.jdownloader.org/JDownloader.jar
- if [ $? -ne 0 ]; then
- echo "Cannot download Jdownloader!"
- exit 2
- fi
- fi
+function downloadJDownloader() {
+ changePath
+ if [ ! -f "JDownloader.jar" ]; then
+ if ! curl -o JDownloader.jar https://installer.jdownloader.org/JDownloader.jar; then
+ echo "Cannot download JDownloader!"
+ exit 2
+ fi
+ fi
}
-LOGFILE="JDownloader.service.log"
+LOGFILE="JDownloader.service.log"