Browse Source

x230: warn if running build or upgrade as root

pull/36/head
Martin Kepplinger 6 years ago
parent
commit
8368dcce31
3 changed files with 13 additions and 0 deletions
  1. +4
    -0
      x230/build.sh
  2. +5
    -0
      x230/skulls_common.sh
  3. +4
    -0
      x230/upgrade.sh

+ 4
- 0
x230/build.sh View File

@ -1,3 +1,7 @@
#!/bin/bash #!/bin/bash
. skulls_common.sh
warn_not_root
cd .. cd ..
./build.sh --clean-slate --commit $(ls -1 x230/config-* | cut -c 13-22) x230 ./build.sh --clean-slate --commit $(ls -1 x230/config-* | cut -c 13-22) x230

+ 5
- 0
x230/skulls_common.sh View File

@ -43,3 +43,8 @@ check_battery() {
fi fi
} }
warn_not_root() {
if [[ $EUID -eq 0 ]]; then
echo -e "${RED}This script should not be run as root!${NC}"
fi
}

+ 4
- 0
x230/upgrade.sh View File

@ -7,6 +7,8 @@ NC='\033[0m'
set -e set -e
. skulls_common.sh
usage() usage()
{ {
echo "Skulls for the X230" echo "Skulls for the X230"
@ -43,6 +45,8 @@ do
shift shift
done done
warn_not_root
command -v curl >/dev/null 2>&1 || { echo -e >&2 "${RED}Please install curl.${NC}"; exit 1; } command -v curl >/dev/null 2>&1 || { echo -e >&2 "${RED}Please install curl.${NC}"; exit 1; }
CURRENT_VERSION=$(head -2 NEWS | egrep -o "([0-9]{1,}\.)+[0-9]{1,}") CURRENT_VERSION=$(head -2 NEWS | egrep -o "([0-9]{1,}\.)+[0-9]{1,}")


Loading…
Cancel
Save