0

I'm trying to install Guacamole through a script. When it comes to link the files stored in /etc/guacamole to tomcat8 directory, the following line works well when executed in the shell :

ln -s /etc/guacamole/ /usr/share/tomcat8/.guacamole

The result is :

/usr/share/tomcat8/.guacamole/[files]

But when the same command is executed through the script, the result is :

/usr/share/tomcat8/.guacamole/guacamole/[files]

Which will cause errors.

Here is the full script :

#!/bin/bash

apt-get update
apt-get upgrade -y
apt-get dist-upgrade -y

apt-get install -y apt-transport-https 
apt-get install -y libcairo2-dev libjpeg62-turbo-dev libpng12-dev libossp-uuid-dev libfreerdp-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libpulse-dev libssl-dev libvorbis-dev libwebp-dev tomcat8 apache2 php5 libapache2-mod-php5 php5-curl git make gcc 

a2dissite 000-default
rm -r /var/www/*
a2enmod php5
a2enmod proxy_http ssl
php5enmod curl

wget http://downloads.sourceforge.net/project/guacamole/current/source/guacamole-server-0.9.9.tar.gz
tar -xzf guacamole-server-0.9.9.tar.gz

cd guacamole-server-0.9.9
./configure --with-init-dir=/etc/init.d
make
make install

cd ..
rm -r guacamole-server-0.9.9

wget http://downloads.sourceforge.net/project/guacamole/current/binary/guacamole-0.9.9.war
mv guacamole-0.9.9.war /var/lib/tomcat8/webapps/guacamole.war

update-rc.d guacd defaults
ldconfig

cd

mkdir /usr/share/tomcat8/.guacamole
mkdir /etc/guacamole

cp guacamole.properties /etc/guacamole/
cp user-mapping.xml /etc/guacamole/

cp guacamole.apache.conf /etc/apache2/sites-available/
a2ensite guacamole.apache.conf

ln -s /etc/guacamole/ /usr/share/tomcat8/.guacamole

/etc/init.d/guacd start
/etc/init.d/tomcat8 restart
/etc/init.d/apache2 restart
ilkkachu
  • 138,973
JeanneD4RK
  • 151
  • 4

1 Answers1

3

If the link is already there then the new link will be made inside the directory pointing to the link. Ideally you should delete/move it before creating the link

/bin/rm /usr/share/tomcat8/.guacamole
ln -s /etc/guacamole/ /usr/share/tomcat8/.guacamole

EDIT : I saw that you create this directory in your script. Just remove that line. It should then work. Remove the following line from your script

mkdir /usr/share/tomcat8/.guacamole
amisax
  • 3,025
  • To prevent being annoyed by the error thrown by any already existing folder, I used this solution : – JeanneD4RK Oct 20 '16 at 18:15
  • ln -s /etc/guacamole/* /usr/share/tomcat8/.guacamole/ but I don't think I'll keep it since it doesn't add the new files in the conf... – JeanneD4RK Oct 20 '16 at 18:16