File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -42,24 +42,37 @@ p_extract() {
4242 fi
4343}
4444
45+ is_valid_rootfs () {
46+ local path=$1
47+
48+ [[ -d $1 /usr ]] && [[ -d $1 /lib ]] && [[ -f $1 /usr/bin/env ]] && {
49+ [[ -f /usr/bin/sh ]] || [[ -f /bin/bash ]] || [[ -f /bin/sh ]]
50+ } && return 0 || return 1
51+ }
52+
4553login () {
4654 # OPTIONS:
4755 # --disable-special-mounts
4856 # --disable-auto-init
4957 # --disable progress
5058
5159 local root_fs_path
60+ local container_user
5261
5362 while [ $# -gt 0 ]; do
5463 case $1 in
5564 --disable-special-mounts) NO_S_M=true;;
5665 --disable-auto-init) NO_A_I=true;;
5766 --path) root_fs_path=$2 ; shift 2;;
67+ # -b | --bind ) bind=$2; shift 2;;
68+ -u | --user ) container_user=$2 ; shift 2;;
5869 --) shift 1; cmd_string=$* ; break ;;
5970 * ) break ;;
6071 esac
6172 done
6273
74+ # user logic
75+ [[ -z $container_user ]] && container_user=" root"
6376 # TODO: Make it good :)
6477 proot \
6578 --link2symlink \
@@ -97,6 +110,7 @@ login() {
97110 PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
98111 TERM=$TERM \
99112 LANG=C.UTF-8 \
113+ /bin/su -l $container_user \
100114 $cmd_string
101115
102116}
You can’t perform that action at this time.
0 commit comments