Change wifi a bit so that the file is generated for the image instead of just being copied over.

This commit is contained in:
Storm Dragon 2020-12-27 15:25:08 -05:00
parent 815c5f024d
commit c25f27e879

View File

@ -93,7 +93,8 @@ done
# make sure variables are set, or use defaults. # make sure variables are set, or use defaults.
if [[ -n "${imageWifi}" ]]; then if [[ -n "${imageWifi}" ]]; then
export imageWifi export imageWifiESSID="$(grep 'ESSID=' "${imageWifi}" | cut -d = -f2)"
export imageWifiKey="$(grep 'Key=' "${imageWifi}" | cut -d = -f2)"
fi fi
export imageVersion="${imageVersion:-4}" export imageVersion="${imageVersion:-4}"
export imageSize="${imageSize:-8G}" export imageSize="${imageSize:-8G}"
@ -147,7 +148,6 @@ wget "${url[$imageVersion]}" -O- | bsdtar -xpf - -C /mnt
# Set up wifi # Set up wifi
if [[ -n "${imageWifi}" ]]; then if [[ -n "${imageWifi}" ]]; then
mkdir -v "/mnt/etc/netctl" mkdir -v "/mnt/etc/netctl"
cp -v "${imageWifi}" "/mnt/etc/netctl"
fi fi
# Create Mycroft service file # Create Mycroft service file
cat << 'EOF' > /mnt/etc/systemd/system/mycroft.service cat << 'EOF' > /mnt/etc/systemd/system/mycroft.service
@ -223,7 +223,7 @@ echo mycroft > /etc/hostname
# Enable services # Enable services
systemctl enable mycroft sshd systemctl enable mycroft sshd
if [[ -n "${imageWifi}" ]]; then if [[ -n "${imageWifi}" ]]; then
netctl enable "${imageWifi##*/}" netctl enable "mycroft"
fi fi
# Update fstab for Raspberry Pi 4. # Update fstab for Raspberry Pi 4.
#[[ $imageVersion -eq 4 ]] && sed -i 's/mmcblk0/mmcblk1/g' /etc/fstab #[[ $imageVersion -eq 4 ]] && sed -i 's/mmcblk0/mmcblk1/g' /etc/fstab