Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ ! -z "$1" ]; then
- path=$(readlink -f "$1")
- winpath=$(echo $path | sed -E "s/\/cygdrive\/([a-z])/\u\1\:/" | sed "s/\//\\\/g")
- echo Mounting $winpath
- powershell.exe "Mount-DiskImage \"$winpath\""
- isodrive=$(powershell.exe "Get-DiskImage \"$winpath\" | Get-Volume | Select-Object DriveLetter" | grep "\-\-\-" -A1 | tail -n1 | rev | cut -d' ' -f1 | rev | sed -E "s/\r//g")
- if [ ! -z $isodrive ]; then
- echo "Mounted on ${isodrive}:\\"
- cygpath=$(echo $isodrive | sed -E "s/([A-Z])/\/cygdrive\/\l\1/" | sed -E "s/\r//g")
- echo "Cygwin Path: $cygpath"
- zipfile=$(echo $path | rev | cut -d'.' -f2- | rev).zip
- echo "Output zip: $zipfile"
- cd "$cygpath"
- zip -9r "$zipfile" .
- echo "ZIP created, unmounting ISO"
- powershell.exe "Dismount-DiskImage \"$winpath\""
- exit 0;
- fi
- exit 1
- else
- echo "Usage: $0 isofile"
- exit 1
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement