This commit is contained in:
Bob Mottram 2017-05-11 16:19:41 +01:00
parent c1e5672df1
commit bef67090a9
1 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ function remove_user_radicale {
${PROJECT_NAME}-pass -u $remove_username --rmapp radicale
if grep "${remove_username}:" ${RADICALE_USERS}; then
if grep -q "${remove_username}:" ${RADICALE_USERS}; then
sed -i "/${remove_username}:/d" ${RADICALE_USERS}
if [ -d /var/www/radicale/collections/${remove_username} ]; then
rm -rf /var/www/radicale/collections/${remove_username}
@ -77,7 +77,7 @@ function add_user_radicale {
touch ${RADICALE_USERS}
fi
if ! grep "$new_username:" ${RADICALE_USERS}; then
if ! grep -q "$new_username:" ${RADICALE_USERS}; then
htpasswd -bd ${RADICALE_USERS} "$new_username" "$new_user_password"
echo '{"ICAL:calendar-color": "#9e50df"}' > /var/www/radicale/collections/${new_username}.props
@ -101,7 +101,7 @@ function change_password_radicale {
${PROJECT_NAME}-pass -u $existing_username -a radicale -p "$new_user_password"
if grep "${existing_username}:" ${RADICALE_USERS}; then
if grep -q "${existing_username}:" ${RADICALE_USERS}; then
sed -i "/${existing_username}:/d" ${RADICALE_USERS}
htpasswd -bd ${RADICALE_USERS} "$existing_username" "$new_user_password"
systemctl reload radicale
@ -513,7 +513,7 @@ function install_radicale {
set_completion_param "radicale onion domain" "${RADICALE_ONION_HOSTNAME}"
else
# alter the existing site config
if ! grep "# Start radicale" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}; then
if ! grep -q "# Start radicale" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}; then
sed -i '/ 443/a # Start radicale\n location @radicale {\n auth_basic "Radicale";\n auth_basic_user_file /var/www/radicale/users;\n proxy_pass http://localhost:52322;\n proxy_buffering off;\n proxy_set_header Host $host;\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header X-Forwarded-Proto $scheme;\n }\n\n location /radicale {\n try_files $uri @radicale;\n }\n\n location /.well-known/carddav {\n try_files $uri @radicale;\n }\n\n location /.well-known/caldav {\n try_files $uri @radicale;\n }\n # End radicale' /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}
sed -i '/listen localhost/a # Start radicale\n location @radicale {\n auth_basic "Radicale";\n auth_basic_user_file /var/www/radicale/users;\n proxy_pass http://localhost:52322;\n proxy_buffering off;\n proxy_set_header Host $host;\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header X-Forwarded-Proto $scheme;\n }\n\n location /radicale {\n try_files $uri @radicale;\n }\n\n location /.well-known/carddav {\n try_files $uri @radicale;\n }\n\n location /.well-known/caldav {\n try_files $uri @radicale;\n }\n # End radicale' /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}
fi