@@ -712,21 +712,35 @@ Window {
712
712
addCloudInit (" " )
713
713
}
714
714
715
+ var isRpiosCloudInit = imageWriter .checkSWCapability (" rpios_cloudinit" );
716
+
715
717
if (chkSSH .checked || chkSetUser .checked ) {
716
718
// First user may not be called 'pi' on all distributions, so look username up
717
719
addFirstRun (" FIRSTUSER=`getent passwd 1000 | cut -d: -f1`" );
718
720
addFirstRun (" FIRSTUSERHOME=`getent passwd 1000 | cut -d: -f6`" )
719
721
720
- addCloudInit (" users:" )
721
- addCloudInit (" - name: " + fieldUserName .text )
722
- addCloudInit (" groups: users,adm,dialout,audio,netdev,video,plugdev,cdrom,games,input,gpio,spi,i2c,render,sudo" )
723
- addCloudInit (" shell: /bin/bash" )
724
-
725
722
var cryptedPassword;
726
723
if (chkSetUser .checked ) {
727
724
cryptedPassword = fieldUserPassword .alreadyCrypted ? fieldUserPassword .text : imageWriter .crypt (fieldUserPassword .text )
728
- addCloudInit (" lock_passwd: false" )
729
- addCloudInit (" passwd: " + cryptedPassword)
725
+ }
726
+
727
+ if (isRpiosCloudInit && cryptedPassword) {
728
+ addCloudInit (" rpi_userconf:" )
729
+ addCloudInit (" password: " + cryptedPassword)
730
+ addCloudInit (" user: " + fieldUserName .text )
731
+ addCloudInit (" " )
732
+ }
733
+
734
+ addCloudInit (" users:" )
735
+ addCloudInit (" - name: " + fieldUserName .text )
736
+ if (! isRpiosCloudInit) {
737
+ addCloudInit (" groups: users,adm,dialout,audio,netdev,video,plugdev,cdrom,games,input,gpio,spi,i2c,render,sudo" )
738
+ addCloudInit (" shell: /bin/bash" )
739
+
740
+ if (chkSetUser .checked ) {
741
+ addCloudInit (" lock_passwd: false" )
742
+ addCloudInit (" passwd: " + cryptedPassword)
743
+ }
730
744
}
731
745
732
746
if (chkSSH .checked && radioPubKeyAuthentication .checked ) {
@@ -759,7 +773,9 @@ Window {
759
773
addCloudInit (" - " + pk)
760
774
}
761
775
}
762
- addCloudInit (" sudo: ALL=(ALL) NOPASSWD:ALL" )
776
+ if (! isRpiosCloudInit) {
777
+ addCloudInit (" sudo: ALL=(ALL) NOPASSWD:ALL" )
778
+ }
763
779
}
764
780
addCloudInit (" " )
765
781
@@ -795,6 +811,14 @@ Window {
795
811
addFirstRun (" fi" )
796
812
}
797
813
addCloudInit (" " )
814
+
815
+ /* if (chkSetUser.checked) {
816
+ addCloudInit("final_message: \"Setup wizard has been skiped.\"")
817
+ addCloudInit("power_state:")
818
+ addCloudInit(" mode: reboot")
819
+ addCloudInit(" message: Rebooting machine")
820
+ addCloudInit("")
821
+ }*/
798
822
}
799
823
if (chkWifi .checked ) {
800
824
var wpaconfig = " country=" + fieldWifiCountry .editText + " \n "
@@ -830,17 +854,18 @@ Window {
830
854
addFirstRun (" fi" )
831
855
832
856
833
- cloudinitnetwork = " version: 2\n "
834
- cloudinitnetwork += " wifis:\n "
835
- cloudinitnetwork += " renderer: networkd\n "
836
- cloudinitnetwork += " wlan0:\n "
837
- cloudinitnetwork += " dhcp4: true\n "
838
- cloudinitnetwork += " optional: true\n "
839
- cloudinitnetwork += " access-points:\n "
840
- cloudinitnetwork += " \" " + fieldWifiSSID .text + " \" :\n "
841
- cloudinitnetwork += " password: \" " + cryptedPsk+ " \"\n "
857
+ cloudinitnetwork = " network:\n "
858
+ cloudinitnetwork += " version: 2\n "
859
+ cloudinitnetwork += " renderer: " + (isRpiosCloudInit ? " NetworkManager" : " networkd" ) + " \n "
860
+ cloudinitnetwork += " wifis:\n "
861
+ cloudinitnetwork += " wlan0:\n "
862
+ cloudinitnetwork += " dhcp4: true\n "
863
+ cloudinitnetwork += " optional: true\n "
864
+ cloudinitnetwork += " access-points:\n "
865
+ cloudinitnetwork += " \" " + fieldWifiSSID .text + " \" :\n "
866
+ cloudinitnetwork += " password: \" " + cryptedPsk+ " \"\n "
842
867
if (chkWifiSSIDHidden .checked ) {
843
- cloudinitnetwork += " hidden: true\n "
868
+ cloudinitnetwork += " hidden: true\n "
844
869
}
845
870
846
871
addCmdline (" cfg80211.ieee80211_regdom=" + fieldWifiCountry .editText )
0 commit comments