install_from_cd.sh: Add CD audio ripping functionality
This commit is contained in:
parent
4f8c9ff3db
commit
3ae7cda228
1 changed files with 53 additions and 12 deletions
|
@ -14,7 +14,7 @@ mk_pk3()
|
|||
# grabs a patch .zip from archive.org and saves it as a pk3
|
||||
grab_patch()
|
||||
{
|
||||
wget -nc -O ./pak$2.pk3 http://archive.org/download/hl_shareware_data/valve/$1.zip
|
||||
wget -nc -O ./pak$2.pk4 http://archive.org/download/hl_shareware_data/valve/$1.zip
|
||||
}
|
||||
|
||||
SCRPATH="$( cd "$( dirname $(readlink -nf $0) )" && pwd )"
|
||||
|
@ -42,18 +42,22 @@ if ! [ -f "$CDROM_PATH"/data1.cab ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Grab the cabinet data off the CD
|
||||
mkdir -p ./tmp
|
||||
unshield -d ./tmp x "$CDROM_PATH"/data1.cab
|
||||
# Check if we need to do anything
|
||||
if ! [ -f "$SCRPATH/pak00_cd.pak" ] || ! [ -f "$SCRPATH/pak01_cd.pk3" ]; then
|
||||
# Grab the cabinet data off the CD
|
||||
mkdir -p ./tmp
|
||||
unshield -d ./tmp x "$CDROM_PATH"/data1.cab
|
||||
|
||||
# Let's shove them all into a convenient .pk3dir
|
||||
mkdir -p ./$OUTPK3DIR
|
||||
mv -v ./tmp/Half-Life_PAK_File/valve/pak0.pak ./pak00_cd.pak
|
||||
rsync -av ./tmp/Half-Life_Program_Files/valve/ ./$OUTPK3DIR/
|
||||
mv -v ./tmp/Half-Life_Program_Files/media ./$OUTPK3DIR/media
|
||||
mv -v ./tmp/Half-Life_Program_Files/logos ./$OUTPK3DIR/logos
|
||||
cd ./$OUTPK3DIR
|
||||
mk_pk3 pak01_cd
|
||||
fi
|
||||
|
||||
# Let's shove them all into a convenient .pk3dir
|
||||
mkdir -p ./$OUTPK3DIR
|
||||
mv -v ./tmp/Half-Life_PAK_File/valve/pak0.pak ./pak00_cd.pak
|
||||
rsync -av ./tmp/Half-Life_Program_Files/valve/ ./$OUTPK3DIR/
|
||||
mv -v ./tmp/Half-Life_Program_Files/media ./$OUTPK3DIR/media
|
||||
mv -v ./tmp/Half-Life_Program_Files/logos ./$OUTPK3DIR/logos
|
||||
cd ./$OUTPK3DIR
|
||||
mk_pk3 pak01_cd
|
||||
cd "$SCRPATH"
|
||||
|
||||
# Get the latest patch, because that'll fix the menu assets and add more fun, free content
|
||||
|
@ -72,5 +76,42 @@ grab_patch 11071108 14_1108
|
|||
grab_patch 11081109 15_1109
|
||||
grab_patch 11091110 16_1110
|
||||
|
||||
# Make sure we're back in here
|
||||
cd "$SCRPATH"
|
||||
|
||||
printf "All done. Would you like to rip the the Compact Disc Digital Audio for music?\ny/n: "
|
||||
read CHOICE
|
||||
|
||||
if [[ "$CHOICE" == [Yy]* ]]; then
|
||||
# check if we require rippin tunes
|
||||
if ! [ -f "$SCRPATH/music/track02.wav" ] && ! [ -f "$SCRPATH/music/track02.ogg" ]; then
|
||||
if [ -x "$(command -v cdparanoia)" ]; then
|
||||
mkdir -p "./music"
|
||||
cd "./music"
|
||||
cdparanoia -B
|
||||
rename ".cdda." "." *.wav
|
||||
|
||||
# Maybe the user does not have the physical disc and cdp fails.
|
||||
if [ -f "$SCRPATH/music/track02.wav" ]; then
|
||||
# I'd offer FLAC, but that also requires the ffmpeg plugin
|
||||
if [ -x "$(command -v oggenc)" ]; then
|
||||
printf "All done. Would you like to convert them to OGG for playback compatibility\nas well as space preservation (frees up ~330 MB)?\ny/n: "
|
||||
read CHOICE
|
||||
if [[ "$CHOICE" == [Yy]* ]]; then
|
||||
oggenc *.wav
|
||||
rm *.wav
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
printf "cdparanoia is missing. Cannot rip music.\nPlease run the installer again once you've got it installed.\n"
|
||||
fi
|
||||
else
|
||||
printf "Music is already present.\n"
|
||||
fi
|
||||
fi
|
||||
|
||||
cd "$SCRPATH"
|
||||
|
||||
rm -rfv ./$OUTPK3DIR
|
||||
rm -rfv ./tmp
|
||||
|
|
Loading…
Reference in a new issue