Last active
February 7, 2025 10:37
-
-
Save b4tman/ec3a398a2c842d74c59182a286476218 to your computer and use it in GitHub Desktop.
установка обновлений 1с (запуск установщиков из zip архивов)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh +ex | |
ZDIR="." | |
if [ -d "$1" ]; then | |
ZDIR="$1"; | |
fi | |
# распаковка | |
UDIR=$(mktemp -d) | |
find $ZDIR -iname "*.zip" -exec sh -exc "ZIP={};NAME=\${ZIP##*/};exec unzip \$ZIP -d $UDIR/\${NAME%.*}" ';' | |
# установка | |
find "$UDIR" -name setup -exec sh {} \; | |
# очистка каталогов | |
rm -rvf "$UDIR" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$randomfile = [System.IO.Path]::GetRandomFileName() | |
$temp = Microsoft.PowerShell.Management\Join-Path ([System.IO.Path]::GetTempPath()) "$randomfile" | |
New-Item -ItemType Directory -Force -Path $temp | |
Get-ChildItem "*.zip" | %{ | |
$zip = $_ | |
$dest = Microsoft.PowerShell.Management\Join-Path ($temp) $zip.BaseName | |
New-Item -ItemType Directory -Force -Path $dest | |
Expand-Archive -Path $zip -DestinationPath $dest | |
$setup = Microsoft.PowerShell.Management\Join-Path ($dest) "setup.exe" | |
if (Get-ChildItem $setup) { | |
Start-Process -FilePath $setup -NoNewWindow -Wait | |
} | |
} | |
if ($temp) { | |
Remove-Item -Recurse -Force $temp | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment