summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorskydrome2020-02-14 03:53:56 -0500
committerskydrome2020-02-14 03:53:56 -0500
commit2efe6e93d481f959490e37777f54903483019a1b (patch)
treecd71463da5301addc391ec25a070f4cca8f92f47
parentca3feb88578d2c30c38d5c5f4a1b77f3061f34e7 (diff)
downloadaur-2efe6e93d481f959490e37777f54903483019a1b.tar.gz
shell script linting r2
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD4
-rw-r--r--i2p.tmpfiles1
-rw-r--r--i2prouter.sh38
4 files changed, 18 insertions, 29 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 83becde1aa5d..720cf72821c3 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -28,11 +28,11 @@ pkgbase = i2p-bin
sha256sums = SKIP
sha256sums = 925d931aae2bd03c08555536b1c836654a72cc4acfd9f440f1ad43958ba2108d
sha256sums = 644b771ec7f5db3efab3206bf1f896566cdb00d410a54608fda85bdb4c2ad876
- sha256sums = df26da04c8415ac24ec73b0dd08d3459a8964553bb77e5da5ab9833b0a31d865
+ sha256sums = fc30dd32f48fe1c93bf36c8297ca48203a1479e4e221ebe62c57cf3c3c0347d3
sha256sums = 5d134ee5bc614b54ec48de7c5214f6dbe08abcfab7d286c5b1c7616e39b478ed
sha256sums = 7a4688db826c3dddb762976cd8c9a5d465255c3577069243d8e5af941a4126e2
sha256sums = 7a19b9f90c8792460fd58e8b8aa435a065e34d29a942479850472510e9d3078a
- sha256sums = 7e94bcd530161251f99cdc033fbbaad0a07f3dac02ebd318edb08580ea500160
+ sha256sums = 8d39f080c7a2e49226db3a785f3e18583159ef2f95e1ab467fd9984c4e38c9f5
sha256sums = 77e359cf880ccc09f504372ef85c8ad3ab7d1186106a4ae92c4ff4f37ae650e0
pkgname = i2p-bin
diff --git a/PKGBUILD b/PKGBUILD
index 0ae87b1460e2..3f311ea42913 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -33,11 +33,11 @@ sha256sums=('265729c1d676939bc81f96689b72c5f413083f4bbd849393f7629db05523d238'
'SKIP'
'925d931aae2bd03c08555536b1c836654a72cc4acfd9f440f1ad43958ba2108d'
'644b771ec7f5db3efab3206bf1f896566cdb00d410a54608fda85bdb4c2ad876'
- 'df26da04c8415ac24ec73b0dd08d3459a8964553bb77e5da5ab9833b0a31d865'
+ 'fc30dd32f48fe1c93bf36c8297ca48203a1479e4e221ebe62c57cf3c3c0347d3'
'5d134ee5bc614b54ec48de7c5214f6dbe08abcfab7d286c5b1c7616e39b478ed'
'7a4688db826c3dddb762976cd8c9a5d465255c3577069243d8e5af941a4126e2'
'7a19b9f90c8792460fd58e8b8aa435a065e34d29a942479850472510e9d3078a'
- '7e94bcd530161251f99cdc033fbbaad0a07f3dac02ebd318edb08580ea500160'
+ '8d39f080c7a2e49226db3a785f3e18583159ef2f95e1ab467fd9984c4e38c9f5'
'77e359cf880ccc09f504372ef85c8ad3ab7d1186106a4ae92c4ff4f37ae650e0')
package() {
diff --git a/i2p.tmpfiles b/i2p.tmpfiles
index 15085d2b2d37..3e0d7985311f 100644
--- a/i2p.tmpfiles
+++ b/i2p.tmpfiles
@@ -2,3 +2,4 @@ d /run/i2p 0700 i2p i2p
d /opt/i2p 0755 i2p i2p
d /opt/i2p/.i2p 0700 i2p i2p
d /opt/i2p/.tmp 0700 i2p i2p
+f /opt/i2p/i2prouter 0754 root i2p
diff --git a/i2prouter.sh b/i2prouter.sh
index e57d880d71b0..3ab76a88aa4f 100644
--- a/i2prouter.sh
+++ b/i2prouter.sh
@@ -19,22 +19,19 @@ debug() {
check_user() {
if [[ "$(id -un)" != "$I2P_USER" ]]; then
#debug "current user: $(id -un) dropping to user: $I2P_USER"
- #chmod 700 /opt/i2p/.{i2p,tmp}
SCRIPT_PATH="$(cd "$(dirname $0)" && pwd)/$(basename $0)"
- su - "$I2P_USER" -c "${SCRIPT_PATH}" "$@"
+ su - "$I2P_USER" -c "${SCRIPT_PATH} $@"
exit $?
fi
}
init_vars() {
+ [[ "$EUID" -eq 0 ]] &&
+ fail "Attempting to start as root! You should never see this message, please report it"
[[ ! -r "$WRAPPER_CONF" ]] &&
fail "Unable to read \$WRAPPER_CONF: ${WRAPPER_CONF}"
[[ ! -x "$WRAPPER_CMD" ]] &&
fail "Unable to find or execute \$WRAPPER_CMD: ${WRAPPER_CMD}"
- [[ ! $(grep -E ^I2P_USER $0) && "$EUID" = "0" ]] &&
- fail "Attempting to start as root! Please edit $(basename $0) and set the variable \$I2P_USER"
- [[ "$(id -un "$I2P_USER")" != "$I2P_USER" ]] &&
- fail "\$I2P_USER does not exist: $I2P_USER"
COMMAND_LINE="\"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"i2prouter\" wrapper.name=\"i2prouter\" TZ=UTC"
}
@@ -58,7 +55,7 @@ check_if_running() {
rm -f "$PIDFILE"
fi
else
- [[ "$pid" != "$(get_pid)" ]] &&
+ [[ "$pid" -ne "$(get_pid)" ]] &&
fail "\$PIDFILE $PIDFILE differs from what is actually running!"
fi
else
@@ -82,14 +79,14 @@ _start() {
COMMAND_LINE+=" wrapper.daemonize=TRUE"
eval "$COMMAND_LINE" || fail "Failed to launch the wrapper!"
i=0
- while [[ ! "$pid" || $i < $TIMEOUT ]]; do
+ while [[ ! "$pid" || $i -lt $TIMEOUT ]]; do
echo -n "."
sleep 1
check_if_running
((i++))
done
[[ $(get_pid) ]] &&
- echo " done (pid $pid)" || fail "timeout: Failed to start wrapper!"
+ echo " done" || fail "timeout: Failed to start wrapper!"
else
echo "I2P Router is already running! (pid: $pid)"
fi
@@ -105,18 +102,14 @@ _stop() {
echo -n "Hard shutdown initiated"
kill -TERM "$pid" || fail "Unable to stop I2P Router: kill -TERM $pid"
i=0
- while [[ "$pid" || $i > $TIMEOUT ]]; do
+ while [[ "$pid" || $i -gt $TIMEOUT ]]; do
echo -n "."
sleep 1
[[ ! $(get_pid) ]] && unset pid
((i++))
done
- if [[ "$pid" ]]; then
- fail "timeout: Failed to stop wrapper! (pid: $pid)"
- else
- echo " done"
- #[[ "$1" = 'start' ]] && _start
- fi
+ [[ "$pid" ]] &&
+ fail "timeout: Failed to stop wrapper! (pid: $pid)" || echo " done"
else
echo "I2P Router is not running."
fi
@@ -133,11 +126,8 @@ _graceful() {
[[ ! $(get_pid) ]] && unset pid
((i++))
done
- if [[ "$pid" ]]; then
- fail "timeout: Took longer than 10m to stop. (pid: $pid)"
- else
- echo " done"
- fi
+ [[ "$pid" ]] &&
+ fail "timeout: Took longer than 10m to stop. (pid: $pid)" || echo " done"
else
echo "I2P Router is not running."
fi
@@ -145,7 +135,6 @@ _graceful() {
_dump() {
if [[ "$pid" ]]; then
- echo "Dumping threads..."
kill -QUIT "$pid" || fail "Failed to dump threads"
echo "Thread Dump is available in wrapper.log"
else
@@ -155,15 +144,14 @@ _dump() {
#-----------------------------------------------------------------------------
[[ "$1" != @(console|start|stop|graceful|restart|dump) ]] && {
- echo "Usage: $(basename $0) [command]"
- echo
+ echo "Usage: $(basename $0) <command>"
echo "Commands:"
echo " console Launch in the current console"
echo " start Start in the background as a daemon process"
echo " stop Stop if running as a daemon or in another console"
echo " graceful Stop gracefully, may take up to 11 minutes for all tunnels to close"
echo " restart Restart the JVM"
- echo " dump Request a Java thread dump if running"
+ echo " dump Request a Java thread dump"
exit
}