Created
July 5, 2026 20:08
-
-
Save lambdan/88fc4f4288f9480ed377b55a67451eaa to your computer and use it in GitHub Desktop.
to_chd.sh
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 | |
| set -e | |
| INPUT="$1" | |
| OUTPUT="${INPUT%.*}.chd" | |
| if [ -z "$INPUT" ]; then | |
| echo "Usage: $0 <input.iso>" | |
| exit 1 | |
| fi | |
| if [ ! -f "$INPUT" ]; then | |
| echo "Input file not found: $INPUT" | |
| exit 1 | |
| fi | |
| if [ -f "$OUTPUT" ]; then | |
| echo "Output file already exists: $OUTPUT" | |
| exit 1 | |
| fi | |
| chdman createcd -i "$INPUT" -o "$OUTPUT" | |
| echo | |
| echo "ISO size: $(du -h "$INPUT" | cut -f1)" | |
| echo "CHD size: $(du -h "$OUTPUT" | cut -f1)" | |
| echo | |
| read -p "Delete original ISO? (y/N) " -n 1 -r | |
| echo | |
| if [[ $REPLY =~ ^[Yy]$ ]]; then | |
| rm "$INPUT" | |
| echo "Original ISO deleted." | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment