06-02-2008, 08:24 PM
About
To make upgrading easier, I've created a bash script to move all pk3's except common-spog.pk3 and data[0-9]{8}.pk3 to a new copy of Nexuiz.
Instructions
1. Save the following code as nn_map_copy.sh in your Nexuiz data directory.
To make upgrading easier, I've created a bash script to move all pk3's except common-spog.pk3 and data[0-9]{8}.pk3 to a new copy of Nexuiz.
Instructions
1. Save the following code as nn_map_copy.sh in your Nexuiz data directory.
Code:
#!/bin/bash
# nn_map_copy.sh - 06/02/2008 - v0.8
# Tyler "-z-" Mulligan of www.nexuizninjaz.com
# Used to copy all packages minus the common spog and data pack to a new dir
# Destination folder name, should be in the same directory as this Nexuiz' parent directory
echo "Where are these bad boys going? (Name of the new Nexuiz directory)"
read destination
# Copying or Moving?
echo "What action would you like to perform?"
PS3='Enter a #: '
# bash select
select action in "Copy" "Move"
do
echo "Preparing to $action!"
break # Break, otherwise endless loop
done
# Check for valid folder name - nohacksplz
if [[ $destination =~ ^[a-zA-Z0-9_-][a-zA-Z0-9_-]*$ ]]; then
# Prepend the double drop
final_destination="../../$destination/data"
# Check to see if the destination directory exists
if [ -d "$final_destination" ]; then
# Create temp directory for common-spog.pk3 and data pack
if [ -d "temp" ]; then
echo "/!\ Directory \"temp\" already exists (but that's okay!)"
else
`mkdir temp`
fi
# Get the name of the data pack and move it with common-spog.pk3
datapack=`ls |grep 'data[0-9]\{8\}'`
# If you already moved these, it'll break here. Let the script do the work.
`mv $datapack temp/`
`mv common-spog.pk3 temp/`
# Perform the action
echo $action"ing pk3's to \"$final_destination\""
if [ $action == "Move" ]; then
mv *.pk3 "$final_destination"
else
cp *.pk3 "$final_destination"
fi
# Clean up - Move common-spog.pk3 and data pack back to the data dir
echo "Removing temp files"
`mv temp/* .`
`rmdir temp`
else
"/!\ Destination does not exist \"$final_destination\""
fi
else
echo "/!\ The destination \"$destination\" failed the search pattern \"[a-zA-Z0-9_-]+\""
fi
exit 0
2. chmod it so you can run it
Code:
chmod +x nn_map_copy.sh
3. Grab a copy the latest Nexuiz build and extract it to the same parent as the one you're upgrading from:
Code:
my_nexuiz_servers
old_server
new_server
4. Run it
Code:
./nn_map_copy.sh
5. Answer the questions.
Code:
Where are these bad boys going? (Name of the new Nexuiz directory)
new_server
What action would you like to perfom?
1) Copy
2) Move
Enter a #: 1
Preparing to Copy!
Copying pk3's to "../../new_server"
Removing temp files
Yay!