From 4403c4c7680d51627f8e5cff30be1dbb0569c3f6 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Tue, 22 Sep 2020 02:28:14 +0200 Subject: [PATCH] Initial commit --- debian/changelog | 6 ++ debian/control | 30 ++++++ debian/rules | 170 +++++++++++++++++++++++++++++++ debian/xtreemfs-server.conffiles | 5 + debian/xtreemfs-server.postinst | 100 ++++++++++++++++++ debian/xtreemfs-server.postrm | 11 ++ debian/xtreemfs-server.prerm | 18 ++++ 7 files changed, 340 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/rules create mode 100644 debian/xtreemfs-server.conffiles create mode 100644 debian/xtreemfs-server.postinst create mode 100644 debian/xtreemfs-server.postrm create mode 100644 debian/xtreemfs-server.prerm diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..8a69f80 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +xtreemfs (1.5.1) stable; urgency=low + + * Release 1.5.1 + + -- XtreemFS Project Wed, 16 Jun 2008 15:42:09 +0200 + diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..9fc91d4 --- /dev/null +++ b/debian/control @@ -0,0 +1,30 @@ +Source: xtreemfs +Section: utils +Priority: optional +Maintainer: XtreemFS Project +Homepage: http://www.xtreemfs.org/ +Standards-Version: 3.7.2 + +Package: xtreemfs-client +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, fuse-utils (>= 2.6) | fuse (>= 2.6) +Description: XtreemFS client + XtreemFS is a distributed and replicated file system for the Internet. For more details, visit www.xtreemfs.org. This package contains the XtreemFS client module. + +Package: xtreemfs-backend +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, grep, java6-runtime-headless +Description: XtreemFS server + XtreemFS is a distributed and replicated file system for the Internet. For more details, visit www.xtreemfs.org. This package contains the backend modules and libraries shared between the server and tools sub-packages. + +Package: xtreemfs-server +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, xtreemfs-backend (= ${binary:Version}), grep, java6-runtime-headless, uuid-runtime +Description: XtreemFS server + XtreemFS is a distributed and replicated file system for the Internet. For more details, visit www.xtreemfs.org. This package contains the XtreemFS server components (DIR, MRC, OSD). + +Package: xtreemfs-tools +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, xtreemfs-backend (= ${binary:Version}), attr (>=2), java6-runtime-headless +Description: XtreemFS administration tools + XtreemFS is a distributed and replicated file system for the Internet. For more details, visit www.xtreemfs.org. This package contains XtreemFS administration tools. diff --git a/debian/rules b/debian/rules new file mode 100644 index 0000000..c32d600 --- /dev/null +++ b/debian/rules @@ -0,0 +1,170 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# This is the debhelper compatibility version to use. +export DH_COMPAT=4 + +CFLAGS = -g +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) +CFLAGS += -O0 +else +CFLAGS += -O2 +endif + +BUILD_DIR:=$(CURDIR)/debian/xtreemfs +export ANT_OPTS=-D"file.encoding=UTF-8" + +build: build-stamp +build-stamp: + dh_testdir + + # Add here commands to compile the package. + #sed -i -e "s@.*policy_dir_paths\.push_back( \"src/policies/lib\" );.*@@g"\ + # -e "s@/lib/xtreemfs/policies/@/usr/lib/xtreemfs/policies/@g" src/libxtreemfs/user_database.cpp + make + # python share/scons.py + # --- end custom part for compiling + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + # Add here commands to clean up after the build process. + #make clean + #make -C "." clean + # --- end custom part for cleaning up + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package + # The DESTDIR Has To Be Exactly /usr/src/packages/BUILD/debian/debian/ + make install DESTDIR=$(BUILD_DIR) + + # remove copyright notes (let the sections below handle that) + rm $(BUILD_DIR)/usr/share/doc/xtreemfs-client/LICENSE + rm $(BUILD_DIR)/usr/share/doc/xtreemfs-server/LICENSE + rm $(BUILD_DIR)/usr/share/doc/xtreemfs-tools/LICENSE + rmdir $(BUILD_DIR)/usr/share/doc/xtreemfs-client + rmdir $(BUILD_DIR)/usr/share/doc/xtreemfs-server + rmdir $(BUILD_DIR)/usr/share/doc/xtreemfs-tools + + rm $(BUILD_DIR)/etc/xos/xtreemfs/postinstall_setup.sh + + # --- end custom part for installing + + # move files of the xtreemfs-client package + mkdir -p $(BUILD_DIR)-client/usr/bin + mv -t $(BUILD_DIR)-client/usr/bin \ + $(BUILD_DIR)/usr/bin/*.xtreemfs \ + $(BUILD_DIR)/usr/bin/xtfsutil + mkdir -p $(BUILD_DIR)-client/sbin + ln -sf /usr/bin/mount.xtreemfs $(BUILD_DIR)-client/sbin/mount.xtreemfs + ln -sf /usr/bin/umount.xtreemfs $(BUILD_DIR)-client/sbin/umount.xtreemfs + mkdir -p $(BUILD_DIR)-client/usr/share/man/man1 + mv -t $(BUILD_DIR)-client/usr/share/man/man1 \ + $(BUILD_DIR)/usr/share/man/man1/*.xtreemfs* \ + $(BUILD_DIR)/usr/share/man/man1/xtfsutil* + mkdir -p $(BUILD_DIR)-client/usr/share/doc/xtreemfs-client + cp -t $(BUILD_DIR)-client/usr/share/doc/xtreemfs-client \ + $(CURDIR)/LICENSE + + # move files of the xtreemfs-backend package + mkdir -p $(BUILD_DIR)-backend/usr/share/java + mv -t $(BUILD_DIR)-backend/usr/share/java \ + $(BUILD_DIR)/usr/share/java/XtreemFS.jar \ + $(BUILD_DIR)/usr/share/java/Foundation.jar \ + $(BUILD_DIR)/usr/share/java/protobuf-java-2.5.0.jar \ + $(BUILD_DIR)/usr/share/java/Flease.jar \ + $(BUILD_DIR)/usr/share/java/BabuDB.jar \ + $(BUILD_DIR)/usr/share/java/BabuDB_replication_plugin.jar \ + $(BUILD_DIR)/usr/share/java/jdmkrt.jar \ + $(BUILD_DIR)/usr/share/java/jdmktk.jar \ + $(BUILD_DIR)/usr/share/java/commons-codec-1.3.jar + mkdir -p $(BUILD_DIR)-backend/usr/share/doc/xtreemfs-backend + cp -t $(BUILD_DIR)-backend/usr/share/doc/xtreemfs-backend \ + $(CURDIR)/LICENSE + + # move files of the xtreemfs-server package + mkdir -p $(BUILD_DIR)-server/etc/init.d + mv -t $(BUILD_DIR)-server/etc/init.d \ + $(BUILD_DIR)/etc/init.d/xtreemfs-* + mkdir -p $(BUILD_DIR)-server/usr/share/xtreemfs + mv -t $(BUILD_DIR)-server/usr/share/xtreemfs \ + $(BUILD_DIR)/usr/share/xtreemfs/xtreemfs-osd-farm + mkdir -p $(BUILD_DIR)-server/etc/xos/xtreemfs + mv -t $(BUILD_DIR)-server/etc/xos/xtreemfs \ + $(BUILD_DIR)/etc/xos/xtreemfs/*.properties \ + $(BUILD_DIR)/etc/xos/xtreemfs/generate_uuid +# $(BUILD_DIR)/etc/xos/xtreemfs/postinstall_setup.sh + mkdir -p $(BUILD_DIR)-server/etc/xos/xtreemfs/server-repl-plugin + mv -t $(BUILD_DIR)-server/etc/xos/xtreemfs/server-repl-plugin \ + $(BUILD_DIR)/etc/xos/xtreemfs/server-repl-plugin/*.properties + mkdir -p $(BUILD_DIR)-server/usr/share/doc/xtreemfs-server + cp -t $(BUILD_DIR)-server/usr/share/doc/xtreemfs-server \ + $(CURDIR)/LICENSE + + # move files of the xtreemfs-tools package + # this file has already been moved and does not have to be explicitly excluded: + # %exclude /usr/bin/xtfs_*mount + mkdir -p $(BUILD_DIR)-tools/etc/xos/xtreemfs + mv -t $(BUILD_DIR)-tools/etc/xos/xtreemfs \ + $(BUILD_DIR)/etc/xos/xtreemfs/default_dir + mkdir -p $(BUILD_DIR)-tools/usr/bin + mv -t $(BUILD_DIR)-tools/usr/bin \ + $(BUILD_DIR)/usr/bin/xtfs_* + mkdir -p $(BUILD_DIR)-tools/usr/share/man/man1 + mv -t $(BUILD_DIR)-tools/usr/share/man/man1 \ + $(BUILD_DIR)/usr/share/man/man1/xtfs_* + mkdir -p $(BUILD_DIR)-tools/usr/share/doc/xtreemfs-tools + cp -t $(BUILD_DIR)-tools/usr/share/doc/xtreemfs-tools \ + $(CURDIR)/LICENSE + +# Build architecture-independent files here. +binary-indep: build install + # We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + #dh_installdebconf + dh_installdocs + dh_installexamples + dh_installmenu + #dh_installlogrotate + #dh_installemacsen + #dh_installpam + #dh_installmime + #dh_installinit + dh_installcron + dh_installman + dh_installinfo + #dh_undocumented + dh_installchangelogs + dh_link + dh_strip + dh_compress + dh_fixperms + #dh_makeshlibs + dh_installdeb + #dh_perl + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff --git a/debian/xtreemfs-server.conffiles b/debian/xtreemfs-server.conffiles new file mode 100644 index 0000000..d186802 --- /dev/null +++ b/debian/xtreemfs-server.conffiles @@ -0,0 +1,5 @@ +/etc/xos/xtreemfs/dirconfig.properties +/etc/xos/xtreemfs/mrcconfig.properties +/etc/xos/xtreemfs/osdconfig.properties +/etc/xos/xtreemfs/server-repl-plugin/mrc.properties +/etc/xos/xtreemfs/server-repl-plugin/dir.properties diff --git a/debian/xtreemfs-server.postinst b/debian/xtreemfs-server.postinst new file mode 100644 index 0000000..2c6366e --- /dev/null +++ b/debian/xtreemfs-server.postinst @@ -0,0 +1,100 @@ +#!/bin/bash +set -e + +#$XTREEMFS_CONFIG_DIR/postinstall_setup.sh +#!/bin/bash +set -e + +XTREEMFS_LOG_DIR=/var/log/xtreemfs +XTREEMFS_HOME=/var/lib/xtreemfs +XTREEMFS_ETC=/etc/xos/xtreemfs +XTREEMFS_USER=xtreemfs +XTREEMFS_GROUP=xtreemfs +XTREEMFS_GENERATE_UUID_SCRIPT="${XTREEMFS_ETC}/generate_uuid" + +# When executed during POST installation, do not be verbose. +VERBOSE=0 +script_name=$(basename "$0") +if [ "$script_name" = "postinstall_setup.sh" ] +then + VERBOSE=1 +fi + +# generate UUIDs +if [ -x "$XTREEMFS_GENERATE_UUID_SCRIPT" ]; then + for service in dir mrc osd; do + "$XTREEMFS_GENERATE_UUID_SCRIPT" "${XTREEMFS_ETC}/${service}config.properties" + [ $VERBOSE -eq 1 ] && echo "Generated UUID for service: $service" + done +else + echo "UUID can't be generated automatically. Please enter a correct UUID in each config file of an XtreemFS service." +fi + + +group_exists=`grep -c $XTREEMFS_GROUP /etc/group || true` +if [ $group_exists -eq 0 ]; then + groupadd $XTREEMFS_GROUP + [ $VERBOSE -eq 1 ] && echo "created group $XTREEMFS_GROUP" +fi +exists=`grep -c $XTREEMFS_USER /etc/passwd || true` +if [ $exists -eq 0 ]; then + mkdir $XTREEMFS_HOME + useradd -r --home $XTREEMFS_HOME -g $XTREEMFS_GROUP $XTREEMFS_USER + chown $XTREEMFS_USER $XTREEMFS_HOME + [ $VERBOSE -eq 1 ] && echo "created user $XTREEMFS_USER and data directory $XTREEMFS_HOME" +fi +if [ ! -d $XTREEMFS_HOME ]; then + mkdir -m750 $XTREEMFS_HOME + chown $XTREEMFS_USER $XTREEMFS_HOME + [ $VERBOSE -eq 1 ] && echo "user $XTREEMFS_USER exists but data directory $XTREEMFS_HOME had to be created" +fi +owner=`stat -c %U $XTREEMFS_HOME` +if [ "$owner" != "$XTREEMFS_USER" ]; then + [ $VERBOSE -eq 1 ] && echo "directory $XTREEMFS_HOME is not owned by $XTREEMFS_USER, executing chown" + chown $XTREEMFS_USER $XTREEMFS_HOME +fi + +if [ ! -e $XTREEMFS_LOG_DIR ]; then + mkdir $XTREEMFS_LOG_DIR + chown -R $XTREEMFS_USER $XTREEMFS_LOG_DIR +fi + +if [ -e $XTREEMFS_ETC ]; then + group=`stat -c %G $XTREEMFS_ETC 2>/dev/null` + if [ $group != $XTREEMFS_GROUP ]; then + [ $VERBOSE -eq 1 ] && echo "directory $XTREEMFS_ETC is owned by $group, should be owned by $XTREEMFS_GROUP, executing chgrp (may take some time)" + chgrp -R $XTREEMFS_GROUP $XTREEMFS_ETC + fi + for file in `ls $XTREEMFS_ETC/*.properties 2>/dev/null`; do + if [ -f $file -a "$(stat -c %a $file)" != "640" ]; then + [ $VERBOSE -eq 1 ] && echo "setting $file 0640, executing chmod" + chmod 0640 $file + fi + done + if [ -d "$XTREEMFS_ETC/truststore/" ] + then + if [ "$(stat -c %a "$XTREEMFS_ETC/truststore/")" != "750" ] + then + [ $VERBOSE -eq 1 ] && echo "setting $XTREEMFS_ETC/truststore/ to 0750, executing chmod (may take some time)" + chmod -R u=rwX,g=rX,o= $XTREEMFS_ETC/truststore/ + fi + fi +fi + +#echo "Installing DIR, MRC, OSD RC-links..." +update-rc.d xtreemfs-dir start 20 3 5 . stop 20 0 1 2 6 . > /dev/null +update-rc.d xtreemfs-mrc start 25 3 5 . stop 25 0 1 2 6 . > /dev/null +update-rc.d xtreemfs-osd start 25 3 5 . stop 25 0 1 2 6 . > /dev/null + +#echo "Re-starting DIR, MRC, OSD services if started..." +if which invoke-rc.d >/dev/null 2>&1; then + invoke-rc.d xtreemfs-dir try-restart + invoke-rc.d xtreemfs-mrc try-restart + invoke-rc.d xtreemfs-osd try-restart +else + /etc/init.d/xtreemfs-dir try-restart + /etc/init.d/xtreemfs-mrc try-restart + /etc/init.d/xtreemfs-osd try-restart +fi + +exit 0 diff --git a/debian/xtreemfs-server.postrm b/debian/xtreemfs-server.postrm new file mode 100644 index 0000000..4bb1070 --- /dev/null +++ b/debian/xtreemfs-server.postrm @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +if [ "$1" = "remove" ]; then +# echo "Removing DIR, MRC, OSD RC-links" + update-rc.d -f xtreemfs-dir remove > /dev/null + update-rc.d -f xtreemfs-mrc remove > /dev/null + update-rc.d -f xtreemfs-osd remove > /dev/null +fi + +exit 0 diff --git a/debian/xtreemfs-server.prerm b/debian/xtreemfs-server.prerm new file mode 100644 index 0000000..0e2c022 --- /dev/null +++ b/debian/xtreemfs-server.prerm @@ -0,0 +1,18 @@ +#!/bin/bash +set -e + +# stop before remove +if [ "$1" = "remove" -o "$1" = "deconfigure" ]; then +# echo "Stopping DIR, MRC, OSD services..." + if which invoke-rc.d >/dev/null 2>&1; then + invoke-rc.d xtreemfs-dir stop + invoke-rc.d xtreemfs-mrc stop + invoke-rc.d xtreemfs-osd stop + else + /etc/init.d/xtreemfs-dir stop + /etc/init.d/xtreemfs-mrc stop + /etc/init.d/xtreemfs-osd stop + fi +fi + +exit 0