Skip to content

Commit

Permalink
Add dapp user
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcelo Politzer committed Aug 31, 2022
1 parent a837bcc commit e1e5df6
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Remove dehash tools
- Updated toolchain version to v0.11.0
- Create a dapp user and set it as the default

## [0.13.0] - 2022-07-22
### Changed
Expand Down
2 changes: 1 addition & 1 deletion configs/default-buildroot-config
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin"
BR2_GENERATE_LOCALE=""
# BR2_SYSTEM_ENABLE_NLS is not set
# BR2_TARGET_TZ_INFO is not set
BR2_ROOTFS_USERS_TABLES=""
BR2_ROOTFS_USERS_TABLES="$(BR2_EXTERNAL_CARTESI_PATH)/users.txt"
BR2_ROOTFS_OVERLAY="skel"
BR2_ROOTFS_PRE_BUILD_SCRIPT=""
BR2_ROOTFS_POST_BUILD_SCRIPT=""
Expand Down
2 changes: 1 addition & 1 deletion configs/lp64d-buildroot-config
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin"
BR2_GENERATE_LOCALE=""
# BR2_SYSTEM_ENABLE_NLS is not set
# BR2_TARGET_TZ_INFO is not set
BR2_ROOTFS_USERS_TABLES=""
BR2_ROOTFS_USERS_TABLES="$(BR2_EXTERNAL_CARTESI_PATH)/users.txt"
BR2_ROOTFS_OVERLAY="skel"
BR2_ROOTFS_PRE_BUILD_SCRIPT=""
BR2_ROOTFS_POST_BUILD_SCRIPT=""
Expand Down
2 changes: 1 addition & 1 deletion configs/min-buildroot-config
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin"
BR2_GENERATE_LOCALE=""
# BR2_SYSTEM_ENABLE_NLS is not set
# BR2_TARGET_TZ_INFO is not set
BR2_ROOTFS_USERS_TABLES=""
BR2_ROOTFS_USERS_TABLES="$(BR2_EXTERNAL_CARTESI_PATH)/users.txt"
BR2_ROOTFS_OVERLAY="skel"
BR2_ROOTFS_PRE_BUILD_SCRIPT=""
BR2_ROOTFS_POST_BUILD_SCRIPT=""
Expand Down
1 change: 1 addition & 0 deletions external/users.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dapp 1000 dapp 1000 = /home/dapp /bin/sh - dapp user
20 changes: 18 additions & 2 deletions skel/sbin/init
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,28 @@ done
/sbin/ifconfig lo 127.0.0.1

if [ -n "$*" ]; then
export HOME=/
if [ -c /dev/rollup ]; then
chown root:dapp /dev/rollup
chmod 660 /dev/rollup
fi

if [ -c /dev/yield ]; then
chown root:dapp /dev/yield
chmod 660 /dev/yield
fi

export PS1='\h:\w # '
if [ -f "$DEFAULT_ENV_FILE" ]; then
source $DEFAULT_ENV_FILE
fi
setsid cttyhack /bin/sh -c "$*"
if [ "$single" == "yes" ]; then
export HOME=/
setsid cttyhack /bin/sh -c "$*"
else
export HOME=/home/dapp/
cd $HOME
setsid cttyhack /bin/su -p dapp -s /bin/sh -c "$*"
fi
else
echo "Nothing to do."
fi
Expand Down

0 comments on commit e1e5df6

Please sign in to comment.