|
#!/bin/bash |
|
|
|
|
|
if [ "$#" -ne 1 ]; then |
|
echo "Usage: $0 <target_directory>" |
|
exit 1 |
|
fi |
|
|
|
|
|
TARGET_DIR="$1" |
|
|
|
|
|
if [ ! -d "$TARGET_DIR" ]; then |
|
echo "Target directory $TARGET_DIR does not exist. Creating..." |
|
mkdir -p "$TARGET_DIR" |
|
if [ $? -ne 0 ]; then |
|
echo "Error creating target directory $TARGET_DIR" |
|
exit 1 |
|
fi |
|
fi |
|
|
|
|
|
|
|
URL="http://mirrors.kernel.org/ubuntu/pool/universe/f/fluid-soundfont/fluid-soundfont-gm_3.1-5.3_all.deb" |
|
|
|
|
|
echo "Downloading the deb package..." |
|
wget -q $URL -O fluid-soundfont-gm.deb |
|
|
|
if [ $? -ne 0 ]; then |
|
echo "Error downloading the deb package" |
|
exit 1 |
|
fi |
|
|
|
|
|
TMP_DIR=$(mktemp -d) |
|
|
|
|
|
echo "Extracting the data.tar.zst from the deb package..." |
|
ar -p fluid-soundfont-gm.deb data.tar.zst > $TMP_DIR/data.tar.zst |
|
|
|
if [ $? -ne 0 ]; then |
|
echo "Error extracting the data.tar.zst component from the deb package" |
|
rm -rf $TMP_DIR |
|
exit 1 |
|
fi |
|
|
|
echo "Extracting the contents of data.tar.zst..." |
|
unzstd -o $TMP_DIR/data.tar $TMP_DIR/data.tar.zst |
|
tar -xf $TMP_DIR/data.tar -C $TMP_DIR |
|
|
|
if [ $? -ne 0 ]; then |
|
echo "Error extracting the contents of data.tar.zst" |
|
rm -rf $TMP_DIR |
|
exit 1 |
|
fi |
|
|
|
|
|
echo "Moving the .sf2 file to $TARGET_DIR" |
|
find $TMP_DIR -type f -name '*.sf2' -exec mv {} $TARGET_DIR \; |
|
|
|
|
|
rm -rf $TMP_DIR |
|
rm fluid-soundfont-gm.deb |
|
|
|
echo "Done." |
|
|
|
|