Permalink
Browse files

Initial commit of foreman-proxy-git

  • Loading branch information...
GregSutcliffe committed Dec 3, 2012
1 parent fb5364f commit bdfaf03732b9ea8e410b9e044a344573e22d9cac
View
@@ -0,0 +1,64 @@
+# Maintainer: Greg Sutcliffe <greg.sutcliffe@gmail.com>>
+
+pkgname=foreman-proxy-git
+pkgver=20121203
+pkgrel=2
+pkgdesc="Manages DNS, DHCP, TFTP and Puppet though a HTTP Restful API. Used by foreman"
+arch=('any')
+url="http://theforeman.org"
+license=('GPL3')
+depends=('ruby-sinatra' 'iputils' 'ruby')
+makedepends=('git')
+optdepends=('puppet' 'nmap')
+provides=('foreman-proxy')
+conflicts=('foreman-proxy')
+backup=("etc/foreman-proxy/settings.yml")
+options=(emptydirs)
+install="foreman-proxy.install"
+source=('foreman-proxy.systemd'
+ 'foreman-proxy.tmpfiles.conf')
+noextract=()
+md5sums=('c99762a8f6a0594965f54dcab5cf726a'
+ 'f6d26c35bf3b9a7c71105e72053785a1')
+
+_gitroot=https://github.com/theforeman/smart-proxy.git
+_gitname=foreman-proxy
+_gitbranch=develop
+
+build() {
+ cd "$srcdir"
+ msg "Connecting to GIT server...."
+
+ if [[ -d "$_gitname" ]]; then
+ cd "$_gitname" && git pull origin && git reset "$_gitbranch" --hard
+ msg "The local files are updated."
+ else
+ git clone "$_gitroot" "$_gitname"
+ fi
+
+ msg "GIT checkout done or server timeout"
+
+}
+
+package() {
+ cd "$srcdir/$_gitname"
+
+ # Main codebase
+ install -d -m0755 $pkgdir/usr/share/foreman-proxy/
+ cp -r ./ $pkgdir/usr/share/foreman-proxy/
+
+ # Symlink config file to etc
+ install -Dp -m0644 config/settings.yml.example $pkgdir/etc/foreman-proxy/settings.yml
+ ln -sv /etc/foreman-proxy/settings.yml $pkgdir/usr/share/foreman-proxy/config/settings.yml
+
+ # logdirs
+ install -d -m0755 $pkgdir/usr/share/foreman-proxy/logs
+ install -d -m0755 $pkgdir/var/log/foreman-proxy
+
+ # systemd
+ install -Dm 644 $srcdir/foreman-proxy.systemd $pkgdir/usr/lib/systemd/system/foreman-proxy.service
+ install -Dm 644 $srcdir/foreman-proxy.tmpfiles.conf $pkgdir/usr/lib/tmpfiles.d/foreman-proxy.conf
+
+}
+
+# vim:set ts=2 sw=2 et:
@@ -0,0 +1,34 @@
+# Foreman-proxy: Installer: Arch
+# Maintainer: Greg Sutcliffe <greg.sutcliffe@gmail.com>>
+
+pre_install() {
+ # Add the "foreman-proxy" user and group
+ getent group foreman-proxy &>/dev/null || groupadd -r foreman-proxy &>/dev/null
+ getent passwd foreman-proxy &>/dev/null || useradd -r -g foreman-proxy -d /usr/share/foreman-proxy -s /sbin/nologin -c "Foreman Proxy deamon user" foreman-proxy &>/dev/null || :
+}
+
+post_install() {
+ chown -R foreman-proxy:foreman-proxy /usr/share/foreman-proxy
+ chown -R foreman-proxy:foreman-proxy /var/log/foreman-proxy
+ /usr/bin/systemd-tmpfiles --create foreman-proxy.conf
+ /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+}
+
+pre_upgrade() {
+ pre_install
+ usermod -d /usr/share/foreman-proxy foreman-proxy &>/dev/null || :
+}
+
+pre_remove() {
+ # Cleanup tmpfiles
+ rm -rf /usr/share/foreman-proxy/tmp
+ /usr/bin/systemctl --no-reload disable foreman-proxy.service >/dev/null 2>&1 || :
+ /usr/bin/systemctl stop foreman-proxy.service >/dev/null 2>&1 || :
+}
+
+post_remove() {
+ /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+ # Remove user and group
+ groupdel foreman-proxy >/dev/null 2>&1
+ userdel foreman-proxy
+}
@@ -0,0 +1,13 @@
+[Unit]
+Description=Foreman Proxy
+Wants=basic.target
+After=basic.target network.target
+
+[Service]
+Type=forking
+User=foreman-proxy
+ExecStart=/usr/share/foreman-proxy/bin/smart-proxy
+PIDFile=/run/foreman-proxy/foreman-proxy.pid
+
+[Install]
+WantedBy=multi-user.target
@@ -0,0 +1 @@
+d /run/foreman-proxy 0755 foreman-proxy foreman-proxy -

0 comments on commit bdfaf03

Please sign in to comment.