Skip to content

Instantly share code, notes, and snippets.

@clontarfx
Last active May 3, 2024 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clontarfx/bd6830726350f48add0d861cb8bc081d to your computer and use it in GitHub Desktop.
Save clontarfx/bd6830726350f48add0d861cb8bc081d to your computer and use it in GitHub Desktop.
Creates a HTML page that allows mounting of PS ISO using mount.ps3 in webMAN-MOD
#!/bin/bash
# create-index.sh
# Author: clontarfx (GitHub)
# Purpose: Creates a HTML page that allows mounting of PS ISO using mount.ps3 in webMAN-MOD
# Usage: ./create-index.sh <nethost>/<ISO folder>
# Example: ./create-index.sh net0/PSXISO
#
# WARNING: This script expects your BIN/ISO to be at <nethost>/<ISO folder>/<game>/<game.bin>.
# WARNING: If this doesn't match your storage layout, you must modify the script.
#
# You may wish to pipe this to output or directly to file by redirection as you prefer.
# Once the file is generated, place it in a web-accessible location and open using the Web Browser on your PS3.
# The clickable links should allow mount.ps3 to locate and load the image using your nethost path.
netfolder="net0/PSXISO"
if [[ -z "$1" ]]; then
echo "You didn't tell me where your mount point is. Maybe net0/PSXISO?"
exit 1
fi
IFS=""
# Start the HTML content and open the tabs (buttons) div
echo "<html>
<head>
<meta http-equiv=\"cache-control\" content=\"max-age=0\" />
<meta http-equiv=\"cache-control\" content=\"no-cache\" />
<meta http-equiv=\"expires\" content=\"0\" />
<meta http-equiv=\"expires\" content=\"Tue, 01 Jan 1980 1:00:00 GMT\" />
<meta http-equiv=\"pragma\" content=\"no-cache\" />
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
<link rel=\"stylesheet\" href=\"/stylesheet.css\">
<script src=\"/tabs.js\"></script>
<title>netiso to HTML by ClontarfX</title>
</head>
<body>
<div class=\"tab\">"
# Create the buttons
echo " <button class=\"tablinks\" onclick=\"openCity(event, '"#"')\">"#"</button>"
for letter in {A..Z}; do
echo " <button class=\"tablinks\" onclick=\"openCity(event, '"$letter"')\">"$letter"</button>"
done
# Close out the tab div (buttons)
echo "</div>"
# Create the tabcontent divs and populate with entries
echo "
<div id=\""#"\" class=\"tabcontent\">
<h3>#</h3>"
for letter in {0..9}; do
# Get the game folders from the current directory
# Count them...
gamecount=$(ls -d1 {0..9}* | wc -l)
ls -d $letter* | while read game; do
gamebin=$(echo "$game" | sed -e 's/\s/%20/g')
gamedir=$(echo "$game" | sed -e 's/\s/%20/g')
# Create the entries referencing the $netfolder location
echo " <tr>
<td><a href=\"http://127.0.0.1/mount.ps3/$netfolder/$gamedir/$gamebin.bin\">$game</a><br /></td>
</tr> "
done
done
echo "<p>Total: "$gamecount"</p>"
echo "</div>"
for letter in {A..Z}; do
echo "
<div id=\""$letter"\" class=\"tabcontent\">
<h3>"$letter"</h3>"
# Get the game folders from the current directory
# Count them...
gamecount=$(ls -d1 $letter* | wc -l)
ls -d $letter* | while read game; do
gamebin=$(echo "$game" | sed -e 's/\s/%20/g')
gamedir=$(echo "$game" | sed -e 's/\s/%20/g')
# Create the entries referencing the $netfolder location
echo " <tr>
<td><a href=\"http://127.0.0.1/mount.ps3/$netfolder/$gamedir/$gamebin.bin\">$game</a><br /></td>
</tr> "
done
# Close out the tabcontent div
echo "<p>Total: "$gamecount"</p>"
echo " </div>"
# End the entries
done
# End the HTML content
echo " </body>
</html>"
@clontarfx
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment