blob: 659419a14f9b08ed1bddbe276ab3e52fd9a4839a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#!/bin/bash
pkgname=clonehero
# Here's the issue:
#
# Due to filesystem permission problems, a normal user is unable to play
# Clone Hero when it's just installed into /opt like normal. The game is
# unable to write to that folder, so nothing works properly. The only
# way to get the game to work is to run everything like it exists in the
# user's home folder. Unfortunately, symlinks aren't enough.
#
# We copy over all the needed files from /opt to the user's home
# directory, if we find the copy in /opt to be newer than the one the
# user already has. This way, they get new copies of the executable and
# game data whenever there's a new version. Unfortunately, this does
# mean that we have to touch $HOME, and this is an extremely ugly hack.
# I am the second maintainer of this package, and I concur;
# this hack is horrible. I do offer my thanks though to the original
# maintainer; debugging this must have been a pain in the ass.
if [[ ! -d "$HOME/.$pkgname" ]]; then
mkdir -p "$HOME/.$pkgname"
fi
# Replace older files on install/reinstall
if [[ "/opt/$pkgname/Songs" -nt "$HOME/.$pkgname/Songs" ]]; then
echo "Copying songs folder (without overwriting old contents)"
# We don't want to replace the Songs folder, though
cp -rn "/opt/$pkgname/Songs" "$HOME/.$pkgname/Songs"
fi
if [[ "/opt/$pkgname/clonehero_Data" -nt "$HOME/.$pkgname/clonehero_Data" ]]; then
echo "Replacing old data folder"
# This was the name of the data folder before v0.21.7
rm -rf "$HOME/.$pkgname/Clone Hero_Data"
rm -rf "$HOME/.$pkgname/clonehero_Data"
cp -r "/opt/$pkgname/clonehero_Data" "$HOME/.$pkgname/clonehero_Data"
fi
if [[ "/opt/$pkgname/clonehero" -nt "$HOME/.$pkgname/clonehero" ]]; then
echo "Replacing old executable"
# This was the name of the executable before v0.21.7
rm "$HOME/.$pkgname/Clone Hero.x86_64"
cp "/opt/$pkgname/clonehero" "$HOME/.$pkgname/clonehero"
fi
cd "$HOME/.$pkgname"
exec "./clonehero" "$@"
|