mrrl-logincaps

MRRL version of logincaps
git clone https://ccx.te2000.cz/git/mrrl-logincaps
Log | Files | Refs

loginexec (728B)


      1 #!/command/execlineb -S0
      2 multisubstitute {
      3 	importas HOME HOME
      4 	importas USER USER
      5 	importas SHELL SHELL
      6 }
      7 
      8 ifthenelse -s { test -d $HOME } {
      9 	cd $HOME
     10 } {
     11 	cd /
     12 }
     13 
     14 ifelse -n { test -x ${HOME}/loginexec } {
     15 	s6-setuidgid $USER
     16 	nosuid
     17 	exec -l $SHELL
     18 }
     19 
     20 foreground { printf "%s: running %s\n" $0 ${HOME}/loginexec }
     21 piperw 10 8
     22 piperw 9 11
     23 background {
     24 	fdmove 0 10
     25 	fdmove 1 11
     26 	fdclose 8
     27 	fdclose 9
     28 	fdclose 10
     29 	fdclose 11
     30 	#sleep 365d
     31 	importas -D "" LOGINPASS_FD LOGINPASS_FD
     32 	ifelse {
     33 		test -n $LOGINPASS_FD
     34 	} {
     35 		fdclose $LOGINPASS_FD
     36 		unexport LOGINPASS_FD
     37 		logincaps
     38 	}
     39 	logincaps
     40 }
     41 fdclose 10
     42 fdclose 11
     43 export LOGINCAP_READFD 9
     44 export LOGINCAP_WRITEFD 8
     45 s6-envuidgid $USER
     46 applyuidgid-caps -U ""
     47 ${HOME}/loginexec