Changeset - cb413875da2f
[Approved]
0 1 0
Dennis Fink - 3 years ago 2022-06-08 22:17:24
dennis.fink@c3l.lu
Use shellvariable EUID to check if we are root
1 file changed with 1 insertions and 1 deletions:
2 comments (0 inline, 2 general)
flashEMMC.sh
Show inline comments
 
#!/usr/bin/env bash
 
DEV=$1
 
IMAGE_NAME=ArchLinuxARM-odroid-c2-latest.tar.gz
 
# Fast mirror, but I'm not sure we can trust it...
 
DOWNLOAD_LINK=https://mirrors.dotsrc.org/archlinuxarm/os/
 
HASH_LINK=https://de3.mirror.archlinuxarm.org/os/
 

	
 

	
 
checkRoot() {
 
	[ `id -u` -eq 0 ] || { echo "Run script (as root) or (with sudo)"; exit 1; }
 
	[[ "$EUID" -eq 0 ]] || { echo "Run script (as root) or (with sudo)"; exit 1; }
 
}
 

	
 
diskInfo() {
 
	[[ -e /dev/$DEV ]] || { echo "ERROR: Drive doesn't exist" && exit 1; }
 
	fdisk -l /dev/$DEV
 
	echo
 
}
 

	
 
verifyRightDrive() {
 
	sleep 3
 
	read -n 1 -r -p "Is this the right drive? [y/N] " response
 
	if [[ "$response" =~ ^([yY])$ ]]
Dennis Fink (metalgamer) 2 years and 10 months ago comment on pull request "Fixed some shellcheck warnings"

Status change: Under review

x 2 years and 10 months ago comment on pull request "Fixed some shellcheck warnings"

Status change: Approved

Answer is "ok" (via Matrix chat)
2 comments (0 inline, 2 general)