Skip to content
Snippets Groups Projects
Commit e47aed13 authored by Francesco Pham's avatar Francesco Pham
Browse files

openharmony-standard_3.0: add user, run system services as system user


OpenHarmony init system, is responsible for creation of some directories, handling 
permissions and running services with appropriate UIDs/GIDs. Currently in 
meta-openharmony we have everything run as root, which causes some issues.

Adding system user with UID 1000. 
Run system services as system user.

Signed-off-by: default avatarFrancesco Pham <francesco.pham@huawei.com>
parent a71a46b4
No related branches found
No related tags found
1 merge request!89openharmony-standard-3.0: Fixing ACTS failures, adding patches for test timeout increment, add system user, fix typo
......@@ -182,7 +182,7 @@ fi
# "uid" : "system",
# "gid" : ["system", "shell"]
if systemctl -q is-enabled huks.service; then
/system/bin/sa_main /system/profile/huks_service.xml & # SA: 3510
su system -c '/system/bin/sa_main /system/profile/huks_service.xml &' # SA: 3510
sleep "$STARTUP_CMD_SLEEP"
fi
......@@ -192,7 +192,7 @@ fi
# "uid" : "system",
# "gid" : ["system", "shell"]
if systemctl -q is-enabled deviceauth.service; then
/system/bin/deviceauth_service & # SA: 4701 | Required SA: 3510
su system -c '/system/bin/deviceauth_service &' # SA: 4701 | Required SA: 3510
sleep "$STARTUP_CMD_SLEEP"
fi
......@@ -207,7 +207,7 @@ fi
# "/dev/blkio/foreground/tasks"
# ]
if systemctl -q is-enabled accountmgr.service; then
/system/bin/sa_main /system/profile/accountmgr.xml & # SA: 200
su system -c '/system/bin/sa_main /system/profile/accountmgr.xml &' # SA: 200
sleep "$STARTUP_CMD_SLEEP"
fi
......@@ -217,7 +217,7 @@ fi
# "uid" : "system",
# "gid" : ["system", "shell"]
if systemctl -q is-enabled dsoftbus.service; then
/system/bin/sa_main /system/profile/softbus_server.xml & # SA: 1401 4700 | Required SA: 3299
su system -c '/system/bin/sa_main /system/profile/softbus_server.xml &' # SA: 1401 4700 | Required SA: 3299
sleep "$STARTUP_CMD_SLEEP"
fi
......@@ -231,7 +231,7 @@ fi
# "uid" : "system",
# "gid" : ["system", "shell"]
if systemctl -q is-enabled distributedsched.service; then
/system/bin/sa_main /system/profile/distributedsched.xml & # SA: 1401
su system -c '/system/bin/sa_main /system/profile/distributedsched.xml &' # SA: 1401
sleep "$STARTUP_CMD_SLEEP"
fi
......@@ -247,7 +247,7 @@ fi
# "/dev/blkio/foreground/tasks"
# ]
if systemctl -q is-enabled distributed_data.service; then
/system/bin/sa_main /system/profile/distributeddata.xml & # SA: 1301
su system -c '/system/bin/sa_main /system/profile/distributeddata.xml &' # SA: 1301
sleep "$STARTUP_CMD_SLEEP"
fi
......@@ -258,7 +258,7 @@ fi
# "gid" : ["system", "shell"],
# "caps" : ["SYS_TIME", "WAKE_ALARM"]
if systemctl -q is-enabled time.service; then
/system/bin/sa_main /system/profile/time_service.xml & # SA: 1401 180 3702
su system -c '/system/bin/sa_main /system/profile/time_service.xml &' # SA: 1401 180 3702
sleep "$STARTUP_CMD_SLEEP"
fi
......@@ -270,7 +270,7 @@ fi
# "gid" : ["system"],
# "caps" : ["SYS_PTRACE", "KILL"]
if systemctl -q is-enabled foundation.service; then
/system/bin/sa_main /system/profile/foundation.xml & # SA: 180 182 3203 3299 3301 3308 3501 4010 | Required SA: 4700
su system -c '/system/bin/sa_main /system/profile/foundation.xml &' # SA: 180 182 3203 3299 3301 3308 3501 4010 | Required SA: 4700
sleep "$STARTUP_CMD_SLEEP"
fi
......@@ -280,7 +280,7 @@ fi
# "uid" : "system",
# "gid" : ["media_rw", "system"]
if systemctl -q is-enabled media.service; then
/system/bin/sa_main /system/profile/media_service.xml &
su system -c '/system/bin/sa_main /system/profile/media_service.xml &'
sleep "$STARTUP_CMD_SLEEP"
fi
......@@ -291,7 +291,7 @@ fi
# "gid" : ["system", "shell"],
# "caps" : ["SYS_TIME"]
if systemctl -q is-enabled inputmethod.service; then
/system/bin/sa_main /system/profile/inputmethod_service.xml & # SA: 180 1401 3703
su system -c '/system/bin/sa_main /system/profile/inputmethod_service.xml &' # SA: 180 1401 3703
sleep "$STARTUP_CMD_SLEEP"
fi
......
......@@ -1969,3 +1969,8 @@ EXCLUDE_FROM_SHLIBS = "1"
# To avoid excessive diskspace blowup, we are stripping our executables
INSANE_SKIP:${PN} += "already-stripped"
inherit useradd
USERADD_PACKAGES = "${PN}"
USERADD_PARAM:${PN} = "-u 1000 -U -s /bin/sh system"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment