Pull request #1 from ChaosStuff/cnc-dashboard#metalgamer

Title: Fixed some shellcheck warnings (Closed)

Shellcheck (https://www.shellcheck.net/) is a tool to help common pitfalls in shell scripting.

This fixes some common mistakes.
Closed, Approved
git pull https://projects.c3l.lu/ChaosStuff/cnc-dashboard metalgamer
2022-06-08 22:33:16
Dennis Fink (metalgamer)
metalgamer@c3l.lu

Git pull requests don't support iterating yet.

Reviewers

  • x
Pull Request Content
3 comments (0 inline, 3 general)
Showing 7 commits
7 Dennis Fink d7197ecf1533
2 years ago
6 Dennis Fink 10c0cde7f869
2 years ago
5 Dennis Fink cdf411165c6e
2 years ago
4 Dennis Fink 664cd0ed6b61
2 years ago
3 Dennis Fink 4d7f924adca6
2 years ago
2 Dennis Fink 30b325c925ad
2 years ago
1 Dennis Fink cb413875da2f
2 years ago
Common ancestor: c3309581c2ac
3 files changed with 18 insertions and 15 deletions:
ansible.sh
Show inline comments
 
#!/usr/bin/env bash
 
ansible-galaxy install -r requirements.yml
 

	
 
if [ -z ${1+x} ]; then
 
@@ -9,4 +10,4 @@ fi
 

	
 
# Agent running causes issues because SSH seems to prioritise those keys by default
 
SSH_AUTH_SOCK=/dev/null
 
ansible-playbook -v -i hosts.yml $PLAYBOOK
 
ansible-playbook -v -i hosts.yml "$PLAYBOOK"
flashEMMC.sh
Show inline comments
 
@@ -7,12 +7,12 @@ 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
 
	[[ -e /dev/"$DEV" ]] || { echo "ERROR: Drive doesn't exist" && exit 1; }
 
	fdisk -l /dev/"$DEV"
 
	echo
 
}
 

	
 
@@ -29,18 +29,18 @@ verifyRightDrive() {
 
}
 

	
 
umountInitially() {
 
	BLKDEVS=$(find /dev/ -name ${DEV}*)
 
	BLKDEVS=$(find /dev/ -name "${DEV}"*)
 
	for LINE in $BLKDEVS; do
 
		sudo umount $LINE
 
		sudo umount "$LINE"
 
	done
 
}
 

	
 
zeroBeginning() {
 
	dd if=/dev/zero of=/dev/$DEV bs=1M count=8
 
	dd if=/dev/zero of=/dev/"$DEV" bs=1M count=8
 
}
 

	
 
partitionEMMC() {
 
fdisk -W always /dev/$DEV << EOF
 
fdisk -W always /dev/"$DEV" << EOF
 
o
 
n
 
p
 
@@ -53,14 +53,14 @@ EOF
 
}
 

	
 
createEXT4fs() {
 
	mkfs.ext4 -O ^metadata_csum,^64bit /dev/${DEV}1
 
	mkfs.ext4 -O ^metadata_csum,^64bit /dev/"${DEV}"1
 
}
 

	
 
cdToScript() {
 
	TMP=$(dirname "$0")
 
	cd $TMP
 
	cd "$TMP" || exit
 
	mkdir flashEMMC
 
	cd flashEMMC
 
	cd flashEMMC || exit
 
}
 

	
 
unmountFS() {
 
@@ -86,13 +86,13 @@ extractImage() {
 

	
 
mountFS() {
 
	mkdir root
 
	mount /dev/${DEV}1 root
 
	mount /dev/"${DEV}"1 root
 
	[ -e ${IMAGE_NAME}.md5 ] && md5sum -c ${IMAGE_NAME}.md5 || downloadImage && extractImage
 
}
 

	
 
flashBootloader() {
 
	cd root/boot
 
	./sd_fusing.sh /dev/${DEV}
 
	cd root/boot || exit
 
	./sd_fusing.sh /dev/"${DEV}"
 
	cd ../..
 
}
 

	
init.sh
Show inline comments
 
#!/usr/bin/env bash
 

	
 
generateKey() {
 
	touch sshKey
 
	touch sshKey.pub
 
@@ -7,7 +9,7 @@ generateKey() {
 
}
 

	
 
deployKey() {
 
	sshpass -p alarm ssh-copy-id -i ./sshKey.pub -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PubkeyAuthentication=false alarm@$1
 
	sshpass -p alarm ssh-copy-id -i ./sshKey.pub -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PubkeyAuthentication=false alarm@"$1"
 
}
 

	
 
# If keys are present, we just need to deploy it and destroy the SSH Agent
Dennis Fink (metalgamer) 2 years and 5 months ago comment on pull request "Fixed some shellcheck warnings"

Status change: Under review

x 2 years and 5 months ago comment on pull request "Fixed some shellcheck warnings"
I see no problem with this contribution, but unrelated, it does make me realize the lack of CI/CD.

Since commit 22eaaa79cfda added a LICENSE to facilitate contribution and distribution, I am legally obliged to ask the following:
Do you license these changes under the project's license (BSD 3 clause as readable in LICENSE in the latest master commit at the time of writing, which is 22eaaa79cfda) ?
x 2 years and 5 months ago comment on pull request "Fixed some shellcheck warnings"

Status change: Approved

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