Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove last root requirements #130

Merged
merged 5 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ RUN <<EOF
-a slirp4netns \
-a rootlesskit \
-a rootlesskit-docker-proxy \
-a nsenter
-a nsenter \
--disable-manifest-validation
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be removed when schema is merged and we've updated to valid SDK

EOF

ENTRYPOINT [ "/opt/axis/acapsdk/sysroots/x86_64-pokysdk-linux/usr/bin/eap-install.sh" ]
15 changes: 9 additions & 6 deletions app/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"schemaVersion": "1.3",
"schemaVersion": "1.8.0",
"resources": {
"linux": {
"user": {
Expand All @@ -22,14 +22,11 @@
"embeddedSdkVersion": "3.0",
"vendorUrl": "https://www.axis.com",
"runMode": "once",
"version": "2.1.0-preview"
"version": "2.0.2-fw_sync"
},
"installation": {
"postInstallScript": "postinstallscript.sh"
},
"uninstallation": {
"preUninstallScript": "preuninstallscript.sh"
},
"configuration": {
"paramConfig": [
{
Expand All @@ -52,7 +49,13 @@
"default": "no",
"type": "enum:no|No, yes|Yes"
}
]
],
"configuration": {
"containers": {
"containerHost": true,
"createDockerSymlinks": true
}
}
}
}
}
44 changes: 0 additions & 44 deletions app/postinstallscript.sh
Original file line number Diff line number Diff line change
@@ -1,49 +1,5 @@
#!/bin/sh -e

if [ "$(id -un)" != "root" ]; then
logger -p user.warn "$0: Must be run as 'root' instead of user '$(id -un)'."
exit 77 # EX_NOPERM
fi

# Get name and uid of acap user and group
_appname=dockerdwrapper
_appdirectory=/usr/local/packages/$_appname
_uname="$(stat -c '%U' "$_appdirectory")"
_uid="$(id "$_uname" -u)" # user id
_gid="$(id "$_uname" -g)" # user group id
_gname="$(id "$_uname" -gn)" # user group name
_all_gids="$(id "$_uname" -G)" # user sub-group ids

# If the device supports cgroups v2 we need to start the user.service
if [ ! -d /sys/fs/cgroup/unified ]; then
# Update the app service file to Require [email protected]

echo "[Unit]
After=user@$_uid.service
Requires=user@$_uid.service" >> /etc/systemd/system/sdkdockerdwrapper.service

fi

# Create mapping for subuid and subgid - both shall use user id as first value!
echo "$_uid:100000:65536" >> /etc/subuid
for sub_group_id in $_all_gids ; do
if [ "$sub_group_id" -ne "$_gid" ]; then
echo "$_uid:$sub_group_id:1" >> /etc/subgid
fi
done
echo "$_uid:100000:65536" >> /etc/subgid

# Update the app service file to work for our special case
cat >> /etc/systemd/system/sdkdockerdwrapper.service << EOF
[Unit]
BindsTo=containerd.service
After=network-online.target containerd.service var-spool-storage-SD_DISK.mount
Wants=network-online.target
EOF

# Reload daemon for service file changes to take effect
systemctl daemon-reload

# *** non-root user should be able to do this ****

# Move the daemon.json file into localdata folder
Expand Down
16 changes: 0 additions & 16 deletions app/preuninstallscript.sh

This file was deleted.