mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Merge pull request 46 from dev/76-interactive-shell into develop
This commit is contained in:
commit
4e8c596967
11 files changed
+1903
-8
No files matched your search
@@ -0,0 +1,33 @@
|
||||
# image_ps
|
||||
#
|
||||
# VERSION 0.0.1
|
||||
|
||||
FROM ubuntu:14.04
|
||||
MAINTAINER Peter Honeder <peterhon@microsoft.com>
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y openssh-server wget libstdc++6 libunwind8
|
||||
RUN mkdir /var/run/sshd
|
||||
RUN echo 'root:pass' | chpasswd
|
||||
RUN adduser --shell /opt/app_base/runps.sh --disabled-password --gecos "" test1
|
||||
RUN echo 'test1:pass' | chpasswd
|
||||
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
|
||||
|
||||
RUN cd /root && wget https://github.com/anilgulecha/shellinabox/releases/download/2.14.2/shellinabox_2.14-1_amd64.deb
|
||||
RUN dpkg -i /root/shellinabox_2.14-1_amd64.deb
|
||||
|
||||
# SSH login fix. Otherwise user is kicked off after login
|
||||
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
|
||||
|
||||
ENV NOTVISIBLE "in users profile"
|
||||
RUN echo "export VISIBLE=now" >> /etc/profile
|
||||
|
||||
COPY exec_env/app_base/ /opt/app_base/
|
||||
RUN chmod -R ugo+rX /opt/app_base
|
||||
|
||||
EXPOSE 22
|
||||
EXPOSE 4201
|
||||
|
||||
# start sshd in daemonized mode, start shellinaboxd in interactive mode (must be started that way using docker's CMD)
|
||||
CMD /usr/sbin/sshd && /usr/bin/shellinaboxd -s /:LOGIN -p 4201 -t -v
|
||||
|
||||
+26
-7
@@ -21,6 +21,9 @@ include platform.mk
|
||||
# builds unit tests
|
||||
include tests.mk
|
||||
|
||||
# powershell-run is the main powershell executable
|
||||
include powershell-run.mk
|
||||
|
||||
# These are the main PS dlls:
|
||||
# - System.Management.Automation.dll (the main PS dll)
|
||||
# - commands/modules (they contain cmdlets): management and utility
|
||||
@@ -54,7 +57,7 @@ SRCS_ALL=${STRING_RESOURCES} ${SRCS}
|
||||
CSC=mono Microsoft.Net.ToolsetCompilers.*/tools/csc.exe
|
||||
MCS=mcs
|
||||
|
||||
all: dotnetlibs/System.Management.Automation.dll dotnetlibs/powershell-run.exe dotnetlibs/Microsoft.PowerShell.Commands.Management.dll dotnetlibs/Microsoft.PowerShell.Commands.Utility.dll dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET)
|
||||
all: dotnetlibs/System.Management.Automation.dll $(POWERSHELL_RUN_TARGETS) dotnetlibs/Microsoft.PowerShell.Commands.Management.dll dotnetlibs/Microsoft.PowerShell.Commands.Utility.dll dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET)
|
||||
|
||||
# this is the build rule for SMA.dll
|
||||
dotnetlibs/System.Management.Automation.dll: ${SYS_AUTO_SRCS} dotnetlibs/Microsoft.Management.Infrastructure.dll ../src/assembly-info/System.Management.Automation.assembly-info.cs dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET) $(PLATFORM_SRCS) ${SYS_AUTO_RES_SRCS} ${SYS_AUTO_RES_CS_SRCS}
|
||||
@@ -98,9 +101,6 @@ TypeCatalogGen.exe: ../src/monad/monad/nttargets/assemblies/core/PSAssemblyLoadC
|
||||
CorePsTypeCatalog.cs: powershell-linux.inc TypeCatalogGen.exe System.Reflection.Metadata.dll System.Collections.Immutable.dll
|
||||
LD_LIBRARY_PATH=. mono TypeCatalogGen.exe powershell-linux.inc $@ $(MONAD_EXT)/coreclr/TargetingPack
|
||||
|
||||
dotnetlibs/powershell-run.exe: ../src/powershell-run/powershell-run.cs dotnetlibs/System.Management.Automation.dll dotnetlibs/Microsoft.PowerShell.Commands.Management.dll dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET)
|
||||
$(CSC) -out:$@ -noconfig -nostdlib -target:exe -r:dotnetlibs/System.Management.Automation.dll -r:dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET) ${COREREF} ../src/powershell-run/powershell-run.cs
|
||||
|
||||
# the pinvoke library libps.so
|
||||
|
||||
libps-build/Makefile: ../src/monad-native/src/CMakeLists.txt
|
||||
@@ -137,7 +137,7 @@ prepare:
|
||||
nuget install Microsoft.Net.ToolsetCompilers -pre
|
||||
|
||||
# this is an internal target, it's not intended to be called manually
|
||||
internal-prepare-exec_env:
|
||||
internal-prepare-exec_env: runps.sh
|
||||
rm -rf exec_env
|
||||
mkdir exec_env
|
||||
cp -r ../src/monad_app_base/app_base exec_env
|
||||
@@ -145,17 +145,23 @@ internal-prepare-exec_env:
|
||||
cp -r dotnetlibs/*.exe exec_env/app_base
|
||||
cp -r dotnetlibs/lib* exec_env/app_base
|
||||
cp -r dotnetlibs/corerun exec_env/app_base
|
||||
cp runps.sh exec_env/app_base
|
||||
|
||||
run: dotnetlibs/powershell-run.exe dotnetlibs/corerun dotnetlibs/Microsoft.PowerShell.Commands.Management.dll dotnetlibs/Microsoft.PowerShell.Commands.Utility.dll dotnetlibs/api-ms-win-core-registry-l1-1-0.dll internal-prepare-exec_env
|
||||
run: $(POWERSHELL_RUN_TARGETS) dotnetlibs/corerun dotnetlibs/Microsoft.PowerShell.Commands.Management.dll dotnetlibs/Microsoft.PowerShell.Commands.Utility.dll dotnetlibs/api-ms-win-core-registry-l1-1-0.dll internal-prepare-exec_env
|
||||
# check if corerun is the right one (could be the debug version)
|
||||
if ! diff dotnetlibs/corerun $(MONAD_EXT)/coreclr/Release/corerun; then cp -r $(MONAD_EXT)/coreclr/Release/* dotnetlibs; fi
|
||||
#cd exec_env/app_base && PSMODULEPATH=. LD_LIBRARY_PATH=. ./corerun powershell-run.exe "\"test blah\""
|
||||
#cd exec_env/app_base && PSMODULEPATH=. LD_LIBRARY_PATH=. ./corerun powershell-run.exe "get-module -listavailable"
|
||||
#cd exec_env/app_base && PSMODULEPATH=. LD_LIBRARY_PATH=. ./corerun powershell-run.exe "get-module -listavailable -all"
|
||||
#cd exec_env/app_base && PSMODULEPATH=$(shell pwd)/exec_env/app_base/Modules LD_LIBRARY_PATH=. ./corerun powershell-run.exe "import-module -name Microsoft.PowerShell.Utility"
|
||||
cd exec_env/app_base && PSMODULEPATH=$(shell pwd)/exec_env/app_base/Modules LD_LIBRARY_PATH=. ./corerun powershell-run.exe "import-module -name Microsoft.PowerShell.Utility" '"a","b","c","a","a" | Select-Object -Unique'
|
||||
cd exec_env/app_base && PSMODULEPATH=$(shell pwd)/exec_env/app_base/Modules LD_LIBRARY_PATH=. ./corerun powershell-simple.exe "import-module -name Microsoft.PowerShell.Utility" '"a","b","c","a","a" | Select-Object -Unique'
|
||||
#LD_LIBRARY_PATH=exec_env/app_base exec_env/app_base/corerun exec_env/app_base/powershell-run.exe "\"Hello World!\" |out-default"
|
||||
|
||||
run-interactive: $(POWERSHELL_RUN_TARGETS) dotnetlibs/corerun dotnetlibs/Microsoft.PowerShell.Commands.Management.dll dotnetlibs/Microsoft.PowerShell.Commands.Utility.dll dotnetlibs/api-ms-win-core-registry-l1-1-0.dll internal-prepare-exec_env
|
||||
# check if corerun is the right one (could be the debug version)
|
||||
if ! diff dotnetlibs/corerun $(MONAD_EXT)/coreclr/Release/corerun; then cp -r $(MONAD_EXT)/coreclr/Release/* dotnetlibs; fi
|
||||
cd exec_env/app_base && ./runps.sh
|
||||
|
||||
test: dotnetlibs/ps_test_runner.exe dotnetlibs/corerun dotnetlibs/api-ms-win-core-registry-l1-1-0.dll
|
||||
cd dotnetlibs && LD_LIBRARY_PATH=. ./corerun ps_test_runner.exe
|
||||
|
||||
@@ -184,3 +190,16 @@ clean:
|
||||
cleanall: clean
|
||||
rm -rf System.Reflection.Metadata.* System.Collections.Immutable.*
|
||||
|
||||
docker-build:
|
||||
sudo docker build --no-cache=false -t image_ps .
|
||||
$(eval INSTANCE_ID := $(shell sudo docker inspect -f '{{.Id}}' image_ps))
|
||||
|
||||
docker-run: docker-build
|
||||
sudo docker run -d -P --name test_ps image_ps
|
||||
sudo docker port test_ps 22
|
||||
sudo docker port test_ps 4201
|
||||
|
||||
docker-stop:
|
||||
sudo docker stop test_ps
|
||||
sudo docker rm test_ps
|
||||
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
branch=$(git for-each-ref --format=$'%(objectname) %(refname:short)' refs/heads | awk "/^$(git rev-parse HEAD)/ {print \$2}")
|
||||
echo $branch
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# This is the makefile for all kinds of powershell hosts
|
||||
#
|
||||
# Currently there is powershell-run.exe, which is a very generic interactive and
|
||||
# non-interactive host
|
||||
#
|
||||
|
||||
POWERSHELL_RUN_FOLDER=../src/powershell-run
|
||||
POWERSHELL_RUN_SRCS=$(addprefix $(POWERSHELL_RUN_FOLDER)/, main.cs host.cs ui.cs rawui.cs readline.cs)
|
||||
|
||||
# direct dependencies to be linked in
|
||||
POWERSHELL_RUN_DEPS=dotnetlibs/System.Management.Automation.dll dotnetlibs/Microsoft.PowerShell.Commands.Management.dll dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET)
|
||||
POWERSHELL_RUN_REFS=$(addprefix -r:,$(POWERSHELL_RUN_DEPS))
|
||||
|
||||
POWERSHELL_RUN_TARGETS=dotnetlibs/powershell-run.exe dotnetlibs/powershell-simple.exe
|
||||
|
||||
dotnetlibs/powershell-run.exe: $(POWERSHELL_RUN_SRCS) $(POWERSHELL_RUN_DEPS)
|
||||
$(CSC) -out:$@ -noconfig -nostdlib -target:exe $(POWERSHELL_RUN_REFS) $(COREREF) $(POWERSHELL_RUN_SRCS)
|
||||
|
||||
dotnetlibs/powershell-simple.exe: $(POWERSHELL_RUN_FOLDER)/powershell-run.cs $(POWERSHELL_RUN_DEPS)
|
||||
$(CSC) -out:$@ -noconfig -nostdlib -target:exe $(POWERSHELL_RUN_REFS) $(COREREF) $(POWERSHELL_RUN_FOLDER)/powershell-run.cs
|
||||
|
||||
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
|
||||
cd $SCRIPTDIR
|
||||
echo "launching PS now"
|
||||
PSMODULEPATH=$SCRIPTDIR/Modules LD_LIBRARY_PATH=. ./corerun powershell-run.exe
|
||||
|
||||
Reference in new issue
Block a user