-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·41 lines (30 loc) · 1.15 KB
/
install.sh
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
#!/bin/bash
export DFPATH="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
symlink() {
echo "SYNC $1 $2"
pushd $1 > /dev/null
for f in $(find . ! -path . | sed "s|^\./||"); do
if [ -d $f ]; then
mkdir -p $2$f
else
rm $2$f
ln -s $(pwd)/$f $2$f
fi
done;
popd > /dev/null
}
if [ "$USER" == "root" ]; then
echo "RUN AS ROOT"
[ -d ${DFPATH}/root/ ] && symlink ${DFPATH}/root /
[ -d ${DFPATH}/$HOSTNAME/root ] && symlink ${DFPATH}/$HOSTNAME/root /
# Disable light-locker
[ -e /etc/xdg/autostart/light-locker.desktop ] && mv /etc/xdg/autostart/light-locker.desktop /etc/xdg/autostart/light-locker.desktop.bak
# Disable network manage applet, manage in userspace
[ -e /etc/xdg/autostart/nm-applet.desktop ] && mv /etc/xdg/autostart/nm-applet.desktop /etc/xdg/autostart/nm-applet.desktop.bak
else
echo "RUN AS nonroot $USER"
[ -d ${DFPATH}/home/ ] && symlink ${DFPATH}/home ~/
[ -d ${DFPATH}/$HOSTNAME/home ] && symlink ${DFPATH}/$HOSTNAME/home ~/
fi
# Check for root/nonroot within this script as well.
[ -f $HOSTNAME/install.sh ] && ./$HOSTNAME/install.sh