File tree 2 files changed +27
-13
lines changed
2 files changed +27
-13
lines changed Original file line number Diff line number Diff line change @@ -29,21 +29,18 @@ using namespace 'ghcr.io/startautomating/roughdraft'
29
29
param ()
30
30
31
31
$env: IN_CONTAINER = $true
32
-
33
- $global :ContainerInfo = [Ordered ]@ {
34
- MountedPaths = if (Test-Path ' /proc/mounts' ) {
35
- @ (
36
- (Select-String " \S+\s(?<p>\S+).+rw?,.+symlinkroot=/mnt/host" " /proc/mounts" ).Matches.Groups |
37
- Where-Object Name -eq p |
38
- Get-Item - path { $_.Value }
39
- )
40
- }
41
- }
42
- $global :ContainerInfo.MountedFiles = $global :ContainerInfo.MountedPaths | Get-ChildItem - File - Recurse
32
+ $PSStyle.OutputRendering = ' Ansi'
33
+
34
+ $mountedDrives = @ (if (Test-Path ' /proc/mounts' ) {
35
+ (Select-String " \S+\s(?<p>\S+).+rw?,.+symlinkroot=/mnt/host" " /proc/mounts" ).Matches.Groups |
36
+ Where-Object Name -eq p |
37
+ Get-Item - path { $_.Value } |
38
+ Mount-RoughDraft
39
+ })
43
40
44
41
if ($global :ContainerInfo.MountedPaths ) {
45
- " Mounted $ ( $global :ContainerInfo .MountedFiles. Length ) files from $ ( $ global :ContainerInfo .MountedPaths.Length ) paths :" | Out-Host
46
- $global :ContainerInfo .MountedPaths | Out-Host
42
+ " Mounted $ ( $mountedDrives . Length ) drives :" | Out-Host
43
+ $mountedDrives | Out-Host
47
44
}
48
45
49
46
if ($args ) {
Original file line number Diff line number Diff line change @@ -31,4 +31,21 @@ if ($partsDirectory) { # If we have parts directory
31
31
}
32
32
}
33
33
# endregion Import Parts
34
+
35
+ # region Export Myself
36
+
37
+ # Get my module
38
+ $MyModule = $MyInvocation.MyCommand.ScriptBlock.Module
39
+ # and decorate it with my name (this enables extensibility)
40
+ $MyModule.pstypenames.insert (0 , $MyModule.Name )
41
+ # and set a variable with my name that points to me.
42
+ $ExecutionContext.SessionState.PSVariable.Set ($MyModule.Name , $myModule )
43
+ # endregion Export Myself
44
+
45
+ # region Mount Myself
46
+ # Mount myself as a drive
47
+ $newDriveSplat = @ {PSProvider = ' FileSystem' ;ErrorAction = ' Ignore' ;Scope = ' Global' }
48
+ New-PSDrive - Name $MyModule.Name - Root ($MyModule | Split-Path ) @newDriveSplat
49
+ # endregion Mount Myself
50
+
34
51
Export-ModuleMember - Function *-* - Alias *
You can’t perform that action at this time.
0 commit comments