forked from VolumetricBio/LightField
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PrepareSystem
executable file
·100 lines (77 loc) · 1.91 KB
/
PrepareSystem
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
set -e
function blue-bar () {
echo -e "\r\x1B[1;37;44m$*\x1B[K\x1B[0m" 1>&2
}
function unsymlink () {
if [ -h "$1" ]
then
echo Deleting symlink "$1"
rm "$1"
fi
}
function maybe-mkdir () {
if [ ! -d "$1" ]
then
echo Creating directory "$1"
mkdir "$1"
fi
}
function unsymlink-and-maybe-mkdir () {
unsymlink "$1"
maybe-mkdir "$1"
}
##
## /usr/share/lightfield/libexec
##
rm -drv /usr/share/lightfield
##
## /var/cache/lightfield/print-jobs
##
symlink=""
if [ -h /var/cache/lightfield/print-jobs ]
then
symlink=$(readlink -e /var/cache/lightfield/print-jobs)
fi
unsymlink-and-maybe-mkdir /var/cache/lightfield
unsymlink-and-maybe-mkdir /var/cache/lightfield/print-jobs
if [ -n "${symlink}" -a -d "${symlink}" ]
then
echo Relocating cached print jobs from "${symlink}" to /var/cache/lightfield/print-jobs
mv "${symlink}"/* /var/cache/lightfield/print-jobs/
fi
##
## /var/lib/lightfield/model-library
##
symlink=""
if [ -h /var/lib/lightfield/model-library ]
then
symlink=$(readlink -e /var/lib/lightfield/model-library)
fi
unsymlink-and-maybe-mkdir /var/lib/lightfield
unsymlink-and-maybe-mkdir /var/lib/lightfield/model-library
if [ -n "${symlink}" -a -d "${symlink}" ]
then
echo Relocating models from "${symlink}" to /var/lib/lightfield/model-library
mv "${symlink}"/* /var/lib/lightfield/model-library/
fi
mkdir /var/lib/lightfield/software-updates
##
## /var/log/lightfield
##
symlink=""
if [ -h /var/log/lightfield ]
then
symlink=$(readlink -e /var/log/lightfield)
fi
unsymlink-and-maybe-mkdir /var/log/lightfield
if [ -n "${symlink}" -a -d "${symlink}" ]
then
echo Relocating debugging logs from "${symlink}" to /var/log/lightfield
mv "${symlink}"/* /var/log/lightfield/
fi
##
## Permissions
##
chown -R lumen:lumen /var/cache/lightfield /var/lib/lightfield /var/log/lightfield
[ -f /home/lumen/.bashrc ] && mv /home/lumen/.bashrc /home/lumen/.real_bash_profile