From 5b0245acc1b5b1c520db847d70b1b81bafb4d0c2 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Tue, 17 Jun 2014 09:16:20 +0000 Subject: Remove old scripts and units --- Makefile | 4 - bins/trove-early-setup | 124 ------------------- .../remove-lorry-controller-from-lorry-crontab | 22 ---- share/releases-repo-migration.sh | 132 --------------------- units/drop-lorry-controller-cronjob.service | 13 -- units/releases-repo-migration.service | 14 --- 6 files changed, 309 deletions(-) delete mode 100755 bins/trove-early-setup delete mode 100755 libexecs/remove-lorry-controller-from-lorry-crontab delete mode 100755 share/releases-repo-migration.sh delete mode 100644 units/drop-lorry-controller-cronjob.service delete mode 100644 units/releases-repo-migration.service diff --git a/Makefile b/Makefile index 3a64344..ba0b752 100644 --- a/Makefile +++ b/Makefile @@ -14,10 +14,6 @@ install: ln -s /home/lorry/tarballs "${DESTDIR}/var/www/htdocs/tarballs" ln -s /home/lorry/lc-status.html "${DESTDIR}/var/www/htdocs/lc-status.html" ln -s /usr/share/lorry-controller/static/ "${DESTDIR}/var/www/htdocs/lc-static" - mkdir -p "${DESTDIR}/usr/bin" - cp bins/* "${DESTDIR}/usr/bin/" - mkdir -p "${DESTDIR}/usr/libexec" - cp libexecs/* "${DESTDIR}/usr/libexec/" mkdir -p "${DESTDIR}/usr/share/trove-setup" cp -r share/* "${DESTDIR}/usr/share/trove-setup/" diff --git a/bins/trove-early-setup b/bins/trove-early-setup deleted file mode 100755 index 5ce2d7a..0000000 --- a/bins/trove-early-setup +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/make -f -# -# Copyright (C) 2013 Codethink Limited -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# -*- Make -*- - - -all: gitano-configured lorry-configured cache-configured mason-configured nfs-configured cert-generated - -USERS := git lorry cache mason - -# $1 == username to make -define make_user_rules - -/home/$1/.created: - adduser -g "Trove $1 service" -s /bin/bash -D $1 - su -c 'mkdir .ssh; chmod 750 .ssh' - $1 - su -c 'ssh-keygen -t rsa -N "" -q -f .ssh/id_rsa' - $1 - (cat /etc/ssh/ssh_host_*_key.pub | cut -d\ -f1,2 | \ - sed -e's/^/'$(shell hostname)',localhost /' > \ - /home/$1/.ssh/known_hosts) - chown $1:$1 /home/$1/.ssh/known_hosts - chmod 600 /home/$1/.ssh/known_hosts - touch $$@ - -ALL_USER_TARGETS := $$(ALL_USER_TARGETS) /home/$1/.created - -endef - -$(eval $(foreach USER,$(USERS),$(call make_user_rules,$(USER)))) - -/home/git/.git-setup: $(ALL_USER_TARGETS) - su -c 'git config --global user.name "Trove Git Controller"' - git - su -c 'git config --global user.email "git@trove"' - git - touch $@ - -/home/git/.gitano-setup: /home/git/.git-setup - su -c 'gitano-setup /etc/gitano-setup.clod' - git - passwd -u git - touch $@ - -/home/git/.gitano-lorry-setup: /home/git/.gitano-setup - cp /home/lorry/.ssh/id_rsa.pub /tmp/lorry.pub - su -c 'ssh git@localhost as lorry sshkey add trove < /tmp/lorry.pub' - git - rm /tmp/lorry.pub - touch $@ - -.PHONY: gitano-configured -gitano-configured: /home/git/.gitano-setup - -/home/lorry/.lorry-setup: $(ALL_USER_TARGETS) - su -c 'mkdir /home/lorry/bundles /home/lorry/tarballs' - lorry - touch $@ - -/home/lorry/.lorry-controller-setup: /home/lorry/.lorry-setup /home/git/.gitano-lorry-setup - PREFIX=$$(echo "##PREFIX##" | sed -f /etc/trove-setup.sed); \ - su -c "ssh localhost create $${PREFIX}/local-config/lorries" - git; \ - su -c "git clone ssh://localhost/$${PREFIX}/local-config/lorries.git /tmp/lorries" - git; \ - su -c "sed -f /etc/trove-setup.sed < /usr/share/trove-setup/lorry-controller.conf > /tmp/lorries/lorry-controller.conf" - git - su -c "sed -f /etc/trove-setup.sed < /usr/share/trove-setup/README.lorry-controller > /tmp/lorries/README" - git - su -c "mkdir /tmp/lorries/open-source-lorries" - git - su -c "cp /usr/share/trove-setup/open-source-lorries/README /tmp/lorries/open-source-lorries/README" - git - su -c "mkdir /tmp/lorries/closed-source-lorries" - git - su -c "cp /usr/share/trove-setup/closed-source-lorries/README /tmp/lorries/closed-source-lorries/README" - git - su -c "cd /tmp/lorries; git add README lorry-controller.conf open-source-lorries/README closed-source-lorries/README; git commit -m 'Initial configuration'; git push origin master" - git - su -c "rm -rf /tmp/lorries" - git - touch $@ - -.PHONY: lorry-configured -lorry-configured: /home/lorry/.lorry-setup /home/lorry/.lorry-controller-setup - -/home/cache/.cache-setup: $(ALL_USER_TARGETS) - su -c 'mkdir /home/cache/artifacts' - cache - su -c 'mkdir /home/cache/ccache' - cache - echo '/home/cache/ccache *(rw,all_squash,no_subtree_check,anonuid=1002,anongid=1002)' > /etc/exports.cache - touch $@ - -.PHONY: cache-configured -cache-configured: /home/cache/.cache-setup - -/home/git/.mason-setup: /home/git/.gitano-setup $(ALL_USER_TARGETS) - PREFIX=$$(echo "##PREFIX##" | sed -f /etc/trove-setup.sed); \ - su -c "ssh localhost create $${PREFIX}/local-config/mason" - git; \ - su -c "git clone ssh://localhost/$${PREFIX}/local-config/mason.git /tmp/mason-config" - git - su -c "mkdir /tmp/mason-config/ci1" - git - su -c "cp /var/lib/trove-setup/hosts.json.txt /tmp/mason-config/ci1" - git - su -c "cp /var/lib/trove-setup/systems.json.txt /tmp/mason-config/ci1" - git - su -c "cd /tmp/mason-config; git add ci1; git commit -m 'Set initial Mason config'; git push origin master" - git - su -c "rm -fr /tmp/mason-config" - git - su -c 'mkdir /home/mason/jobs' - mason - echo '/home/mason/jobs *(rw,all_squash,no_subtree_check,anonuid=1003,anongid=1003)' > /etc/exports.mason - touch $@ - -.PHONY: mason-configured -mason-configured: /home/git/.mason-setup - -/etc/exports: /home/cache/.cache-setup /home/git/.mason-setup - cat /etc/exports.cache /etc/exports.mason >/etc/exports - -.PHONY: nfs-configured -nfs-configured: /etc/exports - -/home/git/.cert-generated: - mkdir -p /etc/lighttpd/certs - echo -ne '\n\n\n\n\n\n\n' | openssl req -new -x509 \ - -keyout /etc/lighttpd/certs/lighttpd.pem \ - -out /etc/lighttpd/certs/lighttpd.pem -days 36525 -nodes - touch $@ - -.PHONY: cert-generated -cert-generated: /home/git/.cert-generated diff --git a/libexecs/remove-lorry-controller-from-lorry-crontab b/libexecs/remove-lorry-controller-from-lorry-crontab deleted file mode 100755 index 8fc6cf3..0000000 --- a/libexecs/remove-lorry-controller-from-lorry-crontab +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# -# Trove used to run a version of Lorry Controller that wasn't a -# daemon, but instead was invoked once a minute from a crontab owned -# by the lorry user. When we upgrade to a version of Lorry Controller -# that does run as a daemon, we need to disable the cronjob. This -# script does that. -# -# The lorry user crontab may contain other jobs, so we can't just -# willy-nilly delete the whole crontab. Instead, we remove the -# specific line. The line looks like this: -# -# */1 * * * * flock -x -n /home/lorry/lorry-controller-area/lockfile -# -c lorry-controller --work-area=/home/lorry/lorry-controller-area -# --log=syslog --log-level=info --html-file=/home/lorry/lc-status.html -# -# Except, of course, all on one line. - - -crontab -l | -grep -v -e '-c lorry-controller' | -crontab - diff --git a/share/releases-repo-migration.sh b/share/releases-repo-migration.sh deleted file mode 100755 index 654da0c..0000000 --- a/share/releases-repo-migration.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash - -function create_readers_group() -{ - set +e - ( - set -e - ssh localhost group add site-readers \ - 'Users with read access to the site project' - ) - local ret="$?" - if [ "$ret" != 0 ]; then - token=$(ssh localhost group del site-readers 2>&1 | tail -1 | \ - cut -d' ' -f 2) - ssh localhost group del site-readers $token - fi - return $ret -} - -function create_writers_group() -{ - set +e - ( - set -e - ssh localhost group add site-writers \ - 'Users with write access to the site project' - create_readers_group - ) - local ret="$?" - if [ "$ret" != 0 ]; then - token=$(ssh localhost group del site-writers 2>&1 | tail -1 | \ - cut -d' ' -f 2) - ssh localhost group del site-writers $token - fi - return $ret -} - -function create_admins_group() -{ - set +e - ( - set -e - ssh localhost group add site-admins \ - 'Users with admin access to the site project' - create_writers_group - ) - local ret="$?" - if [ "$ret" != 0 ]; then - token=$(ssh localhost group del site-admins 2>&1 | tail -1 | \ - cut -d' ' -f 2) - ssh localhost group del site-admins $token - fi - return $ret -} - -function create_managers_group() -{ - set +e - ( - set -e - ssh localhost group add site-managers \ - 'Users with manager access to the site project' - create_admins_group - ) - local ret="$?" - if [ "$ret" != 0 ]; then - token=$(ssh localhost group del site-managers 2>&1 | tail -1 | \ - cut -d' ' -f 2) - ssh localhost group del site-managers $token - fi - return $ret -} - -function link_groups() -{ - set -e - ssh localhost group addgroup site-admins site-managers - ssh localhost group addgroup site-writers site-admins - ssh localhost group addgroup site-readers site-writers -} - -function delete_groups() -{ - token=$(ssh localhost group del site-managers 2>&1 | tail -1 | \ - cut -d' ' -f 2) - ssh localhost group del site-managers $token - token=$(ssh localhost group del site-admins 2>&1 | tail -1 | \ - cut -d' ' -f 2) - ssh localhost group del site-admins $token - token=$(ssh localhost group del site-writers 2>&1 | tail -1 | \ - cut -d' ' -f 2) - ssh localhost group del site-writers $token - token=$(ssh localhost group del site-readers 2>&1 | tail -1 | \ - cut -d' ' -f 2) - ssh localhost group del site-readers $token -} - -function create_groups() -{ - # call managers_group which calls admin_group and so on... - create_managers_group - set +e - ( - set -e - link_groups - ) - local ret="$?" - if [ "$ret" != 0 ]; then - delete_groups - fi -} - -site_groups=$(ssh localhost group list | grep -cE "site-[[:alnum:]]+") -if [ "$site_groups" == 0 ]; then - create_groups -fi -ssh localhost create "##PREFIX##/site/releases" -description="This is a special repository for distributing release binaries -over HTTP. Visit http://##PREFIX##/releases/ to browse content." -ssh localhost config "##PREFIX##/site/releases" \ - set project.description "$description" - -# add a readme to the repository -repo=$(mktemp -d) -git clone ssh://localhost/##PREFIX##/site/releases $repo -cp /usr/share/trove-setup/releases-repo-README $repo/README -cd $repo -git add $repo/README -git commit -m 'Add README' -git push origin master -cd - -rm -Rf $repo diff --git a/units/drop-lorry-controller-cronjob.service b/units/drop-lorry-controller-cronjob.service deleted file mode 100644 index 8cad21f..0000000 --- a/units/drop-lorry-controller-cronjob.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Drop lorry-controller from lorry's crontab -After=basic.target -ConditionPathExists=!/etc/lorry-controller/lorry-controller-removed-from-crontab - -[Service] -Type=oneshot -Restart=no -ExecStart=/usr/libexec/remove-lorry-controller-from-lorry-crontab -ExecStartPost=/bin/touch /etc/lorry-controller/lorry-controller-removed-from-crontab -User=lorry -Group=lorry -PermissionsStartOnly=true diff --git a/units/releases-repo-migration.service b/units/releases-repo-migration.service deleted file mode 100644 index 1e161fb..0000000 --- a/units/releases-repo-migration.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Create the ##PREFIX##/site/releases repository -ConditionPathExists=!/home/git/repos/##PREFIX##/site/releases.git -Requires=network.target -After=network.target -Requires=opensshd.service -After=opensshd.service -Requires=trove-early-setup.service -After=trove-early-setup.service - -[Service] -User=git -ExecStart=/usr/share/trove-setup/releases-repo-migration.sh -Restart=no -- cgit v1.2.1