Auto create symlinks to jenkins-scripts
authorLin Yang <lin.a.yang@intel.com>
Tue, 15 Oct 2013 12:58:35 +0000 (20:58 +0800)
committerLin Yang <lin.a.yang@intel.com>
Tue, 15 Oct 2013 12:58:35 +0000 (20:58 +0800)
In %post section, automatically create symlinks /var/lib/jenkins/userContent/
jenkins-scripts to /var/lib/jenkins/jenkins-scripts.

Fixes: #1356

Change-Id: Ib8972db7bb1db616db377a0c3a4fca5f33e33ee5
Signed-off-by: Lin Yang <lin.a.yang@intel.com>
packaging/jenkins-scripts.spec

index c7dd271..7ef5ecc 100644 (file)
@@ -74,6 +74,17 @@ Isolated job_submitobs to avoid package installation conflicts
 install -d %{buildroot}%{destdir}
 cp -r job_*.py common requests %{buildroot}%{destdir}/
 
+%post
+if [ ! -d /var/lib/jenkins/userContent ]; then
+  mkdir -p /var/lib/jenkins/userContent
+fi
+ln -sf %{destdir} /var/lib/jenkins/userContent/jenkins-scripts
+
+%postun
+if [ -L /var/lib/jenkins/userContent/jenkins-scripts ]; then
+  rm -f /var/lib/jenkins/userContent/jenkins-scripts
+fi
+
 %files
 %defattr(-,jenkins,jenkins)
 %dir /var/lib/jenkins/