Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ZeldaASTscript.hmod
- # Edit the sub folder structure to share the same saves between both 4 weeks roms
- # Games name must be as *Zelda*AST#* with # The week number
- # Games must be single in subfolders
- # Example :
- # The_Legend_of_Zelda_-_AST1_(FR).sfrom
- # The_Legend_of_Zelda_-_AST2_(FR).sfrom
- # The_Legend_of_Zelda_-_AST3_(FR).sfrom
- # The_Legend_of_Zelda_-_AST4_(FR).sfrom
- # v1.2 - March 15th, 2018
- # Based on explanations https://imgur.com/a/mqJMC
- # Hakchi Module by Narkoa
- #Initialization
- #zhome="$mountpoint/var/lib/hakchi/rootfs/usr/share/games"
- zhome="$mountpoint/var/lib/hakchi"
- #zlogfile="$zhome/log"
- #echo "ZBS AST load" > $zlogfile
- #zhome="/var/lib/hakchi/rootfs/usr/share/games"
- # retrieve folders
- #echo "retrieve folders" >> $zlogfile
- zfolder1=$(find "$zhome" -name *Zelda*AST1*) #the full path of game1
- zfolder2=$(find "$zhome" -name *Zelda*AST2*)
- zfolder3=$(find "$zhome" -name *Zelda*AST3*)
- zfolder4=$(find "$zhome" -name *Zelda*AST4*)
- #echo "folder1=$zfolder1" >> $zlogfile
- #echo "folder2=$zfolder2" >> $zlogfile
- #echo "folder3=$zfolder3" >> $zlogfile
- #echo "folder4=$zfolder4" >> $zlogfile
- # test if structure already modified
- #echo "testing folder2" >> $zlogfile
- if [ "$zfolder2" != "" ]; then #if not, apply the modifications
- # retrieve games file name
- #echo "retrieve games" >> $zlogfile
- zfilename1="${zfolder1##*/}" #the full name of game1
- zfilename2="${zfolder2##*/}"
- zfilename3="${zfolder3##*/}"
- zfilename4="${zfolder4##*/}"
- # retrieve games file path
- zpath1="$(dirname $zfolder1)" #the path of game1 file
- zpath2="$(dirname $zfolder2)"
- zpath3="$(dirname $zfolder3)"
- zpath4="$(dirname $zfolder4)"
- # retrieve clover id folder names
- zgood1="${zpath1##*/}" #the good folder name of game1
- zbad2="${zpath2%CLV*}" #the path of game2 folder without bad clover id folder
- zbad3="${zpath3%CLV*}" #the path of game3 folder without bad clover id folder
- zbad4="${zpath4%CLV*}" #the path of game4 folder without bad clover id folder
- #perform modifications
- #echo "rename" >> $zlogfile
- # rename .sfrom from 2 3 and 4 to 1
- mv "$zfolder2" "$zpath2/$zfilename1"
- mv "$zfolder3" "$zpath3/$zfilename1"
- mv "$zfolder4" "$zpath4/$zfilename1"
- # old .png and .dektop delete from 2 3 and 4
- #echo "delete" >> $zlogfile
- find "$zpath2" -name "*.png" -type f -delete
- find "$zpath2" -name "*.desktop" -type f -delete
- find "$zpath3" -name "*.png" -type f -delete
- find "$zpath3" -name "*.desktop" -type f -delete
- find "$zpath4" -name "*.png" -type f -delete
- find "$zpath4" -name "*.desktop" -type f -delete
- # copy of .png and .dektop from 1 to 2 3 and 4
- #echo "copy" >> $zlogfile
- copy "$zpath1/$zgood1.png" "$zpath2"
- copy "$zpath1/$zgood1"\_small.png "$zpath2"
- copy "$zpath1/$zgood1.desktop" "$zpath2"
- copy "$zpath1/$zgood1.png" "$zpath3"
- copy "$zpath1/$zgood1"\_small.png "$zpath3"
- copy "$zpath1/$zgood1.desktop" "$zpath3"
- copy "$zpath1/$zgood1.png" "$zpath4"
- copy "$zpath1/$zgood1"\_small.png "$zpath4"
- copy "$zpath1/$zgood1.desktop" "$zpath4"
- # rename folders from 2 3 and 4 to 1
- #echo "rename folders" >> $zlogfile
- mv "$zpath2" "$zbad2$zgood1"
- mv "$zpath3" "$zbad3$zgood1"
- mv "$zpath4" "$zbad4$zgood1"
- echo === Zelda \"Ancient Stone Tablets\" mod applied === #>> $zlogfile
- else
- echo === Zelda \"Ancient Stone Tablets\" mod not applied === #>> $zlogfile
- fi
- #variables deallocation
- #echo "deallocation" >> $zlogfile
- unset zfolder1 zfolder2 zfolder3 zfolder4
- unset zfilename1 zfilename2 zfilename3 zfilename4
- unset zpath1 zpath2 zpath3 zpath4
- unset zhome zgood1 zbad2 zbad3 zbad4
- unset zlogfile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement