summaryrefslogtreecommitdiff
path: root/meta-phosphor/classes
diff options
context:
space:
mode:
Diffstat (limited to 'meta-phosphor/classes')
-rw-r--r--meta-phosphor/classes/dbus-dir.bbclass2
-rw-r--r--meta-phosphor/classes/image_types_phosphor.bbclass2
-rw-r--r--meta-phosphor/classes/image_version.bbclass20
-rw-r--r--meta-phosphor/classes/obmc-phosphor-image.bbclass5
-rw-r--r--meta-phosphor/classes/obmc-phosphor-systemd.bbclass2
-rw-r--r--meta-phosphor/classes/phosphor-deploy-ssh-keys.bbclass73
-rw-r--r--meta-phosphor/classes/skeleton-rev.bbclass2
7 files changed, 66 insertions, 40 deletions
diff --git a/meta-phosphor/classes/dbus-dir.bbclass b/meta-phosphor/classes/dbus-dir.bbclass
index f66346399..a8ed3e7ec 100644
--- a/meta-phosphor/classes/dbus-dir.bbclass
+++ b/meta-phosphor/classes/dbus-dir.bbclass
@@ -1,2 +1,2 @@
-dbus_system_confdir="${sysconfdir}/dbus-1/system.d/"
+dbus_system_confdir="${datadir}/dbus-1/system.d/"
dbus_system_servicesdir="${datadir}/dbus-1/system-services/"
diff --git a/meta-phosphor/classes/image_types_phosphor.bbclass b/meta-phosphor/classes/image_types_phosphor.bbclass
index be3bbdf50..64fec000b 100644
--- a/meta-phosphor/classes/image_types_phosphor.bbclass
+++ b/meta-phosphor/classes/image_types_phosphor.bbclass
@@ -502,11 +502,13 @@ def get_pubkey_path(d):
python do_generate_phosphor_manifest() {
purpose = d.getVar('VERSION_PURPOSE', True)
version = do_get_version(d)
+ build_id = do_get_buildID(d)
target_machine = d.getVar('MACHINE', True)
extended_version = (d.getVar('EXTENDED_VERSION', True) or "")
with open('MANIFEST', 'w') as fd:
fd.write('purpose={}\n'.format(purpose))
fd.write('version={}\n'.format(version.strip('"')))
+ fd.write('BuildId={}\n'.format(build_id.strip('"')))
fd.write('ExtendedVersion={}\n'.format(extended_version))
fd.write('KeyType={}\n'.format(get_pubkey_type(d)))
fd.write('HashType=RSA-SHA256\n')
diff --git a/meta-phosphor/classes/image_version.bbclass b/meta-phosphor/classes/image_version.bbclass
index 56ebe665c..17f324e2e 100644
--- a/meta-phosphor/classes/image_version.bbclass
+++ b/meta-phosphor/classes/image_version.bbclass
@@ -7,7 +7,7 @@ def do_get_version(d):
import io
path = d.getVar('STAGING_DIR_TARGET', True) + d.getVar('sysconfdir', True)
path = os.path.join(path, 'os-release')
- parser = configparser.SafeConfigParser(strict=False)
+ parser = configparser.ConfigParser(strict=False)
parser.optionxform = str
version = ''
try:
@@ -26,3 +26,21 @@ def do_get_versionID(d):
version = version.strip('"')
version_id = (hashlib.sha512(version.encode('utf-8')).hexdigest())[:8]
return version_id
+
+def do_get_buildID(d):
+ import configparser
+ import io
+ path = d.getVar('STAGING_DIR_TARGET', True) + d.getVar('sysconfdir', True)
+ path = os.path.join(path, 'os-release')
+ parser = configparser.ConfigParser(strict=False)
+ parser.optionxform = str
+ build_id = ''
+ try:
+ with open(path, 'r') as fd:
+ buf = '[root]\n' + fd.read()
+ fd = io.StringIO(buf)
+ parser.readfp(fd)
+ build_id = parser['root']['BUILD_ID']
+ except:
+ pass
+ return build_id
diff --git a/meta-phosphor/classes/obmc-phosphor-image.bbclass b/meta-phosphor/classes/obmc-phosphor-image.bbclass
index 80c16d22e..4143f34eb 100644
--- a/meta-phosphor/classes/obmc-phosphor-image.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-image.bbclass
@@ -72,6 +72,11 @@ FEATURE_PACKAGES_obmc-user-mgmt-ldap ?= "packagegroup-obmc-apps-user-mgmt-ldap"
# tree under phosphor-ipmi-host
FEATURE_PACKAGES_obmc-net-ipmi:qemuall = ""
+# EVB systems do not have a managed system.
+FEATURE_PACKAGES_obmc-system-mgmt:phosphor-evb = ""
+# QEMU systems are like EVBs and do not have a managed system.
+FEATURE_PACKAGES_obmc-system-mgmt:qemuall = ""
+
# Add new packages to be installed to a package group in
# packagegroup-obmc-apps, not here.
OBMC_IMAGE_BASE_INSTALL = " \
diff --git a/meta-phosphor/classes/obmc-phosphor-systemd.bbclass b/meta-phosphor/classes/obmc-phosphor-systemd.bbclass
index c67fc021f..b1398e007 100644
--- a/meta-phosphor/classes/obmc-phosphor-systemd.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-systemd.bbclass
@@ -99,7 +99,7 @@ def SystemdUnit(unit):
def systemd_parse_unit(d, path):
import configparser
- parser = configparser.SafeConfigParser(strict=False)
+ parser = configparser.ConfigParser(strict=False)
parser.optionxform = str
parser.read('%s' % path)
return parser
diff --git a/meta-phosphor/classes/phosphor-deploy-ssh-keys.bbclass b/meta-phosphor/classes/phosphor-deploy-ssh-keys.bbclass
index a85d2ac2d..277a55c08 100644
--- a/meta-phosphor/classes/phosphor-deploy-ssh-keys.bbclass
+++ b/meta-phosphor/classes/phosphor-deploy-ssh-keys.bbclass
@@ -1,13 +1,16 @@
####
# Copyright 2020 Hewlett Packard Enterprise Development LP.
-#
+# Copyright 2021 Intel Corporation
#
# Add a basic class to add a privileged user from an ssh
# standpoint and a public key passed as an input parameter
# from the local.conf file
# Example:
# INHERIT += "phosphor-deploy-ssh-keys"
-# SSH_KEYS = "vejmarie:/home/openbmc/openbmc/meta-hpe/keys/test.pub;"
+#
+# SSH_KEYS = "vejmarie:/home/openbmc/openbmc/meta-hpe/keys/test.pub"
+# or
+# SSH_KEYS = "vejmarie:/home/openbmc/openbmc/meta-hpe/keys/test.pub;root:/path/to/id_rsa.pub"
####
inherit useradd_base
@@ -15,48 +18,46 @@ inherit useradd_base
IMAGE_PREPROCESS_COMMAND += "deploy_local_user;"
deploy_local_user () {
- if [ "${SSH_KEYS}" != "" ]; then
- group_settings="${SSH_KEYS}"
- current_setting=`echo $group_settings | cut -d ';' -f1`
- remaining=`echo $group_settings | cut -d ';' -f2-`
- while test "x$current_setting" != "x"; do
+ if [ "${SSH_KEYS}" == "" ]; then
+ bbwarn "Trying to deploy SSH keys but input variable is empty (SSH_KEYS)"
+ return
+ fi
- username=`echo ${SSH_KEYS} | awk -F":" '{ print $1}'`
- key_path=`echo ${SSH_KEYS} | awk -F":" '{ print $2}'`
+ ssh_keys="${SSH_KEYS}"
+ while [ "${ssh_keys}" != "" ]; do
+ current_key=`echo "$ssh_keys" | cut -d ';' -f1`
+ ssh_keys=`echo "$ssh_keys" | cut -s -d ';' -f2-`
- if [ ! -d ${IMAGE_ROOTFS}/home/${username} ]; then
- perform_useradd "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} -p '' ${username}"
- fi
+ username=`echo "$current_key" | awk -F":" '{ print $1}'`
+ key_path=`echo "$current_key" | awk -F":" '{ print $2}'`
- if [ ! -d ${IMAGE_ROOTFS}/home/${username}.ssh/ ]; then
- install -d ${IMAGE_ROOTFS}/home/${username}/.ssh/
- fi
+ if [ ! -d ${IMAGE_ROOTFS}/home/${username} ]; then
+ perform_useradd "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} -p '' ${username}"
+ fi
- if [ ! -f ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys ]; then
- install -m 0600 ${key_path} ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys
- else
- cat ${key_path} >> ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys
- fi
+ if [ ! -d ${IMAGE_ROOTFS}/home/${username}.ssh/ ]; then
+ install -d ${IMAGE_ROOTFS}/home/${username}/.ssh/
+ fi
- uid=`cat ${IMAGE_ROOTFS}/etc/passwd | grep "${username}:" | awk -F ":" '{print $3}'`
- guid=`cat ${IMAGE_ROOTFS}/etc/passwd | grep "${username}:" | awk -F ":" '{print $4}'`
+ if [ ! -f ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys ]; then
+ install -m 0600 ${key_path} ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys
+ else
+ cat ${key_path} >> ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys
+ fi
- chown -R ${uid}:${guid} ${IMAGE_ROOTFS}/home/${username}/.ssh
- chmod 600 ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys
- chmod 700 ${IMAGE_ROOTFS}/home/${username}/.ssh
+ uid=`cat ${IMAGE_ROOTFS}/etc/passwd | grep "${username}:" | awk -F ":" '{print $3}'`
+ guid=`cat ${IMAGE_ROOTFS}/etc/passwd | grep "${username}:" | awk -F ":" '{print $4}'`
- is_group=`grep "priv-admin" ${IMAGE_ROOTFS}/etc/group || true`
+ chown -R ${uid}:${guid} ${IMAGE_ROOTFS}/home/${username}/.ssh
+ chmod 600 ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys
+ chmod 700 ${IMAGE_ROOTFS}/home/${username}/.ssh
- if [ -z "${is_group}" ]; then
- perform_groupadd "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} priv-admin"
- fi
+ is_group=`grep "priv-admin" ${IMAGE_ROOTFS}/etc/group || true`
- perform_usermod "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} -a -G priv-admin ${username}"
+ if [ -z "${is_group}" ]; then
+ perform_groupadd "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} priv-admin"
+ fi
- current_setting=`echo $remaining | cut -d ";" -f1`
- remaining=`echo $remaining | cut -d ';' -f2-`
- done
- else
- bbwarn "Trying to deploy SSH keys but input variable is empty (SSH_KEYS)"
- fi
+ perform_usermod "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} -a -G priv-admin ${username}"
+ done
}
diff --git a/meta-phosphor/classes/skeleton-rev.bbclass b/meta-phosphor/classes/skeleton-rev.bbclass
index 75648b004..5e43c34f7 100644
--- a/meta-phosphor/classes/skeleton-rev.bbclass
+++ b/meta-phosphor/classes/skeleton-rev.bbclass
@@ -1,4 +1,4 @@
-SRCREV ?= "81100ae9ee2bb9929989f0fc813e1ac91f8e7ab0"
+SRCREV ?= "77b241c472efc5af618a839493aa8357544ea213"
SKELETON_URI ?= "git://github.com/openbmc/skeleton"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${WORKDIR}/git/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"