ci(pre-commit): add shellcheck hook

This commit is contained in:
Wallun 2021-12-09 14:10:02 +01:00
parent efc3af2010
commit 71b170e46f
Signed by: wallun
GPG Key ID: 71D17013D836735B
2 changed files with 17 additions and 8 deletions

View File

@ -16,6 +16,12 @@ repos:
- id: end-of-file-fixer
- id: fix-byte-order-marker
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.1
hooks:
- id: shellcheck
args: [ -x ]
- repo: https://github.com/jorisroovers/gitlint
rev: v0.16.0
hooks:

View File

@ -51,6 +51,7 @@ if [[ ! -f "${CONFIG_FILE}" ]]; then
echo "${CONFIG_FILE} does not exist"
exit 10;
else
# shellcheck source=config
source "${CONFIG_FILE}";
if [[ -z "${PASSPHRASE}" ]]; then
echo "PASSPHRASE is not defined";
@ -129,7 +130,7 @@ lvcreate -l 100%FREE vgos -n root
# Create filesystems
mkfs.ext4 -F /dev/vgos/root;
if [[ "{MODE}" == "bios" ]]; then
if [[ "${MODE}" == "bios" ]]; then
mkfs.ext2 -F "${BOOT_PARTITION}";
else
mkfs.fat -F32 "${BOOT_PARTITION}"
@ -164,7 +165,7 @@ nano git man-db man-pages texinfo lvm2
genfstab -U /mnt >> /mnt/etc/fstab
# Configure system-resolved
cd /mnt/etc;
cd /mnt/etc || exit;
rm -f resolv.conf;
ln -sf ../run/systemd/resolve/resolv.conf resolv.conf
@ -258,9 +259,13 @@ fi;
arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg;
# /etc/default/grub
CRYPTDEVICE=$(ls -lh /dev/disk/by-uuid/ \
| grep $(basename "${ENCRYPTED_PARTITION}") \
| awk '{print "cryptdevice=UUID="$9":cryptlvm"}')
CRYPTDEVICE=""
DISK_UUID_LIST=$(find /dev/disk/by-uuid -type l)
for DISK_UUID in ${DISK_UUID_LIST}; do
if [[ "$(realpath "$DISK_UUID")" == "${ENCRYPTED_PARTITION}" ]]; then
CRYPTDEVICE="cryptdevice=UUID=$(basename "${DISK_UUID}"):cryplvm"
fi;
done
IP="ip=::::${HOSTNAME}:eth0:dhcp netconf_timeout=10"
ROOT="root=/dev/vgos/root"
PRELOAD_MODULES="part_gpt part_msdos lvm"
@ -295,10 +300,8 @@ arch-chroot /mnt dropbearkey -t ecdsa -f /etc/dropbear/dropbear_ecdsa_host_key
arch-chroot /mnt dropbearkey -t ed25519 -f /etc/dropbear/dropbear_ed25519_host_key
arch-chroot /mnt sed -i "s/-E -s -j -k/-E -s -j -k -p 222/g" /usr/lib/initcpio/hooks/dropbear
NET_MODULE=$(ls -l /sys/class/net/eth0/device/driver | awk -F"/" '{print $NF}')
NET_MODULE=$(realpath /sys/class/net/eth0/device/driver | awk -F"/" '{print $NF}')
arch-chroot /mnt sed -i "s/^MODULES=()/MODULES=(${NET_MODULE})/g" /etc/mkinitcpio.conf
arch-chroot /mnt mkinitcpio -P;
arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg;
exit;