#!/bin/sh PS2EMUDIR=GAMES_LIBDIR/ps2emu PS2BINDIR=GAMES_PREFIX_OPT/pcsx2 PS2DIR=GAMES_DATADIR/pcsx2 FILES="memcards bios help Langs logs snap sstates patches plugins .pixmaps" mkdir -p ~/.pcsx2 cd ~/.pcsx2 cleanlinks mkdir -p ${FILES} inis plugins/cfg shopt -s nullglob insfile() { local dest file if [ -n "${2}" ]; then file=${2}/ fi if [ -n "${3}" ]; then dest=${3}/ else dest=${file} fi for f in $(find "${1}/${2}" -maxdepth 1 -type f -printf '%f ') ; do if [ ! -e "${f}" ]; then cp "${1}/${file}${f}" "${dest}${f}" # >& /dev/null fi done } linkfile() { local dest file if [ -n "${2}" ]; then file=${2}/ fi if [ -n "${3}" ]; then dest=${3}/ else dest=${file} fi for f in $(find "${1}/${2}" -maxdepth 1 -type f -printf '%f ') ; do if [ ! -e "${f}" ]; then ln -s "${1}/${file}${f}" "${dest}${f}" fi done } insfile "${PS2DIR}" inis insfile "${PS2EMUDIR}" cfg plugins/cfg linkfile "${PS2BINDIR}" insfile "${PS2DIR}" if [ -d "${PS2DIR}" ]; then for i in ${FILES}; do if [[ -d "${PS2DIR}/${i}" ]] ; then for x in $(find "${PS2DIR}/${i}" -maxdepth 1 -type f -printf '%f '); do if [[ ! -e "${i}/${x}" ]] ; then ln -s "${PS2DIR}/${i}/${x}" "${i}/${x}" fi done elif [[ -f "${PS2DIR}/${i}" ]] ; then if [[ ! -e "${i}" ]] ; then ln -s "${PS2DIR}/${i}" "${i}" fi fi done fi if [[ -d "${PS2EMUDIR}" ]] ; then for i in ${FILES}; do if [[ -d "${PS2EMUDIR}/${i}" ]] ; then for x in $(find "${PS2EMUDIR}/${i}" -maxdepth 1 -type f -printf '%f '); do if [[ ! -e "${i}/${x}" ]] ; then if [ ${i} == "plugins" ]; then echo "Loading new plugin: ${x}" fi ln -s "${PS2EMUDIR}/${i}/${x}" "${i}/${x}" fi done elif [[ -f "${PS2EMUDIR}/${i}" ]] ; then if [[ ! -e "${i}" ]] ; then ln -s "${PS2EMUDIR}/${i}" "${i}" fi fi done fi # check for bios if [[ -z "`cd bios && ls`" ]] ; then # if the bios directory is empty, then ... well ... echo echo "*** Put your BIOS file into ~/.pcsx2/bios/" echo " or pcsx2 may not work!" echo fi # execute program (with args) exec ./pcsx2 "$@"