1 |
jpp |
1.1 |
diff -Nur smeserver-centos2sme-6.9.1.old/root/usr/bin/centos2sme smeserver-centos2sme-6.9.1/root/usr/bin/centos2sme |
2 |
|
|
--- smeserver-centos2sme-6.9.1.old/root/usr/bin/centos2sme 2018-03-12 15:13:09.473000000 -0400 |
3 |
|
|
+++ smeserver-centos2sme-6.9.1/root/usr/bin/centos2sme 2018-03-12 16:08:07.135000000 -0400 |
4 |
|
|
@@ -10,61 +10,95 @@ |
5 |
|
|
setenforce 0 |
6 |
|
|
yum remove selinux-policy-targeted -y 1>/dev/null |
7 |
|
|
|
8 |
|
|
+echo "##########################################################################" |
9 |
|
|
echo "setting yum repo for SME Server" |
10 |
|
|
mkdir /tmp/repo.bak |
11 |
|
|
mv /etc/yum.repos.d/*.repo /tmp/repo.bak/ |
12 |
|
|
-mv /etc/yum.prosmerepos.d/* /etc/yum.repos.d/ |
13 |
|
|
+cp /etc/yum.prosmerepos.d/* /etc/yum.repos.d/ |
14 |
|
|
|
15 |
|
|
+echo "##########################################################################" |
16 |
|
|
echo "importing rpm gpg keys" |
17 |
|
|
#yum install wget -y 1>/dev/null |
18 |
|
|
for i in $( ls /usr/share/doc/smeserver-centos2sme/keys ); do |
19 |
|
|
rpm --import /usr/share/doc/smeserver-centos2sme/keys/$i |
20 |
|
|
done |
21 |
|
|
|
22 |
|
|
+echo "##########################################################################" |
23 |
|
|
echo "cleaning yum cache" |
24 |
|
|
yum --enablerepo=* clean all 1>/dev/null |
25 |
|
|
|
26 |
|
|
-echo "cleaning" |
27 |
|
|
+echo "##########################################################################" |
28 |
|
|
+echo "Removing dhcp-common" |
29 |
|
|
# from https://forums.contribs.org/index.php/topic,53304.msg276453/topicseen.html#msg276453 |
30 |
|
|
# Stefano found deps issues |
31 |
|
|
rpm -e --nodeps dhcp-common |
32 |
|
|
|
33 |
|
|
-echo "yum upgrade to install sme build of initscript" |
34 |
|
|
-yum upgrade -y |
35 |
|
|
+echo "##########################################################################" |
36 |
|
|
+echo "yum upgrade to install sme build of initscript:" |
37 |
|
|
+yum upgrade -y 1>/dev/null |
38 |
|
|
+ |
39 |
|
|
+initscripts=`rpm -q initscripts` |
40 |
|
|
+ |
41 |
|
|
+if [[ $initscripts =~ ^initscripts-[0-9.\-]*\.el[0-9_]+\.sme.*$ ]]; then |
42 |
|
|
+ echo "... OK"; |
43 |
|
|
+else |
44 |
|
|
+ echo "... something wrong try to manually install the SME version of initscripts. |
45 |
|
|
+One possible reason of this is that initscripts from CentOS is a newest version /release than the one in SME repositories."; |
46 |
|
|
+ exit 1 |
47 |
|
|
+fi |
48 |
|
|
+ |
49 |
|
|
|
50 |
|
|
# they might have come back with upgrade... |
51 |
|
|
rm /etc/yum.repos.d/CentOS*.repo -rf |
52 |
|
|
|
53 |
|
|
# would make a test here to check if initscript was updated or not ... |
54 |
|
|
- |
55 |
|
|
+echo "##########################################################################" |
56 |
|
|
echo "yum groupinstall" |
57 |
|
|
yum --disablerepo=* --enablerepo=smeos,smeupdates groupinstall base -y |
58 |
|
|
|
59 |
|
|
-echo "set PATH" |
60 |
|
|
-PATH="/sbin/e-smith/:$PATH" |
61 |
|
|
+# check |
62 |
|
|
+if [[ -f /sbin/e-smith/console ]]; then |
63 |
|
|
+ echo "... all seems good untill now" |
64 |
|
|
+else |
65 |
|
|
+ echo "... exiting something is missing, try again yum --disablerepo=* --enablerepo=smeos,smeupdates groupinstall base -y" |
66 |
|
|
+ exit 1 |
67 |
|
|
+fi |
68 |
|
|
|
69 |
|
|
-echo "cleaning rpm not necessary or possibly conflicting" |
70 |
|
|
+echo "##########################################################################" |
71 |
|
|
+echo "cleaning rpm not necessary or possibly conflicting: postfix" |
72 |
|
|
yum remove postfix -y 1>/dev/null |
73 |
|
|
|
74 |
|
|
+echo "##########################################################################" |
75 |
|
|
echo "yum upgrade" |
76 |
|
|
yum upgrade -y 1>/dev/null |
77 |
|
|
|
78 |
|
|
-echo "starting runit" |
79 |
|
|
+echo "##########################################################################" |
80 |
|
|
+echo "starting runit, so we can run a few services" |
81 |
|
|
/etc/runit/2 & |
82 |
|
|
+ |
83 |
|
|
+echo "##########################################################################" |
84 |
|
|
+echo "cleaning /var/service/" |
85 |
|
|
find /var/service/ -type f -iname control -exec rm {} \; |
86 |
|
|
|
87 |
|
|
+echo "##########################################################################" |
88 |
|
|
+echo "start syslog" |
89 |
|
|
+/etc/init.d/rsyslog start |
90 |
|
|
+ |
91 |
|
|
+echo "##########################################################################" |
92 |
|
|
echo "running post-install event for SME..." |
93 |
|
|
echo "but before, we unlink the S10init-passwords action" |
94 |
|
|
unlink /etc/e-smith/events/post-install/S10init-passwords |
95 |
|
|
/sbin/e-smith/signal-event post-install |
96 |
|
|
|
97 |
|
|
+echo "##########################################################################" |
98 |
|
|
echo "set admin password as set" |
99 |
|
|
-#need syslog to work |
100 |
|
|
-/etc/init.d/rsyslog start |
101 |
|
|
+#need syslog to work. so just in case |
102 |
|
|
+/etc/init.d/rsyslog restart |
103 |
|
|
/sbin/e-smith/db accounts setprop admin PasswordSet yes |
104 |
|
|
/sbin/e-smith/db configuration set PasswordSet yes |
105 |
|
|
/sbin/e-smith/db configuration setprop bootstrap-console Restore disabled |
106 |
|
|
|
107 |
|
|
+echo "... as we copy your current root password as admin password" |
108 |
|
|
# here copy root password to admin user !!! |
109 |
|
|
grep $USER /etc/shadow | cut -f 2 -d ':'>/tmp/encrypted |
110 |
|
|
usermod -p $(cat /tmp/encrypted) admin |
111 |
|
|
@@ -73,30 +107,37 @@ |
112 |
|
|
# echo "Please give now the password for the created admin user :" |
113 |
|
|
# passwd admin |
114 |
|
|
|
115 |
|
|
+echo "##########################################################################" |
116 |
|
|
echo "Cleaning /service subfolders" |
117 |
|
|
find /var/service/ -type f -iname control -exec rm {} \; |
118 |
|
|
|
119 |
|
|
+echo "##########################################################################" |
120 |
|
|
echo "force quota check" |
121 |
|
|
touch /forcequotacheck |
122 |
|
|
|
123 |
|
|
-#start rsyslogd service in case ... |
124 |
|
|
+#start rsyslogd service in case , as console needs it to run... |
125 |
|
|
/etc/init.d/rsyslog restart |
126 |
|
|
|
127 |
|
|
+echo "##########################################################################" |
128 |
|
|
echo "now time to configure your server using the SME Server console" |
129 |
|
|
# maybe improve here to launch the configure this server directly |
130 |
|
|
#/sbin/e-smith/console |
131 |
|
|
/usr/bin/perl -Mesmith::console -Mesmith::console::configure -e "esmith::console::configure->new->doit(esmith::console->new,esmith::ConfigDB->open)" |
132 |
|
|
|
133 |
|
|
+echo "##########################################################################" |
134 |
|
|
echo "set SSHD to accept root login with rsa key" |
135 |
|
|
/sbin/e-smith/db configuration setprop sshd status enabled PermitRootLogin yes access public |
136 |
|
|
/sbin/e-smith/signal-event remoteaccess-update |
137 |
|
|
|
138 |
|
|
+echo "##########################################################################" |
139 |
|
|
echo "Enable access to server-manager to the following IPs:" |
140 |
|
|
-echo "Please type IP.IP.IP.IP/255.255.255.255,IP2.IP2.IP2.IP2/255.255.255.255 to allow access to the manager from the dseired IP. Leave blank if you do want to have access to the manager from outside the lan. Fill with 0.0.0.0/0.0.0.0 if you live on the edge!" |
141 |
|
|
+echo "Please type IP.IP.IP.IP/255.255.255.255,IP2.IP2.IP2.IP2/255.255.255.255 to allow access to the manager from the desired IP. Leave blank if you do want to have access to the manager from outside the lan. Fill with 0.0.0.0/0.0.0.0 if you live on the edge!" |
142 |
|
|
read validfrom |
143 |
|
|
-if [[ ! -z validfrom ]]; then |
144 |
|
|
+if [ ! -z "$validfrom" ]; then |
145 |
|
|
/sbin/e-smith/db configuration setprop httpd-admin ValidFrom $validfrom |
146 |
|
|
/sbin/e-smith/signal-event post-upgrade |
147 |
|
|
+else |
148 |
|
|
+ echo "nothing to do" |
149 |
|
|
fi |
150 |
|
|
|
151 |
|
|
|
152 |
|
|
@@ -108,6 +149,7 @@ |
153 |
|
|
/sbin/e-smith/db configuration setprop bootstrap-console Restore disabled |
154 |
|
|
|
155 |
|
|
|
156 |
|
|
-# reboot |
157 |
|
|
+echo "##########################################################################" |
158 |
|
|
echo "you just have to issue a '/sbin/e-smith/signal-event reboot'; or simply 'reboot' and enjoy your SME" |
159 |
|
|
echo "But before that, are you sure you have added a working SSH key to ~/.ssh/authorized_keys ?" |
160 |
|
|
+echo "##########################################################################" |