| 1 |
#!/bin/bash |
| 2 |
# |
| 3 |
# Dink Smallwood installer extractor |
| 4 |
# Released into the public domain by its creator, |
| 5 |
# Alexander Krivács Schrøder |
| 6 |
# Fixes by Sylvain Beucler 2008 |
| 7 |
# |
| 8 |
# Prerequisites: |
| 9 |
# * 7-Zip command line tool (7z) installed on system (Package called |
| 10 |
# p7zip on Gentoo, p7zip-full under Debian) |
| 11 |
# |
| 12 |
# Parameters: |
| 13 |
# 1. The Dink Smallwood installer file (dinksmallwood108.exe) |
| 14 |
# 2. The location of the extracted files |
| 15 |
|
| 16 |
# Note: for some reason, 7z (and 7-Zip generally) doesn't extract or |
| 17 |
# otherwise detect the following files: |
| 18 |
# |
| 19 |
# dink/Sound/107.mid |
| 20 |
# dink/Sound/6.mid |
| 21 |
# dink/Sound/Battle.mid |
| 22 |
# dink/Sound/Caveexpl.mid |
| 23 |
# dink/Story/SC-SLAY.d |
| 24 |
# dink/Story/SC-LOCK.d |
| 25 |
# dink/Story/SC-PILL.d |
| 26 |
# island/sound/metopen.wav |
| 27 |
# |
| 28 |
# So you might be better off using Wine. |
| 29 |
|
| 30 |
|
| 31 |
# Define globals |
| 32 |
PACKAGENAME=$1 |
| 33 |
DESTINATION=$2 |
| 34 |
ORIGLOC=$(pwd) |
| 35 |
|
| 36 |
# Check if we have gotten our parameters |
| 37 |
if [ "x$PACKAGENAME" = "x" ] || [ "x$DESTINATION" = "x" ]; then |
| 38 |
echo "Usage: $(basename $0) <installer> <output location>" |
| 39 |
exit |
| 40 |
fi |
| 41 |
|
| 42 |
# Check if parameters are valid |
| 43 |
if [ ! -e $PACKAGENAME ]; then |
| 44 |
echo "Error: installer does not exist" |
| 45 |
exit |
| 46 |
fi |
| 47 |
|
| 48 |
if ! which 7z > /dev/null; then |
| 49 |
echo "You need to install 7z" |
| 50 |
exit |
| 51 |
fi |
| 52 |
|
| 53 |
# Create destionation folder and extract files into it |
| 54 |
if mkdir -p $DESTINATION; then |
| 55 |
7z x $PACKAGENAME -o$DESTINATION |
| 56 |
cd $DESTINATION |
| 57 |
|
| 58 |
# Remove plugin directory from installer |
| 59 |
rm -rf \$PLUGINSDIR |
| 60 |
|
| 61 |
# Move files out of folder with odd name |
| 62 |
cd \$_OUTDIR |
| 63 |
mv * .. |
| 64 |
cd .. |
| 65 |
rm -rf \$_OUTDIR |
| 66 |
|
| 67 |
# Remove unnecessary files |
| 68 |
rm DFArc.exe dink.exe dinkedit.exe |
| 69 |
|
| 70 |
# Return to original location |
| 71 |
cd $ORIGLOC |
| 72 |
else |
| 73 |
echo "Error: Could not create destionation folder" |
| 74 |
fi |