diff --git a/devel/script/2_keys.xml b/devel/script/2_keys.xml
index 4438881..9ffeba8 100644
--- a/devel/script/2_keys.xml
+++ b/devel/script/2_keys.xml
@@ -655,7 +655,7 @@ svcenable udev-trigger boot
The svcenable Key — Typical Desktop
svcenable dbus
-svcenable consolekit
+svcenable elogind
svcenable sddm
This configures the target computer to start up a display manager and its required daemons during system boot, enabling graphical logins.
diff --git a/devel/script/4_json.xml b/devel/script/4_json.xml
new file mode 100644
index 0000000..b0234a4
--- /dev/null
+++ b/devel/script/4_json.xml
@@ -0,0 +1,451 @@
+
+
+ JSON Schema
+ The Horizon system supports converting JSON files to HorizonScript. This chapter describes the JSON schema supported by the Horizon JSON tooling.
+ It is important to note that not all features of Horizon are available from JSON. For more advanced use cases, consider writing HorizonScript files directly. However, it is felt that supporting JSON interchange is important for interoperability with external systems.
+
+ Overall document structure
+ There are two document formats supported by the Horizon JSON tooling. The most common is a simple structure where a single root object contains the Horizon JSON keys. The second, and less common, describes multiple configurations called "images" in a single JSON file. The root object contains a single key/value pair, images, which is an array of objects containing Horizon JSON keys. See for more information.
+
+
+ Supported keys
+
+
+ hostname
+
+ Format
+ String
+
+
+ Short Description
+ The device's host name.
+
+
+ Corresponding HorizonScript key
+ hostname
+
+
+
+ packages
+
+ Format
+ Array of String
+
+
+ Short Description
+ A list of packages to install to the device.
+
+
+ Corresponding HorizonScript key
+ pkginstall
+
+
+
+ rootpw
+
+ Format
+ String
+
+
+ Short Description
+ The encrypted root password for the device.
+
+
+ Corresponding HorizonScript key
+ rootpw
+
+
+
+ arch
+
+ Format
+ String
+
+
+ Short Description
+ The device's CPU architecture.
+
+
+ Corresponding HorizonScript key
+ arch
+
+
+
+ language
+
+ Format
+ String
+
+
+ Short Description
+ The language to use for the device's interface.
+
+
+ Corresponding HorizonScript key
+ language
+
+
+
+ keymap
+
+ Format
+ String
+
+
+ Short Description
+ The keyboard map to use for the device's hardware inputs.
+
+
+ Corresponding HorizonScript key
+ keymap
+
+
+
+ firmware
+
+ Format
+ String or Boolean
+
+
+ Short Description
+ Determines whether or not the device will have non-free firmware installed.
+
+
+ Corresponding HorizonScript key
+ firmware
+
+
+
+ services
+
+ Format
+ Array of Object
+
+
+ Short Description
+ Specifies additional services to start on device boot.
+
+
+ Object Structure
+
+
+
+ service
+ (String) The name of the service to start.
+
+
+ runlevel
+ (String) The runlevel that the service should start under. If no runlevel is specified, default is used.
+
+
+
+
+
+ Corresponding HorizonScript key
+ svcenable
+
+
+
+ netconfig
+
+ Format
+ String
+
+
+ Short Description
+ Determines the network configuration system used on the device.
+
+
+ Corresponding HorizonScript key
+ netconfigtype
+
+
+
+ netaddresses
+
+ Format
+ Array of Object
+
+
+ Short Description
+ Specifies the device's network addressing configuration.
+
+
+ Object Structure
+
+
+
+ id
+ (String) This connection's identifier. This field is for operator reference only - it will not appear in the HorizonScript or in the device's configuration.
+
+
+ interface
+ (String) The network interface to use for this address.
+
+
+ addr-type
+ (String) The type of this address: none to bring up the interface without an address (common for bridging), dhcp for DHCP, or static for static addressing.
+
+
+ address
+ (Object) The network address. Only valid if addr-type is static.
+
+
+ If static addressing is desired, the address object is described below.
+
+
+ ip-address
+ (String) The IPv4 or IPv6 address for this connection.
+
+
+ net-prefix
+ (Number) The network prefix for this connection. Valid values are 1-32 for IPv4, and 1-128 for IPv6.
+
+
+ gateway
+ (String) The IPv4 or IPv6 address for the gateway for this connection.
+
+
+
+
+
+ Corresponding HorizonScript key
+ netaddress
+
+
+
+ pppoe_links
+
+ Format
+ Array of Object
+
+
+ Short Description
+ Specifies the device's PPPoE configuration.
+
+
+ Object Structure
+
+
+
+ interface
+ (String) The network interface to use for this PPPoE link.
+
+
+ mtu
+ (Number) The MTU for this PPPoE link. Default is 1472.
+
+
+ username
+ (String) The username to use for authenticating this PPPoE link.
+
+
+ password
+ (String) The passphrase/secret to use for authenticating this PPPoE link.
+
+
+ lcp-echo-interval
+ (Number) The number of seconds between LCP echo requests.
+
+
+ lcp-echo-failure
+ (Number) The number of echo request failures before this link is failed.
+
+
+
+
+
+ Corresponding HorizonScript key
+ pppoe
+
+
+
+ nameservers
+
+ Format
+ Array of String
+
+
+ Short Description
+ IP addresses used for Domain Name System (DNS) resolution.
+
+
+ Corresponding HorizonScript key
+ nameserver
+
+
+
+ access-points
+
+ Format
+ Array of Object
+
+
+ Short Description
+ Specifies the device's wireless networking configuration.
+
+
+ Object Structure
+
+
+
+ interface
+ (String) The wireless network interface to use for this access point.
+
+
+ ssid
+ (String) The SSID for this access point.
+
+
+ security
+ (String) The security type to use for this access point: none, wep, or wpa.
+
+
+ password
+ (String) The shared secret to use for authenticating this wireless link.
+
+
+
+
+
+ Corresponding HorizonScript key
+ netssid
+
+
+
+ timezone
+
+ Format
+ String
+
+
+ Short Description
+ The time zone to use on the device.
+
+
+ Corresponding HorizonScript key
+ timezone
+
+
+
+ repositories
+
+ Format
+ Array of String
+
+
+ Short Description
+ The APK repositories to use for package installation on the device.
+
+
+ Corresponding HorizonScript key
+ repository
+
+
+
+ signingkeys
+
+ Format
+ Array of String
+
+
+ Short Description
+ The location of the signing key(s) used by the device's APK repositories.
+
+
+ Corresponding HorizonScript key
+ signingkey
+
+
+
+ users
+
+ Format
+ Array of Object
+
+
+ Short Description
+ Specifies the device's user accounts.
+
+
+ Object Structure
+
+
+
+ username
+ (String) The login name of this account.
+
+
+ alias
+ (String) The friendly name/GECOS of this account.
+
+
+ passphrase
+ (String) The encrypted passphrase to use to authenticate to this account. See for information about the format of passphrase.
+
+
+ groups
+ (String) Comma-separated list of this account's member groups.
+
+
+
+
+
+ Corresponding HorizonScript keys
+ username, useralias, userpw, usergroups
+
+
+
+
+ Examples
+
+
+ Basic example of Horizon JSON file
+
+{
+ "hostname": "horizon-json-testmachine.adelielinux.org",
+ "packages": ["adelie-base-posix", "easy-kernel", "easy-kernel-modules",
+ "netifrc", "openrc", "s6-linux-init"],
+ "rootpw": "...",
+ "root": "/dev/sda1",
+ "netaddresses": [{"id":"eth0", "interface":"eth0", "addr-type":"dhcp"}],
+ "nameservers": ["9.9.9.9"],
+ "timezone": "America/Chicago",
+ "repositories": ["https://distfiles.adelielinux.org/adelie/1.0/system",
+ "https://distfiles.adelielinux.org/adelie/1.0/user"],
+ "signingkeys": ["/etc/apk/keys/powerpc-1@packages.adelielinux.org.pub",
+ "/etc/apk/keys/powerpc-2@packages.adelielinux.org.pub"]
+}
+
+
+
+ Example of multi-configuration Horizon JSON file
+
+{"images":
+ [
+ {"name": "Test Image",
+ "hostname": "horizon-json-testmachine.adelielinux.org",
+ "packages": ["adelie-base-posix", "easy-kernel", "easy-kernel-modules",
+ "netifrc", "openrc", "s6-linux-init"],
+ "rootpw": "...",
+ "root": "/dev/sda1",
+ "arch": "ppc64",
+ "language": "en_GB.UTF-8",
+ "keymap": "us",
+ "firmware": false,
+ "netconfig": "netifrc",
+ "netaddresses": [{"id":"eth0", "interface":"eth0", "addr-type":"dhcp"}],
+ "nameservers": ["9.9.9.9"],
+ "timezone": "America/Chicago",
+ "repositories": ["https://distfiles.adelielinux.org/adelie/1.0/system",
+ "https://distfiles.adelielinux.org/adelie/1.0/user"],
+ "signingkeys": ["/etc/apk/keys/powerpc-1@packages.adelielinux.org.pub",
+ "/etc/apk/keys/powerpc-2@packages.adelielinux.org.pub"]
+ }
+ ]
+}
+
+
+
+
+
diff --git a/devel/script/script.xml b/devel/script/script.xml
index f8c1a65..bf82a06 100644
--- a/devel/script/script.xml
+++ b/devel/script/script.xml
@@ -4,6 +4,7 @@
+
]>
@@ -11,8 +12,8 @@
A.WilcoxAdélie Linux
- Specification for HorizonScript (Horizon release 1.0)
- 2020-06-13
+ Specification for HorizonScript (Horizon release 1.0) + JSON specification 1.0
+ 2020-07-20
20192020
Adélie Linux
@@ -26,4 +27,5 @@
&chap1;
&chap2;
&chap3;
+ &chap4;
diff --git a/hscript/meta.cc b/hscript/meta.cc
index d79f3f5..1227e60 100644
--- a/hscript/meta.cc
+++ b/hscript/meta.cc
@@ -722,6 +722,18 @@ const std::string my_arch(const Horizon::Script *script) {
return "pmmx";
# elif defined(__x86_64__)
return "x86_64";
+# elif defined(__mips64)
+# if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ return "mips64el";
+# else /* If byte order is not defined, default to big endian. */
+ return "mips64";
+# endif
+# elif defined(__mips__)
+# if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ return "mipsel";
+# else /* If byte order is not defined, default to big endian. */
+ return "mips";
+# endif
# else
# error Unknown architecture.
# endif
@@ -755,6 +767,10 @@ bool Bootloader::validate() const {
const static std::set valid_x86 = {"grub-bios",
"grub-efi"};
return valid_x86.find(this->value()) != valid_x86.end();
+ } else if(arch == "mips64" || arch == "mips" ||
+ arch == "mips64el" || arch == "mipsel") {
+ const static std::set valid_mips = {};
+ return valid_mips.find(this->value()) != valid_mips.end();
} else {
output_error(pos, "bootloader: unknown architecture", arch);
return false;
diff --git a/hscript/script.cc b/hscript/script.cc
index 20ccbe5..6e436b7 100644
--- a/hscript/script.cc
+++ b/hscript/script.cc
@@ -225,7 +225,12 @@ Script *Script::load(std::istream &sstream, const ScriptOptions &opts,
char nextline[SCRIPT_LINE_MAX];
const std::string delim(" \t");
int errors = 0, warnings = 0;
- std::string curr_name = fs::canonical(fs::path(name));
+ std::string curr_name;
+ if(name == "/dev/stdin") {
+ curr_name = "";
+ } else {
+ curr_name = fs::canonical(fs::path(name));
+ }
std::set seen = {curr_name};
bool inherit = false;
std::istream *my_stream = &sstream;
@@ -311,7 +316,7 @@ Script *Script::load(std::istream &sstream, const ScriptOptions &opts,
}
if(my_stream->fail() && !my_stream->eof()) {
- output_error("installfile:" + std::to_string(lineno + 1),
+ output_error(curr_name + ":" + std::to_string(lineno + 1),
"line exceeds maximum length",
"Maximum line length is " +
std::to_string(SCRIPT_LINE_MAX));
@@ -319,14 +324,14 @@ Script *Script::load(std::istream &sstream, const ScriptOptions &opts,
}
if(my_stream->bad() && !my_stream->eof()) {
- output_error("installfile:" + std::to_string(lineno),
+ output_error(curr_name + ":" + std::to_string(lineno),
"I/O error while reading installfile", "");
errors++;
}
/* Ensure all required keys are present. */
#define MISSING_ERROR(key) \
- output_error(name, "expected value for key '" + std::string(key) + "'",\
+ output_error(curr_name, "expected value for key '" + std::string(key) + "'",\
"this key is required");\
errors++;
@@ -349,7 +354,7 @@ Script *Script::load(std::istream &sstream, const ScriptOptions &opts,
}
#undef MISSING_ERROR
- output_log("parser", "0", name,
+ output_log("parser", "0", curr_name,
std::to_string(errors) + " error(s), " +
std::to_string(warnings) + " warning(s).", "");
diff --git a/ui/qt5/horizonwizard.cc b/ui/qt5/horizonwizard.cc
index 6c2ea9e..92b81db 100644
--- a/ui/qt5/horizonwizard.cc
+++ b/ui/qt5/horizonwizard.cc
@@ -352,6 +352,18 @@ HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent) {
arch = pmmx;
# elif defined(__x86_64__)
arch = x86_64;
+# elif defined(__mips64)
+# if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ arch = mips64el;
+# else /* If byte order is not defined, default to big endian. */
+ arch = mips64;
+# endif
+# elif defined(__mips__)
+# if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ arch = mipsel;
+# else /* If byte order is not defined, default to big endian. */
+ arch = mips;
+# endif
# else
# error You are attempting to compile the Installation Environment UI \
on an unknown architecture. Please add a definition to horizonwizard.hh, a \
@@ -551,6 +563,19 @@ QString HorizonWizard::toHScript() {
lines << "signingkey https://distfiles.adelielinux.org/adelie/keys/x86-1@packages.adelielinux.org.pub";
lines << "signingkey https://distfiles.adelielinux.org/adelie/keys/x86-2@packages.adelielinux.org.pub";
break;
+ case mips64:
+ lines << "arch mips64";
+ /* XXX: MIPS signing keys are needed before we ship anything. */
+ break;
+ case mips:
+ lines << "arch mips";
+ break;
+ case mips64el:
+ lines << "arch mips64el";
+ break;
+ case mipsel:
+ lines << "arch mipsel";
+ break;
case UnknownCPU:
/* no arch line. hopefully it's run on the target. */
break;
@@ -608,13 +633,13 @@ QString HorizonWizard::toHScript() {
lines << "pkginstall adelie-base-posix firefox-esr libreoffice "
"thunderbird vlc kde x11 bluez sddm";
lines << "svcenable bluetooth";
- lines << "svcenable consolekit";
+ lines << "svcenable elogind";
lines << "svcenable sddm";
break;
case Compact:
lines << "pkginstall adelie-base netsurf featherpad lxqt-desktop "
"abiword gnumeric sddm xorg-apps xorg-drivers xorg-server";
- lines << "svcenable consolekit";
+ lines << "svcenable elogind";
lines << "svcenable sddm";
break;
case TextOnly:
diff --git a/ui/qt5/horizonwizard.hh b/ui/qt5/horizonwizard.hh
index bf53ae0..8af9df7 100644
--- a/ui/qt5/horizonwizard.hh
+++ b/ui/qt5/horizonwizard.hh
@@ -96,6 +96,10 @@ public:
enum Arch {
aarch64,
armv7,
+ mips,
+ mips64,
+ mipsel,
+ mips64el,
pmmx,
ppc,
ppc64,