updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / darkforces / libdarkforces.sh
blob07a896c346d1539a497191ec074aa4a9c6472753
1 darkforces.run() {
2 local APP_NAME="darkforces"
3 local TMPDIR="${TMPDIR:-/tmp}"
4 local RW_BRANCH="${XDG_DATA_HOME}/${APP_NAME}"
5 local APP_DIR="${TMPDIR}/${APP_NAME}-tmp-${USER}"
6 local BRANCHES_D="/etc/${APP_NAME}.d"
7 local DOSBOX_CONF="${XDG_CONFIG_HOME}/${APP_NAME}/$(basename $(dosbox -printconf))"
8 local __firstRun=false
10 if [ ! -f "${DOSBOX_CONF}" ]; then
11 install -Dm644 $(dosbox -printconf) "${DOSBOX_CONF}"
14 if [ ! -d "${RW_BRANCH}" ]; then
15 __firstRun=true
18 mkdir -p "${RW_BRANCH}" "${APP_DIR}" &&
19 RW_BRANCH="${RW_BRANCH}" modfs -o cow -o "uid=${UID}" -o "gid=${GROUPS[0]}" "${BRANCHES_D}" "${APP_DIR}" &&
20 cd "${APP_DIR}" &&
21 "$@"
23 cd / &&
24 fusermount -u "${APP_DIR}" &&
25 rmdir "${APP_DIR}"
28 darkforces.firstRun() {
29 "${__firstRun}"