OSDN Git Service

get that codacy coverage
authorpaperbenni <paperbenni@gmail.com>
Sat, 29 Feb 2020 23:28:42 +0000 (00:28 +0100)
committerpaperbenni <paperbenni@gmail.com>
Sat, 29 Feb 2020 23:28:42 +0000 (00:28 +0100)
README.md
autostart.sh
depend.sh
install.sh
monitor.sh
rootinstall.sh
status.sh

index e5fdfa6..07328f6 100644 (file)
--- a/README.md
+++ b/README.md
@@ -14,4 +14,4 @@ instantOS is a manjaro based distro that works out of the box but is still aimed
 Everything is lightning fast and works out of the box. 
 
 --------
-### instantOS is still in early beta, contributions always welcome
+## instantOS is still in early beta, contributions always welcome
index fc1f52f..8d9a808 100755 (executable)
@@ -113,7 +113,7 @@ if [ -z "$ISLIVE" ]; then
                esac
        fi
 
-       cat /usr/share/instantwidgets/tooltips.txt | shuf | head -1 >~/.cache/tooltip
+       shuf /usr/share/instantwidgets/tooltips.txt | head -1 >~/.cache/tooltip
        conky -c /usr/share/instantwidgets/tooltips.conf &
 
 else
index b69add0..e699938 100755 (executable)
--- a/depend.sh
+++ b/depend.sh
@@ -2,7 +2,7 @@
 
 # installs dependencies for instantOS
 
-LINK="https://raw.githubusercontent.com/instantos/instantos/master"
+export LINK="https://raw.githubusercontent.com/instantos/instantos/master"
 
 # install on arch based system
 pacinstall() {
index aa6ff22..c79b3a1 100755 (executable)
@@ -12,7 +12,7 @@ fi
 
 RAW="https://raw.githubusercontent.com"
 
-if cat /etc/os-release | grep -Eiq 'name.*(arch|manjaro)'; then
+if grep -Eiq 'name.*(arch|manjaro)' /etc/os-release; then
     curl -s "$RAW/instantOS/instantLOGO/master/ascii.txt"
     echo ""
 else
@@ -32,7 +32,7 @@ userrun() {
     curl -s "$1" >/tmp/instantinstall.sh
     chmod 777 /tmp/instantinstall.sh
 
-    if [ -n "$2" ] && getent passwd $2 && [ -e /home/$2 ]; then
+    if [ -n "$2" ] && getent passwd "$2" && [ -e /home/"$2" ]; then
         echo "single user installation for $1"
         sudo su "$2" -c /tmp/instantinstall.sh
     else
index ee02096..dc18501 100755 (executable)
@@ -8,7 +8,7 @@ mkdir -p ~/instantos/monitor &>/dev/null
 cd ~/instantos/monitor
 
 xrandr | grep '[^s]connected' | grep -o '[0-9]*x[0-9]*+[0-9]*' | grep -o '[0-9]*$' >positions.txt
-AMOUNT=$(cat positions.txt | wc -l)
+AMOUNT=$(wc -l <positions.txt)
 
 # get monitor with highest resolution
 RESOLUTIONS=$(xrandr | grep '[^s]connected' | grep -Eo '[0-9]{1,}x[0-9]{1,}\+[0-9]{1,}\+[0-9]{1,}' |
@@ -23,12 +23,12 @@ if ! [ "$RESOLUTIONS" = "$OLDRES" ]; then
     echo "Resolution change detected"
 fi
 
-if [ $(cat resolutions.txt | sort -u | wc -l) = "1" ]; then
+if [ $(sort -u resolutions.txt | wc -l) = "1" ]; then
     echo "resolutions identical"
     head -1 resolutions.txt >max.txt
 else
-    let PIXELS1="$(head -1 resolutions.txt | grep -o '^[0-9]*') * $(cat resolutions.txt | head -1 | grep -o '[0-9]*$')"
-    let PIXELS2="$(tail -1 resolutions.txt | grep -o '^[0-9]*') * $(cat resolutions.txt | head -1 | grep -o '[0-9]*$')"
+    let PIXELS1="$(head -1 resolutions.txt | grep -o '^[0-9]*') * $(head -1 resolutions.txt | grep -o '[0-9]*$')"
+    let PIXELS2="$(tail -1 resolutions.txt | grep -o '^[0-9]*') * $(head -1 resolutions.txt | grep -o '[0-9]*$')"
     if [ "$PIXELS1" -gt "$PIXELS2" ]; then
         head -1 resolutions.txt >max.txt
     else
index cd66ffe..c405523 100755 (executable)
@@ -16,7 +16,7 @@ ugroup() {
     groupadd "$1" &>/dev/null
     for USER in $(ls /home/ | grep -v '+'); do
         if ! sudo su "$USER" -c groups | grep -Eq " $1|$1 "; then
-            sudo gpasswd -a $USER $1
+            sudo gpasswd -a "$USER" "$1"
         fi
     done
 }
index 198ef7f..50ed56c 100755 (executable)
--- a/status.sh
+++ b/status.sh
@@ -32,7 +32,7 @@ while :; do
             else
                 BATTERY="B"$(egrep -o '[0-9]*%' <<<"$TMPBAT")
                 # make indicator red on low battery
-                if [ $(grep '[0-9]*' <<<$BATTERY) -lt 10 ]; then
+                if [ $(grep '[0-9]*' <<<"$BATTERY") -lt 10 ]; then
                     BATTERY="^c#ff0000^$BATTERY^d^"
                 fi
             fi