From 553748e76cbbf18ae9d29b3d081a3b44aff7474e Mon Sep 17 00:00:00 2001 From: onefang Date: Mon, 20 May 2019 20:10:57 +1000 Subject: Initial tweaks of the installation stuff. --- InstallItAll.sh | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'InstallItAll.sh') diff --git a/InstallItAll.sh b/InstallItAll.sh index 81ff54f..db6c148 100755 --- a/InstallItAll.sh +++ b/InstallItAll.sh @@ -6,7 +6,7 @@ MYSQL_DB="InfiniteGrid" MYSQL_USER="opensim" OS_USER="opensim" -OSVER="0.8.2.1" +OSVER="0.9.0.1" # Figure out where we are, most of this mess is to troll through soft links. @@ -51,7 +51,9 @@ fi USER=$(whoami) echo "Installing software." -sudo apt-get install mysql-server tmux mono-complete mono-gmcs nant nunit uuid-runtime monit mc +sudo apt-get install mysql-server tmux mono-complete mono-gmcs nunit uuid-runtime monit mc +# nant is done separately, coz it was removed from Debian for some mysterious reason. +sudo apt-get install nant sudo /etc/init.d/mysql restart echo "Setting up OpenSim users." @@ -70,10 +72,7 @@ sudo adduser --system --shell /bin/false --group $OS_USER sudo addgroup $USER $OS_USER echo "Building OpenSim." -./runprebuild.sh -./nant-color -#xbuild /target:clean -#xbuild /p:TargetFrameworkVersion="v4.5" +./BuildIt.sd echo "Setting up OpenSim." sudo rm -fr $OSPATH/opensim-IG_* @@ -88,9 +87,7 @@ cd current for dir in AssetFiles backups caches config db logs do if [ ! -f ../$dir ]; then - sudo cp -fr $dir .. - sudo rm -fr $dir - sudo ln -fs ../$dir $dir + sudo cp -fr example/$dir .. fi done @@ -125,6 +122,4 @@ sudo cp scripts/opensim.tmux.conf /home/$OS_USER/.tmux.conf sudo chown $USER /home/$OS_USER/.tmux.conf sudo chmod 644 /home/$OS_USER/.tmux.conf -sudo scripts/fix_var_run.sh -sudo cat scripts/opensim-crontab.txt | sudo crontab -u $OS_USER - echo "Done installing OpenSim." -- cgit v1.1 From 5c201d0807cd3da51d70d3b06f86319bc975e08c Mon Sep 17 00:00:00 2001 From: onefang Date: Mon, 20 May 2019 21:15:23 +1000 Subject: Typo-- --- InstallItAll.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'InstallItAll.sh') diff --git a/InstallItAll.sh b/InstallItAll.sh index db6c148..0568709 100755 --- a/InstallItAll.sh +++ b/InstallItAll.sh @@ -72,7 +72,7 @@ sudo adduser --system --shell /bin/false --group $OS_USER sudo addgroup $USER $OS_USER echo "Building OpenSim." -./BuildIt.sd +./BuildIt.sh echo "Setting up OpenSim." sudo rm -fr $OSPATH/opensim-IG_* -- cgit v1.1 From ca7a2ed839f8fec5a7d7abbf50fc2c031f192fb5 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 22 May 2019 19:14:35 +1000 Subject: Major tweaking of the scripts to suit the new setup. --- InstallItAll.sh | 137 +++++++++++++++++++++++++++----------------------------- 1 file changed, 67 insertions(+), 70 deletions(-) (limited to 'InstallItAll.sh') diff --git a/InstallItAll.sh b/InstallItAll.sh index 0568709..6467ff8 100755 --- a/InstallItAll.sh +++ b/InstallItAll.sh @@ -1,42 +1,26 @@ #!/bin/bash -OSPATH="/opt/opensim" MYSQL_HOST="localhost" -MYSQL_DB="InfiniteGrid" -MYSQL_USER="opensim" -OS_USER="opensim" - -OSVER="0.9.0.1" - - -# Figure out where we are, most of this mess is to troll through soft links. -PRG="$0" -while [ -h "${PRG}" ] ; do - ls=$(ls -ld "${PRG}") - link=`expr "${ls}" : '.*-> \(.*\)$'` - if expr "${link}" : '.*/.*' > /dev/null; then - PRG="${link}" - else - PRG=$(dirname "${PRG}")/"${link}" - fi -done -PRGDIR=$(dirname "${PRG}") -pushd ${PRGDIR} >/dev/null -PRGDIR=$(pwd) -popd >/dev/null +MYSQL_DB="opensim_SC" +MYSQL_USER="opensim_SC" + +OS_VER="0.9.0.1" + +source scripts/common.sh +getPrgDir # This should all be safe for pre existing installs that are being updated. MYSQL_PASSWORD=$1 # Try to get old database credentials if they exist. -if [ -f ${OSPATH}/config/config.ini ]; then +if [ -f ${OS_PATH}/config/config.ini ]; then # Get the database credentials. declare -A creds while read -d ';' p; do k=$(echo ${p} | cut -d '=' -f 1) v=$(echo ${p} | cut -d '=' -f 2) creds[${k}]="${v}" - done < <(sudo grep ConnectionString ${OSPATH}/config/config.ini | cut -d '"' -f 2) + done < <(sudo grep ConnectionString ${OS_PATH}/config/config.ini | cut -d '"' -f 2) # The above seems the best way to get bash to let the creds assignments survive outside the loop. MYSQL_HOST="${creds[Data Source]}" @@ -50,76 +34,89 @@ fi USER=$(whoami) -echo "Installing software." -sudo apt-get install mysql-server tmux mono-complete mono-gmcs nunit uuid-runtime monit mc +echo "Installing into ${OS_PATH}, as user ${OS_USER} ." +echo "Using MySQL host:${MYSQL_HOST} database:${MYSQL_DB} user:${MYSQL_USER} password:${MYSQL_PASSWORD} ." + + +echo "Installing and compiling software." +sudo apt-get install mariadb-server tmux mono-complete mono-devel nunit uuid-runtime monit # nant is done separately, coz it was removed from Debian for some mysterious reason. sudo apt-get install nant sudo /etc/init.d/mysql restart -echo "Setting up OpenSim users." + +echo "Setting up OpenSim users. This next prompt asks for your MySQL root users password." # "create user if not exists" doesn't exist until MySQL 5.7, so we have to put up with a warning, which we can ignore. mysql -u root -p -h localhost << zzzzEOFzzz create database if not exists $MYSQL_DB; -create user $OS_USER identified by '$MYSQL_PASSWORD'; -create user $OS_USER@localhost identified by '$MYSQL_PASSWORD'; -grant all on $MYSQL_DB.* to $OS_USER; -grant all on $MYSQL_DB.* to $OS_USER@localhost; +create user '$OS_USER' identified by '$MYSQL_PASSWORD'; +create user '$OS_USER'@localhost identified by '$MYSQL_PASSWORD'; +grant all on $MYSQL_DB.* to '$OS_USER'; +grant all on $MYSQL_DB.* to '$OS_USER'@localhost; FLUSH PRIVILEGES; zzzzEOFzzz -echo "Setting up OpenSim." -sudo adduser --system --shell /bin/false --group $OS_USER -sudo addgroup $USER $OS_USER +sudo adduser --system --shell /bin/false --group ${OS_USER} +sudo addgroup ${USER} ${OS_USER} -echo "Building OpenSim." -./BuildIt.sh echo "Setting up OpenSim." -sudo rm -fr $OSPATH/opensim-IG_* -sudo mkdir -p $OSPATH/opensim-IG_$OSVER -sudo cp -fr $PRGDIR/* $OSPATH/opensim-IG_$OSVER - -cd $OSPATH -sudo ln -fs opensim-IG_$OSVER current +sudo rm -fr ${OS_PATH}/opensim-SC_* +sudo mkdir -p ${OS_PATH}/opensim-SC_${OS_VER} +sudo cp -fr $PRGDIR/* ${OS_PATH}/opensim-SC_${OS_VER} +cd ${OS_PATH} +if [ ! -h current ]; then + sudo ln -fs opensim-SC_${OS_VER} current +fi cd current - for dir in AssetFiles backups caches config db logs do - if [ ! -f ../$dir ]; then + if [ ! -d ../$dir ]; then sudo cp -fr example/$dir .. fi done -pushd config/ROBUST >/dev/null +pushd ../config/ROBUST >/dev/null sudo ln -fs ../../current/scripts/common.sh common.sh sudo ln -fs ../../current/scripts/start-sim start-sim sudo ln -fs ../../current/scripts/start-sim stop-sim +sudo sed -i "s@OS_PATH@${OS_PATH}@g" opensim-monit.conf popd >/dev/null -echo "Securing OpenSim." -sudo chown -R $OS_USER:$OS_USER $OSPATH -sudo chmod -R 775 $OSPATH -sudo chmod -R a-x $OSPATH -sudo chmod -R a+X $OSPATH -sudo chmod -R g+w $OSPATH -sudo chmod -R a+x $OSPATH/current/scripts/*.sh -sudo chmod a+x $OSPATH/current/scripts/show-console -sudo chmod a+x $OSPATH/current/scripts/start-sim - -sudo chmod ug+rwx $OSPATH/config -sudo chmod g+s $OSPATH/config -sudo chmod 600 $OSPATH/config/config.ini - -sudo sed -i "s@MYSQL_HOST@${MYSQL_HOST}@g" config/config.ini -sudo sed -i "s@MYSQL_DB@${MYSQL_DB}@g" config/config.ini -sudo sed -i "s@MYSQL_USER@${MYSQL_USER}@g" config/config.ini -sudo chmod 600 config/config.ini -sudo sed -i "s@MYSQL_PASSWORD@${MYSQL_PASSWORD}@g" config/config.ini -sudo chmod 600 config/config.ini - -sudo cp scripts/opensim.tmux.conf /home/$OS_USER/.tmux.conf -sudo chown $USER /home/$OS_USER/.tmux.conf -sudo chmod 644 /home/$OS_USER/.tmux.conf +sudo cp bin/config-include/config_* ../config/ +sudo ln -fs config_localhost.ini ../config/config.ini +sudo sed -i "s@MYSQL_HOST@${MYSQL_HOST}@g" ../config/config_IG.ini +sudo sed -i "s@MYSQL_DB@${MYSQL_DB}@g" ../config/config_IG.ini +sudo sed -i "s@MYSQL_USER@${MYSQL_USER}@g" ../config/config_IG.ini + +sudo sed -i "s@MYSQL_HOST@${MYSQL_HOST}@g" ../config/config_MG.ini +sudo sed -i "s@MYSQL_DB@${MYSQL_DB}@g" ../config/config_MG.ini +sudo sed -i "s@MYSQL_USER@${MYSQL_USER}@g" ../config/config_MG.ini + +sudo sed -i "s@MYSQL_HOST@${MYSQL_HOST}@g" ../config/config_localhost.ini +sudo sed -i "s@MYSQL_DB@${MYSQL_DB}@g" ../config/config_localhost.ini +sudo sed -i "s@MYSQL_USER@${MYSQL_USER}@g" ../config/config_localhost.ini + +sudo chmod 600 ../config/*.ini +sudo sed -i "s@MYSQL_PASSWORD@${MYSQL_PASSWORD}@g" ../config/config_IG.ini +sudo sed -i "s@MYSQL_PASSWORD@${MYSQL_PASSWORD}@g" ../config/config_MG.ini +sudo sed -i "s@MYSQL_PASSWORD@${MYSQL_PASSWORD}@g" ../config/config_localhost.ini +sudo chmod 600 ../config/*.ini + +if [ ! -f /home/${OS_USER}/.tmux.conf ]; then + sudo cp scripts/install/opensim.tmux.conf /home/${OS_USER}/.tmux.conf + sudo chown ${OS_USER}:${OS_USR} /home/${OS_USER}/.tmux.conf + sudo chmod 644 /home/${OS_USER}/.tmux.conf +fi + + +echo "Building OpenSim." +sudo chown -R ${USER}:${USER} ${OS_PATH} * +./BuildIt.sh + + +cd scripts/install +sudo ./secure.sh echo "Done installing OpenSim." -- cgit v1.1 From 53baef9042cb30d29a66933da105029101b455d3 Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 23 May 2019 21:50:45 +1000 Subject: Management scripts encounters the real world, needs patching up. --- InstallItAll.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'InstallItAll.sh') diff --git a/InstallItAll.sh b/InstallItAll.sh index 6467ff8..b7077b8 100755 --- a/InstallItAll.sh +++ b/InstallItAll.sh @@ -49,14 +49,14 @@ echo "Setting up OpenSim users. This next prompt asks for your MySQL root users # "create user if not exists" doesn't exist until MySQL 5.7, so we have to put up with a warning, which we can ignore. mysql -u root -p -h localhost << zzzzEOFzzz create database if not exists $MYSQL_DB; -create user '$OS_USER' identified by '$MYSQL_PASSWORD'; -create user '$OS_USER'@localhost identified by '$MYSQL_PASSWORD'; -grant all on $MYSQL_DB.* to '$OS_USER'; -grant all on $MYSQL_DB.* to '$OS_USER'@localhost; +create user '$MYSQL_USER' identified by '$MYSQL_PASSWORD'; +create user '$MYSQL_USER'@localhost identified by '$MYSQL_PASSWORD'; +grant all on $MYSQL_DB.* to '$MYSQL_USER'; +grant all on $MYSQL_DB.* to '$MYSQL_USER'@localhost; FLUSH PRIVILEGES; zzzzEOFzzz -sudo adduser --system --shell /bin/false --group ${OS_USER} +sudo adduser --system --group ${OS_USER} sudo addgroup ${USER} ${OS_USER} -- cgit v1.1 From 0fd8d363d6a434200b8d4ad0dc53799642bfa583 Mon Sep 17 00:00:00 2001 From: onefang Date: Sat, 29 Jun 2019 21:11:22 +1000 Subject: Deal with "passwordless" Mariadb installs. Thanks to Taylor for helping me figure this out. --- InstallItAll.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'InstallItAll.sh') diff --git a/InstallItAll.sh b/InstallItAll.sh index b7077b8..15f7c03 100755 --- a/InstallItAll.sh +++ b/InstallItAll.sh @@ -47,7 +47,9 @@ sudo /etc/init.d/mysql restart echo "Setting up OpenSim users. This next prompt asks for your MySQL root users password." # "create user if not exists" doesn't exist until MySQL 5.7, so we have to put up with a warning, which we can ignore. -mysql -u root -p -h localhost << zzzzEOFzzz +# Recent Debian based systems install with a passwordless root account, but it only works if run as the OS root user. +# Otherwise you can't get in. Yep, the -p seems to still be needed. +sudo mysql -u root -p -h localhost << zzzzEOFzzz create database if not exists $MYSQL_DB; create user '$MYSQL_USER' identified by '$MYSQL_PASSWORD'; create user '$MYSQL_USER'@localhost identified by '$MYSQL_PASSWORD'; -- cgit v1.1 From 451e158895a5ea5e1064ba28ff35b0b93105ede7 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 24 Jul 2019 17:26:44 +1000 Subject: Make the installation more robust. --- InstallItAll.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'InstallItAll.sh') diff --git a/InstallItAll.sh b/InstallItAll.sh index 15f7c03..3152476 100755 --- a/InstallItAll.sh +++ b/InstallItAll.sh @@ -51,8 +51,8 @@ echo "Setting up OpenSim users. This next prompt asks for your MySQL root users # Otherwise you can't get in. Yep, the -p seems to still be needed. sudo mysql -u root -p -h localhost << zzzzEOFzzz create database if not exists $MYSQL_DB; -create user '$MYSQL_USER' identified by '$MYSQL_PASSWORD'; -create user '$MYSQL_USER'@localhost identified by '$MYSQL_PASSWORD'; +create user if not exists '$MYSQL_USER' identified by '$MYSQL_PASSWORD'; +create user if not exists '$MYSQL_USER'@localhost identified by '$MYSQL_PASSWORD'; grant all on $MYSQL_DB.* to '$MYSQL_USER'; grant all on $MYSQL_DB.* to '$MYSQL_USER'@localhost; FLUSH PRIVILEGES; @@ -119,6 +119,7 @@ sudo chown -R ${USER}:${USER} ${OS_PATH} * cd scripts/install +sudo chmod a+x secure.sh sudo ./secure.sh echo "Done installing OpenSim." -- cgit v1.1 From 398c3eef2da9f14b4b615cd1dfa0fc3c88d5b776 Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 28 Jul 2019 00:41:15 +1000 Subject: apt-get -> apt. --- InstallItAll.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'InstallItAll.sh') diff --git a/InstallItAll.sh b/InstallItAll.sh index 3152476..8d357d9 100755 --- a/InstallItAll.sh +++ b/InstallItAll.sh @@ -39,9 +39,9 @@ echo "Using MySQL host:${MYSQL_HOST} database:${MYSQL_DB} user:${MYSQL_USER} pas echo "Installing and compiling software." -sudo apt-get install mariadb-server tmux mono-complete mono-devel nunit uuid-runtime monit +sudo apt install mariadb-server tmux mono-complete mono-devel nunit uuid-runtime monit # nant is done separately, coz it was removed from Debian for some mysterious reason. -sudo apt-get install nant +sudo apt install nant sudo /etc/init.d/mysql restart -- cgit v1.1 From fa54c89206366e797525ede93e3c3be6134ff787 Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 30 Jul 2019 19:28:51 +1000 Subject: Opensim user needs a proper shell. --- InstallItAll.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'InstallItAll.sh') diff --git a/InstallItAll.sh b/InstallItAll.sh index 8d357d9..5e19a7d 100755 --- a/InstallItAll.sh +++ b/InstallItAll.sh @@ -58,7 +58,7 @@ grant all on $MYSQL_DB.* to '$MYSQL_USER'@localhost; FLUSH PRIVILEGES; zzzzEOFzzz -sudo adduser --system --group ${OS_USER} +sudo adduser --system --shell /bin/bash --group ${OS_USER} sudo addgroup ${USER} ${OS_USER} -- cgit v1.1 From fcbf28bd9e65c5f2a4d5d0eabdf813f1a642a1dd Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 22 Aug 2019 17:01:31 +1000 Subject: config/ROBUST/RobustExtra.ini --- InstallItAll.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'InstallItAll.sh') diff --git a/InstallItAll.sh b/InstallItAll.sh index 5e19a7d..8f9df11 100755 --- a/InstallItAll.sh +++ b/InstallItAll.sh @@ -105,6 +105,8 @@ sudo sed -i "s@MYSQL_PASSWORD@${MYSQL_PASSWORD}@g" ../config/config_IG.ini sudo sed -i "s@MYSQL_PASSWORD@${MYSQL_PASSWORD}@g" ../config/config_MG.ini sudo sed -i "s@MYSQL_PASSWORD@${MYSQL_PASSWORD}@g" ../config/config_localhost.ini sudo chmod 600 ../config/*.ini +sudo touch ../config/ROBUST/RobustExtra.ini +sudo chmod 600 ../config/ROBUST/RobustExtra.ini if [ ! -f /home/${OS_USER}/.tmux.conf ]; then sudo cp scripts/install/opensim.tmux.conf /home/${OS_USER}/.tmux.conf -- cgit v1.1