Commit 6177362c authored by Alec Leamas's avatar Alec Leamas

Adding the ubuntu install package, initial version.

T
parent 1fcf45da
......@@ -17,6 +17,7 @@ nbproject
gpg/diaspora-development/*.gpg
gpg/diaspora-production/*.gpg
gpg/*/random_seed
patches-*
public/uploads/*
public/source.tar
tmp/**/*
......
......@@ -34,6 +34,10 @@ find . -perm /u+x -type f -exec \
%build
rm -rf master/vendor/bundle
<<<<<<< HEAD
mkdir master/tmp || :
=======
>>>>>>> upstream/master
%install
rm -fr $RPM_BUILD_ROOT
......@@ -55,7 +59,14 @@ cp %SOURCE3 $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/diaspora
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/diaspora
cp -ar master $RPM_BUILD_ROOT/%{_datadir}/diaspora
<<<<<<< HEAD
cp -ar master/.bundle $RPM_BUILD_ROOT/%{_datadir}/diaspora/master
cp diaspora-setup $RPM_BUILD_ROOT/%{_datadir}/diaspora
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/uploads
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/tmp
=======
cp %SOURCE2 $RPM_BUILD_ROOT/%{_datadir}/diaspora
>>>>>>> upstream/master
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/log/diaspora
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/uploads
......@@ -80,8 +91,25 @@ sed -i -e '\|.*/master/config.ru"$|d' \
%post
<<<<<<< HEAD
rm -f %{_datadir}/diaspora/master/vendor/bundle
rm -f %{_datadir}/diaspora/master/log
rm -f %{_datadir}/diaspora/master/public/uploads
rm -rf %{_datadir}/diaspora/master/tmp
ln -s %{_localstatedir}/log/diaspora \
%{_datadir}/diaspora/master/log || :
ln -s %{_libdir}/diaspora-bundle/master/vendor/bundle \
%{_datadir}/diaspora/master/vendor || :
ln -s %{_localstatedir}/lib/diaspora/uploads \
%{_datadir}/diaspora/master/public/uploads || :
ln -s %{_localstatedir}/lib/diaspora/tmp \
%{_datadir}/diaspora/master/tmp || :
/sbin/chkconfig --add diaspora-ws || :
=======
/sbin/chkconfig --add diaspora-wsd
>>>>>>> upstream/master
%preun
if [ $1 -eq 0 ] ; then
......@@ -96,15 +124,22 @@ rm -fr $RPM_BUILD_ROOT
%files -f files
%defattr(-, root, root, 0755)
<<<<<<< HEAD
%doc README.md GNU-AGPL-3.0
=======
%doc AUTHORS README.md GNU-AGPL-3.0 COPYRIGHT README-Fedora.md
>>>>>>> upstream/master
%attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/config.ru
%attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/config/environment.rb
%attr(-, diaspora, diaspora) %{_localstatedir}/log/diaspora
%attr(-, diaspora, diaspora) %{_localstatedir}/lib/diaspora/uploads
%attr(-, diaspora, diaspora) %{_localstatedir}/lib/diaspora/tmp
<<<<<<< HEAD
=======
%{_datadir}/diaspora/master/tmp
%{_datadir}/diaspora/master/public/uploads
%{_datadir}/diaspora/master/log
>>>>>>> upstream/master
%config(noreplace) %{_sysconfdir}/logrotate.d/diaspora
%{_sysconfdir}/init.d/diaspora-wsd
......
......@@ -126,8 +126,7 @@ function checkout()
git clone --quiet $GIT_REPO;
(
cd diaspora;
git remote add upstream \
git://github.com/diaspora/diaspora.git
git remote add upstream $GIT_REPO
for p in ../../*.patch; do
git apply --whitespace=fix $p > /dev/null
done &> /dev/null || :
......@@ -159,7 +158,6 @@ function make_src
cd dist
mkdir ${RELEASE_DIR}/master
cp -ar diaspora/* diaspora/.git* ${RELEASE_DIR}/master
mv ${RELEASE_DIR}/master/diaspora.spec ${RELEASE_DIR}
(
cd ${RELEASE_DIR}/master
git show --name-only > config/gitversion
......@@ -168,6 +166,9 @@ function make_src
find $PWD -name .git\* | xargs rm -rf
rm -rf .bundle
/usr/bin/patch -p1 -s <../../../add-bundle.diff
for p in ../../../*.patch; do
/usr/bin/patch -p1 -s < $p
done &> /dev/null || :
)
tar czf ${RELEASE_DIR}.tar.gz ${RELEASE_DIR} && \
rm -rf ${RELEASE_DIR}
......@@ -203,7 +204,8 @@ function make_bundle()
cd ..
}
echo
echo "Bundle: dist/$bundle_name.tar.gz"
echo "Repo: $GIT_REPO"
echo "Bundle: dist/$bundle_name.tar.gz"
}
......@@ -278,9 +280,8 @@ function usage()
EOF
}
commit='HEAD'
while getopts ":r:c:h" opt
while getopts ":r:c:u:h" opt
do
case $opt in
u) GIT_REPO="$OPTARG"
......
## Package-oriented install for ubuntu.
Here are some scripts to install diaspora on Ubuntu. They are designed to
work as a first step towards packaging, but should be usable as is.
### Synopsis
Bootstrap the distribution from git:
git clone git://github.com/diaspora/diaspora.git
cd diaspora/pkg/ubuntu
Install the dependencies (a good time for a coffe break)
./diaspora-install-deps
Create and install the diaspora bundle and application:
./make-dist.sh bundle
sudo ./diaspora-bundle-install dist/diaspora-bundle-*.tar.gz
./make-dist.sh source
sudo ./diaspora-install dist/diaspora-0.0*.tar.gz
Initiate and start the server;
sudo ./diaspora-setup
sudo su - diaspora
cd /usr/share/diaspora/master
./script/server
### Notes
The application lives in /usr/share/diaspora/master. All writable areas
(log, uploads, tmp) are links to /var/lib/diaspora. The config file lives
in /etc/diaspora. All files in /usr/share are read-only, owned by root.
The bundle lives in /usr/lib/diaspora-bundle, readonly,owned by root.
Application finds it through the patched .bundle/config in root dir.
The user diaspora is added during install.
The 'make-dist-source' prints a message about the version of the bundle
it needs. Normally, it doesn't change and it's a fast procedure to generate
and install the source tarball. Generating the bundle takes some time, though.
make-dist.sh accepts arguments to get a specified commit and/or use another
repo.
This has been tested on a Ubuntu 32-bit 10.10 , clean server. Since this
is a very small dist, the dependencies should possibly be complete.
The diaspora-wsd is just placeholder FTM, it does **not** work.
Please, report any problems!
diff --git a/.bundle/config b/.bundle/config
new file mode 100644
index 0000000..1c3e2ce
--- /dev/null
+++ b/.bundle/config
@@ -0,0 +1,5 @@
+---
+BUNDLE_FROZEN: "1"
+BUNDLE_DISABLE_SHARED_GEMS: "1"
+BUNDLE_WITHOUT: test:rdoc
+BUNDLE_PATH: vendor/bundle
#!/bin/sh
test "$(perl -e 'print $>')" = "0" || {
echo "You need to be root to do this, giving up"
exit 2
}
test $# = "1" || {
echo "Usage: diaspora-bundle-install <diaspora-bundle-VERSION-RELEASE.tar.gz>"
exit 1
}
test -r "$1" || {
echo "Cannot open $1"
exit 2
}
rm -rf /usr/lib/diaspora-bundle
tar xf $1 -C /usr/lib
cd /usr/lib
mv $(basename $1 .tar.gz) diaspora-bundle
mkdir -p /usr/share/doc/diaspora-bundle || :
cd /usr/lib/diaspora-bundle
cp AUTHORS GNU-AGPL-3.0 COPYRIGHT /usr/share/doc/diaspora-bundle
#!/bin/bash
#
# Install a fedora source package
#
# Usage diaspora-install <tar package>
test "$(perl -e 'print $>')" = "0" || {
echo "You need to be root to do this, giving up"
exit 2
}
set -x
getent group diaspora >/dev/null || groupadd -r diaspora
getent passwd diaspora >/dev/null || \
useradd -r -g diaspora \
-md /var/lib/diaspora \
-s /bin/bash \
-c "Diaspora daemon" diaspora
sudo tar -C /usr/share -xzf $1
cd /usr/share;
rm -rf /usr/share/diaspora
mv $( basename $1 .tar.gz) diaspora
cd /usr/share/diaspora
find . -perm /u+x -type f -exec \
sed -i 's|^#!/usr/local/bin/ruby|#!/usr/bin/ruby|' {} \; > /dev/null
rm -rf master/vendor/bundle master/public/uploads master/tmp master/log
sed -i '/BUNDLE_PATH/s|:.*|: /usr/lib/diaspora-bundle/bundle|' \
master/.bundle/config
cp master/GNU-AGPL-3.0 master/COPYRIGHT master/README.md master/AUTHORS .
cp master/config/app_config.yml.example ./app_config.yml
cp master/pkg/ubuntu/diaspora-wsd /etc/init.d
sed -i '/^cd /s|.*|cd /usr/share/diaspora/master|' /etc/init.d/diaspora-wsd
cp master/pkg/ubuntu/diaspora.logrotate /etc/logrotate.d/diaspora
cp master/pkg/ubuntu/diaspora-setup .
mkdir -p /var/log/diaspora
mkdir -p /var/lib/diaspora/uploads
mkdir -p /var/lib/diaspora/tmp
mkdir -p /etc/diaspora
ln -sf /var/log/diaspora ./master/log
cp master/config/app_config.yml.example /etc/diaspora/app_config.yml
ln -sf /etc/diaspora/app_config.yml master/config/app_config.yml
ln -sf /var/lib/diaspora/uploads master/public/
ln -sf /var/lib/diaspora/tmp master
ln -sf /usr/lib/diaspora-bundle/bundle master/vendor
rm -rf /usr/share/doc/diaspora
mkdir -p /usr/share/doc/diaspora
mv AUTHORS README.md GNU-AGPL-3.0 COPYRIGHT /usr/share/doc/diaspora
find ./ -print | xargs chown root:root
rm -rf /usr/share/doc/diaspora
mkdir /usr/share/doc/diaspora
chown diaspora:diaspora /usr/share/diaspora/master/config.ru
chown diaspora:diaspora /usr/share/diaspora/master/config/environment.rb
chown diaspora:diaspora /var/log/diaspora
chown diaspora:diaspora /var/lib/diaspora/uploads
chown diaspora:diaspora /var/lib/diaspora/tmp
chown diaspora:diaspora /var/lib/diaspora
#!/bin/bash
#
# Install diaspora dependencies i. e., what apt-get will do
#
set -x
sudo apt-get update
sudo apt-get install -qy build-essential libxslt1-dev libxml2 ruby-full mongodb \
rake python-software-properties git imagemagick libmagick9-dev
[starts mongodb]
sudo add-apt-repository ppa:maco.m/ruby
sudo apt-get update
sudo apt-get install -qy rubygems
sudo gem install bundler --bindir /usr/local/bin
#!/bin/sh
#
# Try to revert to pristine state, deleting all users and
# configuration
#
set -x
service mongodb stop
rm -rf /var/lib/mongodb/*
cp /usr/share/diaspora/master/config/app_config.yml.example \
/usr/share/diaspora/master/config/app_config.yml
service mongodb start
#!/bin/bash
#
# Do what's needed to initiate diaspora.
#
test "$( perl -e 'print $<')" = "0" || {
echo "You need to be root to do this, giving up"
exit 2
}
services=$( netstat -nl | grep '[^:]:3000[ \t]')
test -n "$services" && {
echo "Warning: something is already using port 3000"
echo " $services"
}
/usr/sbin/service mongodb start || :
cd /usr/share/diaspora/master
test -e config/app_config.yml ||
cp config/app_config.yml.example config/app_config.yml
if rake db:seed:dev; then
echo "Database config OK, new user tom/evankorth in place"
else
cat <<- EOF
Database config failed. You might want to remove all db files with
'rm -rf /var/lib/mongodb/*' and/or resetting the config file by
'cp config/app_config.yml.example config/app_config.yml' before
making a new try. Also, make sure the mongodb server is running
e. g., using '/sbin/service mongod status'.
EOF
exit 1
fi
chmod 777 /var/lib/diaspora/uploads
chown -R diaspora /var/log/diaspora
hostname=$( awk '/pod_url:/ { print $2; exit }' <config/app_config.yml)
while : ; do
echo "Current hostname is \"$hostname\""
echo -n "Enter new hostname [$hostname] :"
read new_hostname garbage
echo -n "Use hostname \"$new_hostname\" as pod_url (Yes/No) [Yes]? :"
read yesno garbage
test "${yesno:0:1}" = 'y' -o "${yesno:0:1}" = 'Y' -o -z "$yesno" && {
sed -i "/pod_url:/s/$hostname/$new_hostname/g" config/app_config.yml &&
echo "config/app_config.yml updated."
break
}
done
#!/bin/bash
#
# /etc/rc.d/init.d/diaspora-wsd
#
# SHOULD start the diaspora websocket daemon, but it doesn't. No way.
#
# chkconfig: - 80 80
# description: Diaspora websocket daemon
### BEGIN INIT INFO
# Provides: diaspora-wsd
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start: $remote_fs
# Should-Stop: $remote_fs
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: start and stop Diaspora websocket server
# Description: The websocket server provides websocket services for
# diaspora.
### END INIT INFO
# Source function library.
. /etc/init.d/functions
if [ -f /etc/sysconfig/diaspora-wsd -a $UID -eq 0 ]; then
. /etc/sysconfig/diaspora-wsd
fi
# Note: this line is patched by installation scripts.
cd /usr/share/diaspora
RETVAL=0
prog="Diaspora websocket server"
exec="script/websocket_server.rb"
pidfile="/var/run/diaspora-wsd"
lockfile="/var/lock/subsys/diaspora-wsd"
logfile=/var/log/diaspora-wsd.log
[ -n "$OPTIONS" ] && OPTIONS=" $OPTIONS"
ruby_cmd="ruby -C $PWD $exec$OPTIONS"
start() {
[ $UID -eq 0 ] || exit 4
[ -f $exec ] || exit 5
echo -n $"Starting $prog: "
daemon --pidfile $pidfile "$ruby_cmd >>$logfile 2>&1 &"
RETVAL=$?
echo
if test $RETVAL = 0; then
touch $lockfile
pgrep -f "$ruby_cmd" > $pidfile || {
echo "Warning: cannot find running diaspora-webserver"
exit 7
}
fi
}
stop() {
[ $UID -eq 0 ] || exit 4
echo -n $"Stopping $prog: "
killproc -p $pidfile $exec
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $lockfile
echo
}
#
# See how we were called.
#
case "$1" in
start)
start
;;
stop)
stop
;;
force-reload|restart)
stop
sleep 1
start
RETVAL=$?
;;
condrestart|try-restart)
if [ -f $lockfile ]; then
stop
sleep 3
start
fi
;;
status)
status -p $pidfile $exec
RETVAL=$?
;;
*)
echo $"Usage: $0 {condrestart|try-restart|start|stop|restart|force-reload|status}"
RETVAL=2
[ "$1" = 'usage' ] && RETVAL=0
esac
exit $RETVAL
/var/log/diaspora/*.log {
create 755 diaspora diaspora
weekly
rotate 10
copytruncate
delaycompress
compress
notifempty
missingok
postrotate
( /sbin/service diaspora-wsd condrestart ) >/dev/null 2>&1
endscript
}
../fedora/make-dist.sh
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment