diff --git a/lets-encrypt/activate-ssl.sh b/lets-encrypt/activate-ssl.sh index b08a1fbb..c021a4b8 100644 --- a/lets-encrypt/activate-ssl.sh +++ b/lets-encrypt/activate-ssl.sh @@ -172,7 +172,7 @@ then fi # Change ServerName in apache.conf -sed -i "s|ServerName nextcloud|ServerName $domain|g" /etc/apache2/apache2.conf +sed -i "s|ServerName $(hostname -s)|ServerName $domain|g" /etc/apache2/apache2.conf sudo hostnamectl set-hostname $domain service apache2 restart @@ -362,8 +362,8 @@ ENDMSG rm $ssl_conf rm -R /root/.local/share/letsencrypt # Change ServerName in apache.conf and hostname - sed -i "s|ServerName $domain|ServerName nextcloud|g" /etc/apache2/apache2.conf - sudo hostnamectl set-hostname nextcloud + sed -i "s|ServerName $domain|ServerName $(hostname -s)|g" /etc/apache2/apache2.conf + sudo hostnamectl set-hostname $(hostname -s) service apache2 restart fi clear diff --git a/nextcloud-startup-script.sh b/nextcloud-startup-script.sh index c8b6223e..13868db0 100644 --- a/nextcloud-startup-script.sh +++ b/nextcloud-startup-script.sh @@ -383,6 +383,7 @@ echo "| - Generate new SSH keys for the server |" echo "| - Generate new MySQL password |" echo "| - Install phpMyadmin and make it secure |" echo "| - Install selected apps and automatically configure them |" +echo "| - Detect and set hostname |" echo "| - Upgrade your system and Nextcloud to latest version |" echo "| - Set secure permissions to Nextcloud |" echo "| - Set new passwords to Ubuntu Server and Nextcloud |" @@ -402,7 +403,7 @@ clear echo -e "\e[0m" # Set keyboard layout -echo "Current keyboard layout is Swedish" +echo "Current keyboard layout is $(setxkbmap -print | grep xkb_symbols | awk '{print $4}' | awk -F"+" '{print $2}')" echo "You must change keyboard layout to your language" echo -e "\e[32m" read -p "Press any key to change keyboard layout... " -n1 -s @@ -432,6 +433,16 @@ ff02::2 ip6-allrouters ETCHOSTS clear + +# VPS? +function ask_yes_or_no() { + read -p "$1 ([y]es or [N]o): " + case $(echo $REPLY | tr '[A-Z]' '[a-z]') in + y|yes) echo "yes" ;; + *) echo "no" ;; + esac +} + if [[ "no" == $(ask_yes_or_no "Do you run this script on a *remote* VPS like DigitalOcean, HostGator or similar?") ]] then echo @@ -487,7 +498,6 @@ then else sleep 1 fi -clear # Pretty URLs echo "Setting RewriteBase to "/" in config.php..." @@ -682,7 +692,6 @@ else sed -i 's/ php_value memory_limit 512M/# php_value memory_limit 512M/g' $NCPATH/.htaccess fi - # Add temporary fix if needed bash $SCRIPTS/temporary-fix.sh rm $SCRIPTS/temporary-fix.sh @@ -700,14 +709,14 @@ rm $SCRIPTS/test_connection.sh rm $SCRIPTS/instruction.sh rm $NCDATA/nextcloud.log rm $SCRIPTS/nextcloud-startup-script.sh -sed -i "s|instruction.sh|nextcloud.sh|g" /home/$UNIXUSER/.bash_profile +sed -i "s|instruction.sh|nextcloud.sh|g" ~/.bash_profile cat /dev/null > ~/.bash_history cat /dev/null > /var/spool/mail/root cat /dev/null > /var/spool/mail/$UNIXUSER cat /dev/null > /var/log/apache2/access.log cat /dev/null > /var/log/apache2/error.log cat /dev/null > /var/log/cronjobs_success.log -sed -i "s|sudo -i||g" /home/$UNIXUSER/.bash_profile +sed -i "s|sudo -i||g" ~/.bash_profile cat /dev/null > /etc/rc.local cat << RCLOCAL > "/etc/rc.local" #!/bin/sh -e @@ -747,15 +756,7 @@ echo -e "| \e[91m#################### Tech and Me - 2017 #################### echo "+--------------------------------------------------------------------+" echo echo -e "\e[0m" - -# VPS? -function ask_yes_or_no() { - read -p "$1 ([y]es or [N]o): " - case $(echo $REPLY | tr '[A-Z]' '[a-z]') in - y|yes) echo "yes" ;; - *) echo "no" ;; - esac -} +clear cat << LETSENC +-----------------------------------------------+ diff --git a/nextcloud_install_production.sh b/nextcloud_install_production.sh index 9c7a1ab3..fb309b7d 100644 --- a/nextcloud_install_production.sh +++ b/nextcloud_install_production.sh @@ -588,7 +588,7 @@ else wget -q $GITHUB_REPO/nextcloud-startup-script.sh -P $SCRIPTS fi -# Welcome message after login (change in /home/$UNIXUSER/.profile +# Welcome message after login (change in ~/.profile if [ -f $SCRIPTS/instruction.sh ] then echo "instruction.sh exists" @@ -667,9 +667,9 @@ CLEARBOOT=$(dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cu echo "$CLEARBOOT" apt autoremove -y apt autoclean -if [ -f /home/$UNIXUSER/*.sh ] +if [ -f ~/*.sh ] then - rm /home/$UNIXUSER/*.sh + rm ~/*.sh fi if [ -f /root/*.sh ] diff --git a/static/change-ncadmin-profile.sh b/static/change-ncadmin-profile.sh index 5ffe81bf..163b13a5 100644 --- a/static/change-ncadmin-profile.sh +++ b/static/change-ncadmin-profile.sh @@ -1,9 +1,9 @@ #!/bin/bash UNIXUSER=$LOGNAME -UNIXUSER_PROFILE="/home/$UNIXUSER/.bash_profile" +UNIXUSER_PROFILE="~/.bash_profile" -rm /home/$UNIXUSER/.profile +rm ~/.profile cat <<-UNIXUSER-PROFILE > "$UNIXUSER_PROFILE" # ~/.profile: executed by the command interpreter for login shells. diff --git a/static/nextant.sh b/static/nextant.sh index 5f502a6a..f798404a 100644 --- a/static/nextant.sh +++ b/static/nextant.sh @@ -9,11 +9,9 @@ NT_RELEASE=nextant-master-$NEXTANT_VERSION.tar.gz NT_DL=https://github.com/nextcloud/nextant/releases/download/v$NEXTANT_VERSION/$NT_RELEASE SOLR_RELEASE=solr-$SOLR_VERSION.tgz SOLR_DL=http://www-eu.apache.org/dist/lucene/solr/$SOLR_VERSION/$SOLR_RELEASE -NC_USER=ncadmin -NT_HOME=/home/$NC_USER NCPATH=/var/www/nextcloud NC_APPS_PATH=$NCPATH/apps/ -SOLR_HOME=$NT_HOME/solr_install/ +SOLR_HOME=~/solr_install/ SOLR_JETTY=/opt/solr/server/etc/jetty-http.xml SOLR_DSCONF=/opt/solr-$SOLR_VERSION/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml SCRIPTS=/var/scripts