3 # A wrapper for applications that need write access
4 # to a directory that is write protected. We just link
5 # it to somewhere in home and it will work :)
12 path_program
="/usr/share/gtkradiant"
14 # Where will we put the files?
15 # (Somewhere in home would make sense)
16 path_target
=~
/.radiant
/1.6.0
18 # Make sure that the temp path is unique
20 path_temp
="/tmp/gtkradiant-`id -un`"
22 # $path_link are the folders where write access
23 # is required. Both variables are relative to the
26 path_app
="radiant.bin"
28 # This is required if the application would find out
29 # its correctly installed path otherwise
35 # Install the temporary folder
36 install -d "$path_temp"
38 # Link everything from the program in the temporary folder
39 for file_target
in ${path_program}/*; do
40 if [[ "$hardlink_app" = "true" && "$path_temp/${file_target##*/}" = "$path_temp/$path_app" ]]; then
41 if [ ! -e "$path_temp/$path_app" ]; then
42 ln "$file_target" "$path_temp/$path_app"
44 elif [ ! -L "$path_temp/${file_target##*/}" ]; then
45 ln -s "$file_target" "$path_temp/${file_target##*/}"
49 # Link all folders that need write access
50 for file_link
in ${path_link[@]}; do
51 if [ ! -d "$path_target/$file_link" ]; then
52 install -d "$path_target/$file_link"
54 if [ ! -L "$path_temp/$file_link" ]; then
55 ln -s "$path_target/$file_link" "$path_temp/$file_link"
59 # Start the application