# Retrieve arguments domain=$1 path=$2 server_name=$3 final_path=/var/www/seafile seafile_data=$final_path/seafile-data seafile_version=3.1.1 # Check domain/path availability sudo yunohost app checkurl $domain$path -a seafile if [[ ! $? -eq 0 ]]; then exit 1 fi # Check dependencies sudo apt-get install -y python2.7 python-setuptools python-simplejson python-imaging python-mysqldb # Copy files to the right place sudo mkdir -p $final_path sudo mkdir -p $final_path/installed sudo mkdir -p $final_path/seafile-data sudo mkdir -p $final_path/seafile-server-$seafile_version sudo tar xvzf ../sources/'seafile-server_'$seafile_version'_x86-64.tar' sudo mv seafile-server-$seafile_version/* $final_path/seafile-server-$seafile_version sudo mv ../sources/'seafile-server_'$seafile_version'_x86-64.tar' $final_path/installed # Set permissions to seafile directory sudo chown -R www-data: $final_path # Find available ports ccnet_port=10001 seafile_port=12001 seahub_port=8082 # Modify install script with parameters sed -i "s@SERVER_NAME@$server_name@g" ../sources/setup-seafile.sh sed -i "s@DOMAIN@$domain@g" ../sources/setup-seafile.sh sed -i "s@CCNET_PORT@$ccnet_port@g" ../sources/setup-seafile.sh sed -i "s@SEAFILE_DATA@$seafile_data@g" ../sources/setup-seafile.sh sed -i "s@SEAFILE_PORT@$seafile_port@g" ../sources/setup-seafile.sh sed -i "s@SEAHUB_PORT@$seahub_port@g" ../sources/setup-seafile.sh # Run install script sudo cp ../sources/setup-seafile.sh $final_path/seafile-server-$seafile_version sudo chmod +x $final_path/seafile-server-$seafile_version/setup-seafile.sh sudo $final_path/seafile-server-$seafile_version/setup-seafile.sh # Start Seafile Server # Add Seafile Server to startup # TODO # Modify Nginx configuration file and copy it to Nginx conf directory sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/seafile.conf # Reload Nginx and regenerate SSOwat conf sudo service nginx reload sudo yunohost app ssowatconf