diff options
author | Christian Rößler | 2016-08-30 18:56:20 +0200 |
---|---|---|
committer | Christian Rößler | 2016-08-30 18:56:20 +0200 |
commit | 6dd5afbecc6ba0596e257775351350be1fb74938 (patch) | |
tree | 5a6157e492a79491ce295e9586707ba8c5ce8771 | |
parent | [SSPS] config.properties (dmsd): + db.location-table = openslx.location (diff) | |
download | setup-scripts-6dd5afbecc6ba0596e257775351350be1fb74938.tar.gz setup-scripts-6dd5afbecc6ba0596e257775351350be1fb74938.tar.xz setup-scripts-6dd5afbecc6ba0596e257775351350be1fb74938.zip |
[SSPS/SSUS] Writable /var/cache/slx-admin für user www-data and symlink [WARNING: NEEDS TESTING!]
-rw-r--r-- | satellit_installer/includes/00-dirs.inc | 1 | ||||
-rw-r--r-- | satellit_installer/includes/90-set_directory_permissions.inc | 10 | ||||
-rw-r--r-- | satellit_installer/includes/90-set_links.inc | 13 | ||||
-rwxr-xr-x | satellit_installer/satellit_installer | 3 | ||||
-rw-r--r-- | satellit_upgrader/updater.template.sh | 13 |
5 files changed, 36 insertions, 4 deletions
diff --git a/satellit_installer/includes/00-dirs.inc b/satellit_installer/includes/00-dirs.inc index 5ed3328..871cd8a 100644 --- a/satellit_installer/includes/00-dirs.inc +++ b/satellit_installer/includes/00-dirs.inc @@ -8,4 +8,5 @@ export LDADPDIR="/opt/ldadp/" export TFTPDIR="/srv/openslx/tftp" export WWWDIR="/srv/openslx/www" export IPXEDIR="$OPENSLXDIR/ipxe" +export SLXADMINCACHE="/var/cache/slx-admin" readonly CONFIGDIR DMSDDIR TASKMANDIR OPENSLXDIR OPENSLXSRVDIR LDADPDIR SYNCDAEMONDIR TFTPDIR WWWDIR diff --git a/satellit_installer/includes/90-set_directory_permissions.inc b/satellit_installer/includes/90-set_directory_permissions.inc index 62c63c3..f40322b 100644 --- a/satellit_installer/includes/90-set_directory_permissions.inc +++ b/satellit_installer/includes/90-set_directory_permissions.inc @@ -48,7 +48,11 @@ set_directory_permissions() { # Make sure we spare the binary chown root:root "$LDADPDIR/ldadp" # ... not the binary. - mkdir -p -m 755 /opt/openslx/proxy 2>/dev/null - chmod 755 /opt/openslx/proxy 2>/dev/null # if already there - chown www-data /opt/openslx/proxy 2>/dev/null + mkdir -p -m 755 "$OPENSLXDIR"/proxy 2>/dev/null + chmod 755 "$OPENSLXDIR"/proxy 2>/dev/null # if already there + chown www-data "$OPENSLXDIR"/proxy 2>/dev/null + + mkdir -p -m 0755 "$SLXADMINCACHE" + chmod 0755 "$SLXADMINCACHE" # if already there + chown -R www-data:www-data "$SLXADMINCACHE" } diff --git a/satellit_installer/includes/90-set_links.inc b/satellit_installer/includes/90-set_links.inc new file mode 100644 index 0000000..fc20ef8 --- /dev/null +++ b/satellit_installer/includes/90-set_links.inc @@ -0,0 +1,13 @@ +set_links() { + +if [ -f "${SLXADMINCACHE}/baseconfig-bwidm_settings.json" ]; then + echo -n "# ${SLXADMINCACHE}/baseconfig-bwidm_settings.json already there." + [ -h "${SLXADMINCACHE}/baseconfig-bwidm_settings.json" ] && \ + echo " ... and is a symbolic link." || \ + echo " ... but is NOT a symbolic link." +else + ln -s "${WWWDIR}/slx-admin/modules-available/baseconfig_bwidm/baseconfig/settings.json" "${SLXADMINCACHE}/baseconfig-bwidm_settings.json" + echo "# ${SLXADMINCACHE}/baseconfig-bwidm_settings.json link set." +fi + +} diff --git a/satellit_installer/satellit_installer b/satellit_installer/satellit_installer index e15aea6..f83f603 100755 --- a/satellit_installer/satellit_installer +++ b/satellit_installer/satellit_installer @@ -181,6 +181,9 @@ patch_slxadmin # Check dir and file permissions: set_directory_permissions +# And set some symbolic links thereafter: +set_links + tar -z -c -T /dev/null -f /opt/openslx/empty.tgz # Mark vmstore as not mounted diff --git a/satellit_upgrader/updater.template.sh b/satellit_upgrader/updater.template.sh index debfdec..ca9f89a 100644 --- a/satellit_upgrader/updater.template.sh +++ b/satellit_upgrader/updater.template.sh @@ -68,8 +68,10 @@ restart_service () { } # ** Recursively set permissions of given directory to 0755/0644 optionally setting owner/group +# ** If directory is not there it will be mkdir'ed. fixperms () { [ -e "$1" ] || perror "normalize_perms: $1 does not exist" + [ -d "$1" ] || mkdir -p "$1" chmod -R a-rw,u+rwX,go+rX "$1" if [ -n "$2" ]; then chown -R "$2" "$1" || pwarning "Could not change owner of $1 to $2" @@ -88,6 +90,7 @@ declare -rg PAYLOAD_OFFSET="%PAYLOAD_OFFSET%" # ** Constants - hardcoded or determined at runtime declare -rg PATH_SLXADMIN="/srv/openslx/www/slx-admin" +declare -rg PATH_SLXADMINCACHE="/var/cache/slx-admin" declare -rg PATH_DOZMOD="/opt/dmsd" declare -rg PATH_TASKMANAGER="/opt/taskmanager" declare -rg PATH_TFTP="/srv/openslx/tftp" @@ -227,9 +230,17 @@ if [ -n "$TGZ_SLXADMIN" ]; then fi ln -s -f "$PATH_TFTP" "/srv/openslx/www/tftp" || perror "Could not symlink $PATH_TFTP to /srv/openslx/www/tftp" echo "Web interface upgrade complete" + fixperms "${PATH_SLXADMINCACHE}" www-data:www-data + + if [ -h "${PATH_SLXADMINCACHE}/baseconfig-bwidm_settings.json" ]; then + pwarning "There is already a link or file /srv/openslx/www/slx-admin/modules-available/baseconfig_bwidm/baseconfig/settings.json. Please check manually, it should lead to /srv/openslx/www/slx-admin/modules-available/baseconfig_bwidm/baseconfig/settings.json" + else + ln -s /srv/openslx/www/slx-admin/modules-available/baseconfig_bwidm/baseconfig/settings.json "${PATH_SLXADMINCACHE}/baseconfig-bwidm_settings.json" || \ + pwarning "Could not set link ${PATH_SLXADMINCACHE}/baseconfig-bwidm_settings.json to /srv/openslx/www/slx-admin/modules-available/baseconfig_bwidm/baseconfig/settings.json - do so manually" + fi fi -# ************************* Dozmod ************************* +#************************* Dozmod ************************* if [ -n "$TGZ_DOZMOD" ]; then [ -e "$TMPDIR/$TGZ_DOZMOD" ] || perror "$TGZ_DOZMOD missing from payload." echo "* Dozentenmodul" |