diff -Nur smeserver-centos2sme-6.9.1.old/root/usr/bin/centos2sme smeserver-centos2sme-6.9.1/root/usr/bin/centos2sme --- smeserver-centos2sme-6.9.1.old/root/usr/bin/centos2sme 2018-03-12 15:13:09.473000000 -0400 +++ smeserver-centos2sme-6.9.1/root/usr/bin/centos2sme 2018-03-12 16:08:07.135000000 -0400 @@ -10,61 +10,95 @@ setenforce 0 yum remove selinux-policy-targeted -y 1>/dev/null +echo "##########################################################################" echo "setting yum repo for SME Server" mkdir /tmp/repo.bak mv /etc/yum.repos.d/*.repo /tmp/repo.bak/ -mv /etc/yum.prosmerepos.d/* /etc/yum.repos.d/ +cp /etc/yum.prosmerepos.d/* /etc/yum.repos.d/ +echo "##########################################################################" echo "importing rpm gpg keys" #yum install wget -y 1>/dev/null for i in $( ls /usr/share/doc/smeserver-centos2sme/keys ); do rpm --import /usr/share/doc/smeserver-centos2sme/keys/$i done +echo "##########################################################################" echo "cleaning yum cache" yum --enablerepo=* clean all 1>/dev/null -echo "cleaning" +echo "##########################################################################" +echo "Removing dhcp-common" # from https://forums.contribs.org/index.php/topic,53304.msg276453/topicseen.html#msg276453 # Stefano found deps issues rpm -e --nodeps dhcp-common -echo "yum upgrade to install sme build of initscript" -yum upgrade -y +echo "##########################################################################" +echo "yum upgrade to install sme build of initscript:" +yum upgrade -y 1>/dev/null + +initscripts=`rpm -q initscripts` + +if [[ $initscripts =~ ^initscripts-[0-9.\-]*\.el[0-9_]+\.sme.*$ ]]; then + echo "... OK"; +else + echo "... something wrong try to manually install the SME version of initscripts. +One possible reason of this is that initscripts from CentOS is a newest version /release than the one in SME repositories."; + exit 1 +fi + # they might have come back with upgrade... rm /etc/yum.repos.d/CentOS*.repo -rf # would make a test here to check if initscript was updated or not ... - +echo "##########################################################################" echo "yum groupinstall" yum --disablerepo=* --enablerepo=smeos,smeupdates groupinstall base -y -echo "set PATH" -PATH="/sbin/e-smith/:$PATH" +# check +if [[ -f /sbin/e-smith/console ]]; then + echo "... all seems good untill now" +else + echo "... exiting something is missing, try again yum --disablerepo=* --enablerepo=smeos,smeupdates groupinstall base -y" + exit 1 +fi -echo "cleaning rpm not necessary or possibly conflicting" +echo "##########################################################################" +echo "cleaning rpm not necessary or possibly conflicting: postfix" yum remove postfix -y 1>/dev/null +echo "##########################################################################" echo "yum upgrade" yum upgrade -y 1>/dev/null -echo "starting runit" +echo "##########################################################################" +echo "starting runit, so we can run a few services" /etc/runit/2 & + +echo "##########################################################################" +echo "cleaning /var/service/" find /var/service/ -type f -iname control -exec rm {} \; +echo "##########################################################################" +echo "start syslog" +/etc/init.d/rsyslog start + +echo "##########################################################################" echo "running post-install event for SME..." echo "but before, we unlink the S10init-passwords action" unlink /etc/e-smith/events/post-install/S10init-passwords /sbin/e-smith/signal-event post-install +echo "##########################################################################" echo "set admin password as set" -#need syslog to work -/etc/init.d/rsyslog start +#need syslog to work. so just in case +/etc/init.d/rsyslog restart /sbin/e-smith/db accounts setprop admin PasswordSet yes /sbin/e-smith/db configuration set PasswordSet yes /sbin/e-smith/db configuration setprop bootstrap-console Restore disabled +echo "... as we copy your current root password as admin password" # here copy root password to admin user !!! grep $USER /etc/shadow | cut -f 2 -d ':'>/tmp/encrypted usermod -p $(cat /tmp/encrypted) admin @@ -73,30 +107,37 @@ # echo "Please give now the password for the created admin user :" # passwd admin +echo "##########################################################################" echo "Cleaning /service subfolders" find /var/service/ -type f -iname control -exec rm {} \; +echo "##########################################################################" echo "force quota check" touch /forcequotacheck -#start rsyslogd service in case ... +#start rsyslogd service in case , as console needs it to run... /etc/init.d/rsyslog restart +echo "##########################################################################" echo "now time to configure your server using the SME Server console" # maybe improve here to launch the configure this server directly #/sbin/e-smith/console /usr/bin/perl -Mesmith::console -Mesmith::console::configure -e "esmith::console::configure->new->doit(esmith::console->new,esmith::ConfigDB->open)" +echo "##########################################################################" echo "set SSHD to accept root login with rsa key" /sbin/e-smith/db configuration setprop sshd status enabled PermitRootLogin yes access public /sbin/e-smith/signal-event remoteaccess-update +echo "##########################################################################" echo "Enable access to server-manager to the following IPs:" -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!" +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!" read validfrom -if [[ ! -z validfrom ]]; then +if [ ! -z "$validfrom" ]; then /sbin/e-smith/db configuration setprop httpd-admin ValidFrom $validfrom /sbin/e-smith/signal-event post-upgrade +else + echo "nothing to do" fi @@ -108,6 +149,7 @@ /sbin/e-smith/db configuration setprop bootstrap-console Restore disabled -# reboot +echo "##########################################################################" echo "you just have to issue a '/sbin/e-smith/signal-event reboot'; or simply 'reboot' and enjoy your SME" echo "But before that, are you sure you have added a working SSH key to ~/.ssh/authorized_keys ?" +echo "##########################################################################"