Skip to content

Instantly share code, notes, and snippets.

@Sinistral2099
Last active July 21, 2021 18:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sinistral2099/bc1f8ea023faadb572bd2e97981a340e to your computer and use it in GitHub Desktop.
Save Sinistral2099/bc1f8ea023faadb572bd2e97981a340e to your computer and use it in GitHub Desktop.
Bash scripts for managing ROM files
#!/bin/bash
version="0.2"
if [ "$#" -ne 1 ]; then
echo "Usage: $(basename $0) [7z file]"
exit 0
fi
function error() {
echo -n "$SCRIPTNAME: ERROR occured in line $1: "
shift
echo "$@"
}
echo ${0##.*} $version
#Usage Checks
for command in 7z; do
command -v $command >/dev/null 2>&1
if (( $? != 0 )); then
error $LINENO "$command is not installed."
exit -4
fi
done
tempdir=$(mktemp -d)
7z e "$1" -o"${tempdir}/" -y
7z a "${1%.*}.zip" "${tempdir}/*"
rm -rf "${tempdir}"
#!/bin/bash
version="0.3"
if [ "$#" -ne 1 ]; then
echo "Usage: $(basename $0) [cue file]"
exit 0
fi
function error() {
echo -n "$SCRIPTNAME: ERROR occured in line $1: "
shift
echo "$@"
}
echo ${0##.*} $version
#Usage Checks
for command in chdman; do
command -v $command >/dev/null 2>&1
if (( $? != 0 )); then
error $LINENO "$command is not installed."
exit -4
fi
done
chdmad createcd -i "$1" -o "${1%.*}.chd"
#!/bin/bash
version="0.3"
if [ "$#" -ne 1 ]; then
echo "Usage: $(basename $0) [compressed bincue file]"
exit 0
fi
function error() {
echo -n "$SCRIPTNAME: ERROR occured in line $1: "
shift
echo "$@"
}
echo ${0##.*} $version
#Usage Checks
for command in 7z chdman mktemp; do
command -v $command >/dev/null 2>&1
if (( $? != 0 )); then
error $LINENO "$command is not installed."
exit -4
fi
done
temp=$(mktemp -d)
7z e "$1" -o"$temp" -y
chdman createcd -i "$temp/${1%.*}.cue" -o "$PWD/${1%.*}.chd" -f
rm -rf "$temp"
#!/bin/bash
version="0.2"
if [ "$#" -ne 1 ]; then
echo "Usage: $(basename $0) [compressed bincue file]"
exit 0
fi
function error() {
echo -n "$SCRIPTNAME: ERROR occured in line $1: "
shift
echo "$@"
}
echo ${0##.*} $version
#Usage Checks
for command in 7z binmerge; do
command -v $command >/dev/null 2>&1
if (( $? != 0 )); then
error $LINENO "$command is not installed."
exit -4
fi
done
temp=$(mktemp -d)
7z e "$1" -o"$temp" -y
binmerge -o "$PWD" "$temp/${1%.*}.cue" "${1%.*}"
rm -rf "$temp"
#!/bin/bash
version="0.2"
if [ "$#" -ne 1 ]; then
echo "Usage: $(basename $0) [compressed gdi file]"
exit 0
fi
function error() {
echo -n "$SCRIPTNAME: ERROR occured in line $1: "
shift
echo "$@"
}
echo ${0##.*} $version
#Usage Checks
for command in 7z chdman; do
command -v $command >/dev/null 2>&1
if (( $? != 0 )); then
error $LINENO "$command is not installed."
exit -4
fi
done
temp=$(mktemp -d)
7z e "$1" -o"$temp" -y
chdman createcd -i "$temp/${filename%.*}.gdi" -o "$PWD/${filename%.*}.chd" -f
rm -rf "$temp"
#!/bin/bash
version="0.2"
if [ "$#" -ne 1 ]; then
echo "Usage: $(basename $0) [gdi file]"
exit 0
fi
function error() {
echo -n "$SCRIPTNAME: ERROR occured in line $1: "
shift
echo "$@"
}
echo ${0##.*} $version
#Usage Checks
for command in chdman; do
command -v $command >/dev/null 2>&1
if (( $? != 0 )); then
error $LINENO "$command is not installed."
exit -4
fi
done
chdman createcd -i "$1" -o "${1%.*}.chd"
#!/bin/bash
version="0.2"
if [ "$#" -ne 1 ]; then
echo "Usage: $(basename $0) [zip file]"
exit 0
fi
function error() {
echo -n "$SCRIPTNAME: ERROR occured in line $1: "
shift
echo "$@"
}
echo ${0##.*} $version
#Usage Checks
for command in 7z; do
command -v $command >/dev/null 2>&1
if (( $? != 0 )); then
error $LINENO "$command is not installed."
exit -4
fi
done
tempdir=$(mktemp -d)
7z e "$1" -o"${tempdir}/" -y
7z a "${1%.*}.7z" "${tempdir}/*"
rm -rf "${tempdir}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment