-
Notifications
You must be signed in to change notification settings - Fork 23
/
2unix
82 lines (68 loc) · 3.21 KB
/
2unix
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
#!/bin/bash
export NVOC="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# make log folder, re/mount new one
mkdir -p "${NVOC}/nvoc_logs"
if ! mountpoint -q "${NVOC}/nvoc_logs"
then
if sudo mount -t tmpfs -o defaults,noatime,nosuid,nodev,noexec,mode=1777,size=512M nvoc_logs_$(echo ${NVOC} | shasum | head -c 6) ${NVOC}/nvoc_logs
then
exit
fi
fi
# check 1bash for errors
if [[ ! -e "${NVOC}/1bash" || "$(which shellcheck)" != "" && $(shellcheck -e 2034 -f gcc "${NVOC}/1bash" | grep -c error) != 0 ]]
then
echo "################################################################################"
echo " !! There is something wrong with your 1bash settings file, nvOC can't start."
echo " Check if it exists or contains errors. SSH access is now being enabled to"
echo " let you debug. This program will restart in a minute"
echo ""
sudo cp /etc/init/ssh.conf-on /etc/init/ssh.conf
sleep 60
exit
fi
if [ ! -e "${NVOC}/1bash.template" ]
then
echo "1bash.template is missing, downloading it"
wget -N https://github.com/papampi/nvOC_by_fullzero_Community_Release/blob/release/1bash.template -O ${NVOC}/1bash.template
fi
# check 1bash revision mismatch
source "${NVOC}/1bash"
current_1bash_ver="$nvOC_1bash_ver"
source "${NVOC}/1bash.template"
template_1bash_ver="$nvOC_1bash_ver"
last_compatible_1bash_ver="$nvOC_1bash_last_compatible"
least_compatible_1bash_ver="$nvOC_1bash_least_compatible"
if [ $current_1bash_ver -lt $least_compatible_1bash_ver ]
then
echo -e " $(tput bold)################################################################################ $(tput sgr0)"
echo ""
echo -e " \e[31m Your 1bash revision is not compatible with latest update"
echo " Please update your 1bash with latest 1bash.template and restart nvOC"
echo " SSH access will be enabled and this program restarts in a minute"
echo -e " $(tput sgr0)"
echo -e " $(tput bold)################################################################################ $(tput sgr0)"
sudo cp /etc/init/ssh.conf-on /etc/init/ssh.conf
sleep 60
exit
elif [ $current_1bash_ver -lt $last_compatible_1bash_ver ]
then
echo "################################################################################"
echo " !! Your 1bash revision is older than last compatible version. This could"
echo " potentially cause errors if you're using features that have been reworked."
echo " Updating your 1bash with latest 1bash.template is strongly recommended."
echo " SSH access is now being enabled to let you update yor 1bash. "
echo " nvOC will now try to run anyway in 10 seconds"
echo ""
sudo cp /etc/init/ssh.conf-on /etc/init/ssh.conf
sleep 10
elif [ $current_1bash_ver -lt $template_1bash_ver ]
then
echo "################################################################################"
echo " !! Your 1bash revision is older than the available template.There are new"
echo " features available if you update your 1bash with latest 1bash.template."
echo " However, Updating your 1bash is not strictly required."
echo ""
fi
# TODO: if this is a git repo, check updates on current git branch, give warning, start pre-fetching in background, do not pull them automatically
bash "${NVOC}/3main"