Browse Source

Make current user the default createrepo-user

bryan 5 years ago
parent
commit
eb6f88caa4
1 changed files with 7 additions and 8 deletions
  1. 7 8
      installJRMC

+ 7 - 8
installJRMC

@@ -26,7 +26,7 @@ installJRMC () {
         _createrepo_webroot="/var/www/jriver"
         _createrepo_webroot="/var/www/jriver"
 
 
     [[ -z $_createrepo_user ]] && \
     [[ -z $_createrepo_user ]] && \
-        _createrepo_user="www-user"
+        _createrepo_user="$(whoami)"
 
 
     [[ -z $_user ]] && \
     [[ -z $_user ]] && \
         _user="$(whoami)"
         _user="$(whoami)"
@@ -78,7 +78,7 @@ OPTIONS
             --createrepo-webroot PATH
             --createrepo-webroot PATH
                 The webroot directory to install the repo (Default: /var/www/html)
                 The webroot directory to install the repo (Default: /var/www/html)
             --createrepo-user USER
             --createrepo-user USER
-                The web server user (Default: www-user)
+                The web server user (Default: current user)
 
 
     SERVICES
     SERVICES
         mediaserver
         mediaserver
@@ -97,11 +97,6 @@ OPTIONS
 
 
         createrepo
         createrepo
             Install service to build latest MC RPM and run createrepo hourly for the current user
             Install service to build latest MC RPM and run createrepo hourly for the current user
-
-            --createrepo-webroot PATH
-                The webroot directory to install the repo (Default: /var/www/html)
-            --createrepo-user USER
-                The web server user (Default: www-user)
 EOF
 EOF
 
 
         # Exit using passed exit code
         # Exit using passed exit code
@@ -536,7 +531,11 @@ EOF"
         _createrepo_cmd=("createrepo" "-q")
         _createrepo_cmd=("createrepo" "-q")
 
 
         # If the webroot does not exist, create it
         # If the webroot does not exist, create it
-        [[ ! -d "$_createrepo_webroot" ]] && "${_prefix[@]}" mkdir -p "$_createrepo_webroot"
+        if [[ ! -d "$_createrepo_webroot" ]]; then
+            if ! "${_prefix[@]}" mkdir -p "$_createrepo_webroot"; then
+                echo "Make sure that the createrepo-webroot is writeable by createrepo-user!"
+            fi
+        fi
 
 
         # Copy built rpms to webroot
         # Copy built rpms to webroot
         if "${_prefix[@]}" cp -n "$_outputdir/RPMS/x86_64/MediaCenter-$_mcversion.x86_64.rpm" "$_createrepo_webroot"; then
         if "${_prefix[@]}" cp -n "$_outputdir/RPMS/x86_64/MediaCenter-$_mcversion.x86_64.rpm" "$_createrepo_webroot"; then