Index: head/net-mgmt/seafile-server/Makefile =================================================================== --- head/net-mgmt/seafile-server/Makefile (revision 436503) +++ head/net-mgmt/seafile-server/Makefile (revision 436504) @@ -1,124 +1,127 @@ # $FreeBSD$ PORTNAME= seafile-server PORTVERSION= 6.0.8 DISTVERSIONPREFIX= v DISTVERSIONSUFFIX= -server +PORTREVISION= 1 CATEGORIES= net-mgmt MAINTAINER= ultima1252@gmail.com COMMENT= Open Source Cloud Storage (Server) LICENSE= GPLv3 LICENSE_FILE= ${WRKSRC}/LICENSE.txt BUILD_DEPENDS= valac:lang/vala LIB_DEPENDS= libsearpc.so:devel/libsearpc \ libevhtp.so:www/libevhtp \ libzdb.so:databases/libzdb \ libcurl.so:ftp/curl \ libinotify.so:devel/libinotify \ libccnet.so:net-mgmt/ccnet-server \ libevent.so:devel/libevent \ libuuid.so:misc/e2fsprogs-libuuid \ libjansson.so:devel/jansson RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}sqlite3>0:databases/py-sqlite3 \ ${PYTHON_PKGNAMEPREFIX}urllib3>0:net/py-urllib3 \ bash:shells/bash CONFLICTS= seafile-[0-9]* USE_GITHUB= yes GH_ACCOUNT= haiwen USES= autoreconf gettext iconv libarchive libtool mysql pathfix \ pgsql pkgconfig python:-2.7 shebangfix sqlite ssl USE_GNOME= glib20 SHEBANG_FILES= scripts/*.sh scripts/upgrade/*.sh *.sh scripts/build/*.py \ scripts/*.py scripts/upgrade/*.py tools/seafile-admin GNU_CONFIGURE= yes USE_LDCONFIG= yes CONFIGURE_ENV= SSL_CFLAGS="${OPENSSLINC}" SSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto" PATHFIX_MAKEFILEIN= Makefile.am INSTALL_TARGET= install-strip CPPFLAGS+= -I${LOCALBASE}/include -I${LOCALBASE}/include/evhtp LDFLAGS+= -L${LOCALBASE}/lib HAIWENDIR= www/haiwen SEAFILE_SERVER= ${HAIWENDIR}/seafile-server SEABIN= ${SEAFILE_SERVER}/seafile/bin SEALIB= ${SEAFILE_SERVER}/seafile/lib USERS= seafile GROUPS= ${USERS} USE_RC_SUBR= seafile PLIST_SUB= USERS=${USERS} \ GROUPS=${GROUPS} \ SEAFILE_SERVER=${SEAFILE_SERVER} \ HAIWENDIR=${HAIWENDIR} SUB_FILES= pkg-message SUB_LIST+= USERS=${USERS} \ GROUPS=${GROUPS} \ SEAFILE_SERVER=${SEAFILE_SERVER} \ HAIWENDIR=${HAIWENDIR} MAKE_JOBS_UNSAFE= yes OPTIONS_DEFINE= FUSE OPTIONS_SUB= yes FUSE_DESC= Use file system in userspace FUSE_CONFIGURE_ENABLE= fuse FUSE_LIB_DEPENDS= libfuse.so:sysutils/fusefs-libs OPTIONS_DEFAULT= FUSE OPTIONS_EXCLUDE_DragonFly= FUSE .include post-patch: # Fix P_KTHREAD r295435 .if ${OSVERSION} >= 1100097 ${REINPLACE_CMD} 's/P_KTHREAD/P_KPROC/' ${WRKSRC}/lib/utils.c .endif ${REINPLACE_CMD} 's/python/${PYTHON_VERSION}/' \ ${WRKSRC}/scripts/upgrade/regenerate_secret_key.sh ${REINPLACE_CMD} -e 's|^INSTALL.*|INSTALLPATH="${PREFIX}/${SEAFILE_SERVER}/seafile"|' \ ${WRKSRC}/scripts/seaf-cli-wrapper.sh ${REINPLACE_CMD} 's///' ${WRKSRC}/server/upload-file.c \ ${WRKSRC}/server/access-file.c ${WRKSRC}/server/http-server.c ${REINPLACE_CMD} -E 's/stat.+\$$/stat -f %Su $$/' ${WRKSRC}/scripts/seafile.sh + ${REINPLACE_CMD} 's/%%SEAFILE_USER%%/${USERS:[1]}/ ; s/%%SEAFILE_GROUP%%/${GROUPS:[1]}/' \ + ${WRKSRC}/scripts/setup-seafile.sh ${WRKSRC}/scripts/setup-seafile-mysql.py post-install: @${MKDIR} ${STAGEDIR}${PREFIX}/${SEABIN} ${STAGEDIR}${PREFIX}/${SEALIB} \ ${STAGEDIR}${PREFIX}/${SEAFILE_SERVER}/seafile/share/doc/seafile \ ${STAGEDIR}${PREFIX}/${SEAFILE_SERVER}/upgrade .for SERVPROG in seaf-fsck seafserv-gc seaf-fuse seaf-migrate \ seaf-server seaf-server-init seafile-controller if [ -e "${STAGEDIR}${PREFIX}/bin/${SERVPROG}" ]; then \ ${INSTALL_PROGRAM} ${STAGEDIR}${PREFIX}/bin/${SERVPROG} ${STAGEDIR}${PREFIX}/${SEABIN}; \ ${RM} ${STAGEDIR}${PREFIX}/bin/${SERVPROG}; \ fi .endfor .for SERVPROG in seafile-controller seaf-server ${LN} -s "../${SEABIN}/${SERVPROG}" ${STAGEDIR}${PREFIX}/bin/${SERVPROG} .endfor (cd ${STAGEDIR}${PREFIX}/lib && \ ${COPYTREE_SHARE} ${PYTHON_VERSION} ${STAGEDIR}${PREFIX}/${SEALIB}) @${RM} -rf ${STAGEDIR}${PREFIX}/lib/${PYTHON_VERSION} \ ${STAGEDIR}${PREFIX}/bin/seafile-admin ${INSTALL_SCRIPT} ${WRKSRC}/scripts/*.[ps][yh] ${STAGEDIR}${PREFIX}/${SEAFILE_SERVER} ${INSTALL_SCRIPT} ${WRKSRC}/scripts/upgrade/*.[ps][yh] \ ${STAGEDIR}${PREFIX}/${SEAFILE_SERVER}/upgrade ${INSTALL_DATA} ${WRKSRC}/doc/seafile-tutorial.doc \ ${STAGEDIR}${PREFIX}/${SEAFILE_SERVER}/seafile/share/doc/seafile/ (cd ${WRKSRC}/scripts/upgrade && \ ${COPYTREE_SHARE} sql ${STAGEDIR}${PREFIX}/${SEAFILE_SERVER}/upgrade) .include Index: head/net-mgmt/seafile-server/files/patch-scripts_setup-seafile-mysql.py =================================================================== --- head/net-mgmt/seafile-server/files/patch-scripts_setup-seafile-mysql.py (nonexistent) +++ head/net-mgmt/seafile-server/files/patch-scripts_setup-seafile-mysql.py (revision 436504) @@ -0,0 +1,80 @@ +--- scripts/setup-seafile-mysql.py.orig 2017-03-18 16:19:38 UTC ++++ scripts/setup-seafile-mysql.py +@@ -19,6 +19,8 @@ from ConfigParser import ConfigParser + + import MySQLdb + ++import pwd ++import grp + + try: + import readline # pylint: disable=W0611 +@@ -422,8 +424,6 @@ Please choose a way to initialize seafile databases: + if not re.match(r'^[a-zA-Z0-9_\-\.]+$', host): + raise InvalidAnswer('%s is not a valid host' % Utils.highlight(host)) + +- if host == 'localhost': +- host = '127.0.0.1' + return host + + def ask_mysql_host(self): +@@ -1167,17 +1167,23 @@ share_name = / + + class UserManualHandler(object): + def __init__(self): +- self.src_docs_dir = os.path.join(env_mgr.install_path, 'seafile', 'docs') ++ self.src_docs_dir = os.path.join(env_mgr.install_path, 'seafile', 'share', 'doc', 'seafile') + self.library_template_dir = None + + def copy_user_manuals(self): + self.library_template_dir = os.path.join(seafile_config.seafile_dir, 'library-template') + Utils.must_mkdir(self.library_template_dir) + ++ uid = pwd.getpwnam("%%SEAFILE_USER%%").pw_uid ++ gid = grp.getgrnam("%%SEAFILE_GROUP%%").gr_gid ++ os.chown(self.library_template_dir, uid, gid) ++ + pattern = os.path.join(self.src_docs_dir, '*.doc') + + for doc in glob.glob(pattern): + Utils.must_copy(doc, self.library_template_dir) ++ doc_full = os.path.join(self.library_template_dir, os.path.basename(doc)) ++ os.chown(doc_full, uid, gid) + + def report_config(): + print +@@ -1242,6 +1248,8 @@ def create_seafile_server_symlink(): + def set_file_perm(): + filemode = 0600 + dirmode = 0700 ++ uid = pwd.getpwnam("%%SEAFILE_USER%%").pw_uid ++ gid = grp.getgrnam("%%SEAFILE_GROUP%%").gr_gid + files = [ + seahub_config.seahub_settings_py, + ] +@@ -1253,8 +1261,10 @@ def set_file_perm(): + ] + for fpath in files: + os.chmod(fpath, filemode) ++ os.chown(fpath, uid, gid) + for dpath in dirs: + os.chmod(dpath, dirmode) ++ os.chown(dpath, uid, gid) + + env_mgr = EnvManager() + ccnet_config = CcnetConfigurator() +@@ -1445,8 +1455,12 @@ def report_success(): + Your seafile server configuration has been finished successfully. + ----------------------------------------------------------------- + +-run seafile server: ./seafile.sh { start | stop | restart } +-run seahub server: ./seahub.sh { start | stop | restart } ++run seafile server: sysrc seafile_enable=YES ++ service seafile { start | stop | restart } ++run seahub server: sysrc seahub_enable=YES ++fastcgi (optional): sysrc seahub_fastcgi=1 ++ service seahub { start | stop | restart } ++run reset-admin: ./reset-admin.sh + + ----------------------------------------------------------------- + If you are behind a firewall, remember to allow input/output of these tcp ports: Property changes on: head/net-mgmt/seafile-server/files/patch-scripts_setup-seafile-mysql.py ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/net-mgmt/seafile-server/files/patch-scripts_setup-seafile.sh =================================================================== --- head/net-mgmt/seafile-server/files/patch-scripts_setup-seafile.sh (revision 436503) +++ head/net-mgmt/seafile-server/files/patch-scripts_setup-seafile.sh (revision 436504) @@ -1,15 +1,66 @@ ---- scripts/setup-seafile.sh.orig 2016-10-21 22:12:15 UTC +--- scripts/setup-seafile.sh.orig 2017-03-13 02:59:56 UTC +++ scripts/setup-seafile.sh -@@ -318,7 +318,11 @@ fi +@@ -15,6 +15,8 @@ use_existing_seafile="false" + + server_manual_http="https://github.com/haiwen/seafile/wiki" + ++os_bsd=$(uname | grep -cm1 -e BSD -e DragonFly) ++ + function welcome () { + echo "-----------------------------------------------------------------" + echo "This script will guide you to config and setup your seafile server." +@@ -318,10 +320,17 @@ fi } function copy_user_manuals() { - src_docs_dir=${INSTALLPATH}/seafile/docs/ -+ if [ $(uname | grep -e BSD -e DragonFly | wc -l) == "1" ]; then ++ if [ $os_bsd == "1" ]; then + src_docs_dir=${INSTALLPATH}/seafile/share/doc/seafile/ + else + src_docs_dir=${INSTALLPATH}/seafile/docs/ + fi library_template_dir=${seafile_data_dir}/library-template mkdir -p ${library_template_dir} cp -f ${src_docs_dir}/*.doc ${library_template_dir} ++ if [ $os_bsd == "1" ]; then ++ chown -R %%SEAFILE_USER%%:%%SEAFILE_GROUP%% "${library_template_dir}" ++ fi + } + + function parse_params() { +@@ -673,6 +682,13 @@ chmod 0600 "$dest_settings_py" + chmod 0700 "$default_ccnet_conf_dir" + chmod 0700 "$seafile_data_dir" + chmod 0700 "$default_conf_dir" ++if [ $os_bsd == "1" ]; then ++ chown %%SEAFILE_USER%%:%%SEAFILE_GROUP%% "$dest_settings_py" ++ chown %%SEAFILE_USER%%:%%SEAFILE_GROUP%% "$default_ccnet_conf_dir" ++ chown -R %%SEAFILE_USER%%:%%SEAFILE_GROUP%% "$seafile_data_dir" ++ chown %%SEAFILE_USER%%:%%SEAFILE_GROUP%% "$default_conf_dir" ++ chown %%SEAFILE_USER%%:%%SEAFILE_GROUP%% "$seahub_db" ++fi + + # ------------------------------------------- + # copy user manuals to library template +@@ -689,9 +705,18 @@ echo + echo "-----------------------------------------------------------------" + echo "Your seafile server configuration has been completed successfully." + echo "-----------------------------------------------------------------" +-echo +-echo "run seafile server: ./seafile.sh { start | stop | restart }" +-echo "run seahub server: ./seahub.sh { start | stop | restart }" ++echo ++if [ $os_bsd == "1" ]; then ++ echo "run seafile server: sysrc seafile_enable=YES" ++ echo " service seafile { start | stop | restart }" ++ echo "run seahub server: sysrc seahub_enable=YES" ++ echo "fastcgi (optional): sysrc seahub_fastcgi=1" ++ echo " service seahub { start | stop | restart }" ++ echo "run reset-admin: ./reset-admin.sh" ++else ++ echo "run seafile server: ./seafile.sh { start | stop | restart }" ++ echo "run seahub server: ./seahub.sh { start | stop | restart }" ++fi + echo + echo "-----------------------------------------------------------------" + echo "If the server is behind a firewall, remember to open these tcp ports:" Index: head/net-mgmt/seafile-server/files/pkg-message.in =================================================================== --- head/net-mgmt/seafile-server/files/pkg-message.in (revision 436503) +++ head/net-mgmt/seafile-server/files/pkg-message.in (revision 436504) @@ -1,12 +1,12 @@ -For an existing config, or creating a new one, fix the UID/GID. -Do not change %%PREFIX%%/%%SEAFILE_SERVER%% unless your front -end is using the seafile UID/GID as well. +To generate a new config, +cd %%PREFIX%%/%%SEAFILE_SERVER%% +Then choose sqlite or mysql, mysql needs to be setup with root. +sqlite: ./setup-seafile.sh +mysql: ./setup-seafile-mysql.sh +Further instructions will be provided after the setup script is finished. -chown -R seafile:seafile %%PREFIX%%/%%HAIWENDIR%%/conf \ - %%PREFIX%%/%%HAIWENDIR%%/ccnet %%PREFIX%%/%%HAIWENDIR%%/seafile-data \ - %%PREFIX%%/%%HAIWENDIR%%/pids %%PREFIX%%/%%HAIWENDIR%%/logs Don't forget to run update scripts after every minor and major update located in %%PREFIX%%/%%SEAFILE_SERVER%%/upgrade Patch updates (5.1.x) don't require these scripts, however do required a restarted.