35 lines
1.4 KiB
Bash
35 lines
1.4 KiB
Bash
#!/bin/bash
|
|
|
|
# Fixing base variables
|
|
basedir=/var/lib/{{ ansible_local.domain.domainfull }}
|
|
|
|
# Making sure destination folder exists.
|
|
/usr/bin/install -d -o root -g users ${basedir}/bin
|
|
|
|
# Update this script itself
|
|
/usr/bin/wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/paperms/paperms.sh -O ${basedir}/bin/paperms.sh
|
|
/bin/chown root:users ${basedir}/bin/paperms.sh
|
|
/bin/chmod a+x ${basedir}/bin/paperms.sh
|
|
|
|
# Updating cronjob
|
|
/usr/bin/wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/paperms/cronjob -O /etc/cron.d/paperms
|
|
/bin/chown root:root /etc/cron.d/paperms
|
|
/bin/chmod 0644 /etc/cron.d/paperms
|
|
|
|
# Removing old versions of the cronjob
|
|
rm -f /etc/cron.d/pulseaudio-perms
|
|
|
|
# Updating logrotate
|
|
/usr/bin/wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/paperms/logrotate -O /etc/logrotate.d/paperms
|
|
/bin/chown root:root /etc/logrotate.d/paperms
|
|
/bin/chmod 0644 /etc/logrotate.d/paperms
|
|
|
|
# Updating updategrp.py
|
|
/usr/bin/wget -q http://{{ ansible_local.domain.serverfqdn }}/ks/paperms/updategrp.py -O ${basedir}/bin/updategrp.py
|
|
/bin/chown root:users ${basedir}/bin/updategrp.py
|
|
/bin/chmod a+x ${basedir}/bin/updategrp.py
|
|
|
|
# Main part: run updategrp.py
|
|
/usr/bin/wbinfo -t && /usr/bin/python2 ${basedir}/bin/updategrp.py "domain users" "pulse" || echo "Not in domain."
|
|
/usr/bin/wbinfo -t && /usr/bin/python2 ${basedir}/bin/updategrp.py "domain users" "pulse-access" || echo "Not in domain."
|