mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 07:55:21 +01:00
Allow outsourcing custom settings to script
This commit is contained in:
parent
31252bf1c4
commit
4961990ce0
2 changed files with 49 additions and 20 deletions
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -8,6 +8,8 @@ rpi-imager (1.7.3) unstable; urgency=medium
|
||||||
* Update Slovan/Korean language files
|
* Update Slovan/Korean language files
|
||||||
* Allow selecting file names without extension
|
* Allow selecting file names without extension
|
||||||
* Add new regulatory-domain parameter to cloud-init files
|
* Add new regulatory-domain parameter to cloud-init files
|
||||||
|
* Add possibility to outsource handling of custom settings to script at
|
||||||
|
/usr/lib/raspberrypi-sys-mods/imager_custom
|
||||||
|
|
||||||
-- Floris Bos <bos@je-eigen-domein.nl> Sun, 31 Jul 2022 12:15:17 +0200
|
-- Floris Bos <bos@je-eigen-domein.nl> Sun, 31 Jul 2022 12:15:17 +0200
|
||||||
|
|
||||||
|
|
|
@ -595,8 +595,12 @@ Popup {
|
||||||
|
|
||||||
if (chkHostname.checked && fieldHostname.length) {
|
if (chkHostname.checked && fieldHostname.length) {
|
||||||
addFirstRun("CURRENT_HOSTNAME=`cat /etc/hostname | tr -d \" \\t\\n\\r\"`")
|
addFirstRun("CURRENT_HOSTNAME=`cat /etc/hostname | tr -d \" \\t\\n\\r\"`")
|
||||||
|
addFirstRun("if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ]; then")
|
||||||
|
addFirstRun(" /usr/lib/raspberrypi-sys-mods/imager_custom set_hostname "+fieldHostname.text)
|
||||||
|
addFirstRun("else")
|
||||||
addFirstRun(" echo "+fieldHostname.text+" >/etc/hostname")
|
addFirstRun(" echo "+fieldHostname.text+" >/etc/hostname")
|
||||||
addFirstRun(" sed -i \"s/127.0.1.1.*$CURRENT_HOSTNAME/127.0.1.1\\t"+fieldHostname.text+"/g\" /etc/hosts")
|
addFirstRun(" sed -i \"s/127.0.1.1.*$CURRENT_HOSTNAME/127.0.1.1\\t"+fieldHostname.text+"/g\" /etc/hosts")
|
||||||
|
addFirstRun("fi")
|
||||||
|
|
||||||
addCloudInit("hostname: "+fieldHostname.text)
|
addCloudInit("hostname: "+fieldHostname.text)
|
||||||
addCloudInit("manage_etc_hosts: true")
|
addCloudInit("manage_etc_hosts: true")
|
||||||
|
@ -631,12 +635,22 @@ Popup {
|
||||||
if (chkSSH.checked && radioPubKeyAuthentication.checked) {
|
if (chkSSH.checked && radioPubKeyAuthentication.checked) {
|
||||||
var pubkey = fieldPublicKey.text
|
var pubkey = fieldPublicKey.text
|
||||||
var pubkeyArr = pubkey.split("\n")
|
var pubkeyArr = pubkey.split("\n")
|
||||||
|
var pubkeySpaceSep = ''
|
||||||
|
for (var j=0; j<pubkeyArr.length; j++) {
|
||||||
|
var pkitem = pubkeyArr[j].trim();
|
||||||
|
if (pkitem) {
|
||||||
|
pubkeySpaceSep += ' '+escapeshellarg(pkitem)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (pubkey.length) {
|
addFirstRun("if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ]; then")
|
||||||
|
addFirstRun(" /usr/lib/raspberrypi-sys-mods/imager_custom enable_ssh -k"+pubkeySpaceSep)
|
||||||
|
addFirstRun("else")
|
||||||
addFirstRun(" install -o \"$FIRSTUSER\" -m 700 -d \"$FIRSTUSERHOME/.ssh\"")
|
addFirstRun(" install -o \"$FIRSTUSER\" -m 700 -d \"$FIRSTUSERHOME/.ssh\"")
|
||||||
addFirstRun(" install -o \"$FIRSTUSER\" -m 600 <(printf \""+pubkey.replace(/\n/g, "\\n")+"\") \"$FIRSTUSERHOME/.ssh/authorized_keys\"")
|
addFirstRun(" install -o \"$FIRSTUSER\" -m 600 <(printf \""+pubkey.replace(/\n/g, "\\n")+"\") \"$FIRSTUSERHOME/.ssh/authorized_keys\"")
|
||||||
}
|
|
||||||
addFirstRun(" echo 'PasswordAuthentication no' >>/etc/ssh/sshd_config")
|
addFirstRun(" echo 'PasswordAuthentication no' >>/etc/ssh/sshd_config")
|
||||||
|
addFirstRun(" systemctl enable ssh")
|
||||||
|
addFirstRun("fi")
|
||||||
|
|
||||||
if (!chkSetUser.checked) {
|
if (!chkSetUser.checked) {
|
||||||
addCloudInit(" lock_passwd: true")
|
addCloudInit(" lock_passwd: true")
|
||||||
|
@ -654,6 +668,11 @@ Popup {
|
||||||
|
|
||||||
if (chkSSH.checked && radioPasswordAuthentication.checked) {
|
if (chkSSH.checked && radioPasswordAuthentication.checked) {
|
||||||
addCloudInit("ssh_pwauth: true")
|
addCloudInit("ssh_pwauth: true")
|
||||||
|
addFirstRun("if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ]; then")
|
||||||
|
addFirstRun(" /usr/lib/raspberrypi-sys-mods/imager_custom enable_ssh")
|
||||||
|
addFirstRun("else")
|
||||||
|
addFirstRun(" systemctl enable ssh")
|
||||||
|
addFirstRun("fi")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chkSetUser.checked) {
|
if (chkSetUser.checked) {
|
||||||
|
@ -678,10 +697,6 @@ Popup {
|
||||||
addFirstRun(" fi")
|
addFirstRun(" fi")
|
||||||
addFirstRun("fi")
|
addFirstRun("fi")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chkSSH.checked) {
|
|
||||||
addFirstRun("systemctl enable ssh")
|
|
||||||
}
|
|
||||||
addCloudInit("")
|
addCloudInit("")
|
||||||
}
|
}
|
||||||
if (chkWifi.checked) {
|
if (chkWifi.checked) {
|
||||||
|
@ -698,6 +713,11 @@ Popup {
|
||||||
wpaconfig += "\tpsk="+cryptedPsk+"\n"
|
wpaconfig += "\tpsk="+cryptedPsk+"\n"
|
||||||
wpaconfig += "}\n"
|
wpaconfig += "}\n"
|
||||||
|
|
||||||
|
addFirstRun("if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ]; then")
|
||||||
|
addFirstRun(" /usr/lib/raspberrypi-sys-mods/imager_custom set_wlan "
|
||||||
|
+(chkWifiSSIDHidden.checked ? " -h " : "")
|
||||||
|
+escapeshellarg(fieldWifiSSID.text)+" "+escapeshellarg(cryptedPsk)+" "+escapeshellarg(fieldWifiCountry.editText))
|
||||||
|
addFirstRun("else")
|
||||||
addFirstRun("cat >/etc/wpa_supplicant/wpa_supplicant.conf <<'WPAEOF'")
|
addFirstRun("cat >/etc/wpa_supplicant/wpa_supplicant.conf <<'WPAEOF'")
|
||||||
addFirstRun(wpaconfig)
|
addFirstRun(wpaconfig)
|
||||||
addFirstRun("WPAEOF")
|
addFirstRun("WPAEOF")
|
||||||
|
@ -706,6 +726,8 @@ Popup {
|
||||||
addFirstRun(" for filename in /var/lib/systemd/rfkill/*:wlan ; do")
|
addFirstRun(" for filename in /var/lib/systemd/rfkill/*:wlan ; do")
|
||||||
addFirstRun(" echo 0 > $filename")
|
addFirstRun(" echo 0 > $filename")
|
||||||
addFirstRun(" done")
|
addFirstRun(" done")
|
||||||
|
addFirstRun("fi")
|
||||||
|
|
||||||
|
|
||||||
cloudinitnetwork = "version: 2\n"
|
cloudinitnetwork = "version: 2\n"
|
||||||
cloudinitnetwork += "wifis:\n"
|
cloudinitnetwork += "wifis:\n"
|
||||||
|
@ -730,6 +752,10 @@ Popup {
|
||||||
kbdconfig += "XKBVARIANT=\"\"\n"
|
kbdconfig += "XKBVARIANT=\"\"\n"
|
||||||
kbdconfig += "XKBOPTIONS=\"\"\n"
|
kbdconfig += "XKBOPTIONS=\"\"\n"
|
||||||
|
|
||||||
|
addFirstRun("if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ]; then")
|
||||||
|
addFirstRun(" /usr/lib/raspberrypi-sys-mods/imager_custom set_keymap "+escapeshellarg(fieldKeyboardLayout.editText))
|
||||||
|
addFirstRun(" /usr/lib/raspberrypi-sys-mods/imager_custom set_timezone "+escapeshellarg(fieldTimezone.editText))
|
||||||
|
addFirstRun("else")
|
||||||
addFirstRun(" rm -f /etc/localtime")
|
addFirstRun(" rm -f /etc/localtime")
|
||||||
addFirstRun(" echo \""+fieldTimezone.editText+"\" >/etc/timezone")
|
addFirstRun(" echo \""+fieldTimezone.editText+"\" >/etc/timezone")
|
||||||
addFirstRun(" dpkg-reconfigure -f noninteractive tzdata")
|
addFirstRun(" dpkg-reconfigure -f noninteractive tzdata")
|
||||||
|
@ -737,6 +763,7 @@ Popup {
|
||||||
addFirstRun(kbdconfig)
|
addFirstRun(kbdconfig)
|
||||||
addFirstRun("KBEOF")
|
addFirstRun("KBEOF")
|
||||||
addFirstRun(" dpkg-reconfigure -f noninteractive keyboard-configuration")
|
addFirstRun(" dpkg-reconfigure -f noninteractive keyboard-configuration")
|
||||||
|
addFirstRun("fi")
|
||||||
|
|
||||||
addCloudInit("timezone: "+fieldTimezone.editText)
|
addCloudInit("timezone: "+fieldTimezone.editText)
|
||||||
addCloudInitRun("localectl set-x11-keymap \""+fieldKeyboardLayout.editText+"\" pc105")
|
addCloudInitRun("localectl set-x11-keymap \""+fieldKeyboardLayout.editText+"\" pc105")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue