Created
October 28, 2016 15:47
-
-
Save croepha/d006ec1f62dd4dcb1774c5116d1cebff to your computer and use it in GitHub Desktop.
custom ubuntu core config:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo /snap/bin/ubuntu-image \ | |
--extra-snaps=/home/cro/home_root/mnt/2/snapcraft_kernel_build_test/linuxium-kernel_4.4.0-45.66_amd64.snap \ | |
-c beta -o ${DIR2_}/ics-ubuntu-image.img \ | |
${DIR4_}/ics.model | |
LOOP_DEVICE=$(sudo losetup --partscan --find --show \ | |
${DIR2_}/ics-ubuntu-image.img) | |
sudo mount ${LOOP_DEVICE}p3 ${DIR4_}/custom_image | |
sudo mkdir -vp ${DIR4_}/custom_image/system-data/etc/systemd/system/sysinit.target.wants | |
sudo ln -s /lib/systemd/system/debug-shell.service \ | |
${DIR4_}/custom_image/system-data/etc/systemd/system/sysinit.target.wants/debug-shell.service | |
sudo mkdir -p ${DIR4_}/custom_image/system-data/var/lib/console-conf/ | |
sudo touch ${DIR4_}/custom_image/system-data/var/lib/console-conf/complete | |
cat <<EOF | sudo tee ${DIR4_}/custom_image/system-data/etc/network/interfaces.d/wlan0 | |
allow-hotplug wlan0 | |
iface wlan0 inet dhcp | |
wpa_ssid "my_custom_ssid" | |
wpa_psk "my_custom_pass" | |
EOF | |
cat <<EOF | sudo tee ${DIR4_}/custom_image/system-data/etc/systemd/system/mycustom-first-boot.service | |
[Unit] | |
Description=mycustom-first-boot | |
ConditionPathExists=!/var/lib/console-conf/mycustom-first-boot-complete | |
After=network.target | |
[Service] | |
Type=forking | |
ExecStart=/var/lib/console-conf/mycustom-first-boot.sh | |
TimeoutSec=0 | |
RemainAfterExit=yes | |
EOF | |
sudo ln -s /etc/systemd/system/mycustom-first-boot.service \ | |
${DIR4_}/custom_image/system-data/etc/systemd/system/sysinit.target.wants/mycustom-first-boot.service | |
cat <<EOF | sudo tee ${DIR4_}/custom_image/system-data/var/lib/console-conf/mycustom-first-boot.sh | |
#!/bin/bash | |
exec >> /var/lib/console-conf/mycustom-first-boot.log | |
exec 2>&1 | |
echo | |
date | |
echo | |
sudo adduser --extrausers --quiet --disabled-password --gecos '' mycustom | |
echo \"mycustom:mycustom_pass\" | chpasswd | |
echo 'mycustom ALL=(ALL) NOPASSWD:ALL' | sudo tee /etc/sudoers.d/mycustom | |
sudo mkdir -p /home/mycustom/.ssh | |
sudo chdown mycustom:mycustom /home/mycustom/.ssh | |
sudo chmod 700 /home/mycustom/.ssh | |
echo 'ssh-rsa mycustommycustommycustommycustommycustommycustommycustom' | sudo tee /home/mycustom/authorized_keys | |
sudo chown mycustom:mycustom /home/mycustom/authorized_keys | |
sudo 400 mycustom:mycustom /home/mycustom/authorized_keys | |
touch /var/lib/console-conf/mycustom-first-boot-complete | |
EOF | |
sudo chmod +x ${DIR4_}/custom_image/system-data/var/lib/console-conf/mycustom-first-boot.sh | |
sudo mkdir -vp ${DIR4_}/custom_image/system-data/etc/systemd/system/multi-user.target.wants | |
sudo ln -s /lib/systemd/system/systemd-resolved.service \ | |
${DIR4_}/custom_image/system-data/etc/systemd/system/multi-user.target.wants/systemd-resolved.service | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment