Symlink tmp-dir to /var/lib,leaving other files to root.
Turns the overall installation to being write-protected.
This commit is contained in:
parent
0c30f544d9
commit
97f7b4d2ad
3 changed files with 40 additions and 43 deletions
|
|
@ -68,15 +68,6 @@ directory, copy-paste previous version nr. It will be updated.
|
||||||
This has been confirmed to start up and provide basic functionality both using
|
This has been confirmed to start up and provide basic functionality both using
|
||||||
the thin webserver and apache passenger, and on 32/64 bit systems.
|
the thin webserver and apache passenger, and on 32/64 bit systems.
|
||||||
|
|
||||||
#### Bugs
|
|
||||||
|
|
||||||
As of now, diaspora fails if it not owns all file under /usr/share/diaspora.
|
|
||||||
I guess this means diaspora writes some stuff somewhere. In the long run,
|
|
||||||
this should be located and symlinked to /var,leaving the rest of the files
|
|
||||||
owned by root. FTM, all files in /usr/share/diaspore are owned by
|
|
||||||
diaspora
|
|
||||||
|
|
||||||
|
|
||||||
#### Implementation
|
#### Implementation
|
||||||
|
|
||||||
'make-dist.sh source' script checks out latest version of diaspora into the
|
'make-dist.sh source' script checks out latest version of diaspora into the
|
||||||
|
|
@ -89,17 +80,18 @@ patches, the content of diaspora-bundle.
|
||||||
Here is also support for running the diaspora websocket service as a system
|
Here is also support for running the diaspora websocket service as a system
|
||||||
service through /sbin/service and some install scripts.
|
service through /sbin/service and some install scripts.
|
||||||
|
|
||||||
Diaspora files are stored in /usr/share/diaspora, and owned by diaspora. The
|
Diaspora files are stored in /usr/share/diaspora, and owned by root. The
|
||||||
bundle, containing some C extensions, is architecture-dependent and lives
|
bundle, containing some C extensions, is architecture-dependent and lives
|
||||||
in /usr/lib[64]/diaspora. Log files are in /var/log/diaspora. Symlinks in
|
in /usr/lib[64]/diaspora. Log files are in /var/log/diaspora. Symlinks in
|
||||||
/usr/share diaspora makes log and bundle available as expected by diaspora app.
|
/usr/share diaspora makes log, bundle and tmp dir available as expected by
|
||||||
This is more or less as mandated by LSB and Fedora packaging rules.
|
diaspora app. This is more or less as mandated by LSB and Fedora packaging rules.
|
||||||
|
|
||||||
find /usr/share/diaspora/ -type l -exec ls -l {} \; | awk '{print $9, $10, $11}'
|
|
||||||
/usr/share/diaspora/master/public/uploads -> /var/lib/diaspora/uploads
|
|
||||||
/usr/share/diaspora/master/log -> /var/log/diaspora
|
|
||||||
/usr/share/diaspora/master/vendor/bundle -> /usr/lib/diaspora-bundle/master/vendor/bundle
|
|
||||||
|
|
||||||
|
find . -type l -exec ls -l {} \; | awk '{print $9, $10, $11}'
|
||||||
|
./public/uploads -> /var/lib/diaspora/uploads
|
||||||
|
./log -> /var/log/diaspora
|
||||||
|
./tmp -> /var/lib/diaspora/tmp
|
||||||
|
./vendor/bundle -> /usr/lib/diaspora-bundle/master/vendor/bundle
|
||||||
|
|
||||||
|
|
||||||
#### Discussion
|
#### Discussion
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ cp -ar master $RPM_BUILD_ROOT/%{_datadir}/diaspora
|
||||||
cp -ar master/.gitignore master/.bundle $RPM_BUILD_ROOT/%{_datadir}/diaspora/master
|
cp -ar master/.gitignore master/.bundle $RPM_BUILD_ROOT/%{_datadir}/diaspora/master
|
||||||
cp diaspora-setup $RPM_BUILD_ROOT/%{_datadir}/diaspora
|
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/uploads
|
||||||
|
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/tmp
|
||||||
|
|
||||||
find $RPM_BUILD_ROOT/%{_datadir}/diaspora -type d -fprintf dirs '%%%dir "%%p"\n'
|
find $RPM_BUILD_ROOT/%{_datadir}/diaspora -type d -fprintf dirs '%%%dir "%%p"\n'
|
||||||
find -L $RPM_BUILD_ROOT/%{_datadir}/diaspora -type f -fprintf files '"%%p"\n'
|
find -L $RPM_BUILD_ROOT/%{_datadir}/diaspora -type f -fprintf files '"%%p"\n'
|
||||||
|
|
@ -67,6 +68,7 @@ sed -i -e '\|.*/master/config.ru"$|d' \
|
||||||
rm -f %{_datadir}/diaspora/master/vendor/bundle
|
rm -f %{_datadir}/diaspora/master/vendor/bundle
|
||||||
rm -f %{_datadir}/diaspora/master/log
|
rm -f %{_datadir}/diaspora/master/log
|
||||||
rm -f %{_datadir}/diaspora/master/public/uploads
|
rm -f %{_datadir}/diaspora/master/public/uploads
|
||||||
|
rm -rf %{_datadir}/diaspora/master/tmp
|
||||||
|
|
||||||
ln -s %{_localstatedir}/log/diaspora \
|
ln -s %{_localstatedir}/log/diaspora \
|
||||||
%{_datadir}/diaspora/master/log || :
|
%{_datadir}/diaspora/master/log || :
|
||||||
|
|
@ -74,6 +76,8 @@ ln -s %{_libdir}/diaspora-bundle/master/vendor/bundle \
|
||||||
%{_datadir}/diaspora/master/vendor || :
|
%{_datadir}/diaspora/master/vendor || :
|
||||||
ln -s %{_localstatedir}/lib/diaspora/uploads \
|
ln -s %{_localstatedir}/lib/diaspora/uploads \
|
||||||
%{_datadir}/diaspora/master/public/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-ws || :
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
|
|
@ -86,12 +90,13 @@ fi
|
||||||
[ "$RPM_BUILD_ROOT" != "/" ] && rm -fr $RPM_BUILD_ROOT
|
[ "$RPM_BUILD_ROOT" != "/" ] && rm -fr $RPM_BUILD_ROOT
|
||||||
|
|
||||||
%files -f files
|
%files -f files
|
||||||
%defattr(-, diaspora, diaspora, 0755)
|
%defattr(-, root, root, 0755)
|
||||||
%doc README.md GNU-AGPL-3.0
|
%doc README.md GNU-AGPL-3.0
|
||||||
%attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/config.ru
|
%attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/config.ru
|
||||||
%attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/config/environment.rb
|
%attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/config/environment.rb
|
||||||
%attr(-, diaspora, diaspora) %{_localstatedir}/log/diaspora
|
%attr(-, diaspora, diaspora) %{_localstatedir}/log/diaspora
|
||||||
%attr(-, diaspora, diaspora) %{_localstatedir}/lib/diaspora/uploads
|
%attr(-, diaspora, diaspora) %{_localstatedir}/lib/diaspora/uploads
|
||||||
|
%attr(-, diaspora, diaspora) %{_localstatedir}/lib/diaspora/tmp
|
||||||
%config(noreplace) %{_sysconfdir}/logrotate.d/diaspora
|
%config(noreplace) %{_sysconfdir}/logrotate.d/diaspora
|
||||||
%{_sysconfdir}/init.d/diaspora-ws
|
%{_sysconfdir}/init.d/diaspora-ws
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@ function git_id
|
||||||
file=""
|
file=""
|
||||||
dir=$file_or_dir
|
dir=$file_or_dir
|
||||||
else
|
else
|
||||||
file=$(basename $file_or_dir)
|
file=$(basename $file_or_dir)
|
||||||
dir=$(dirname $file_or_dir)
|
dir=$(dirname $file_or_dir)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export LANG=C
|
export LANG=C
|
||||||
(
|
(
|
||||||
|
|
@ -59,14 +59,14 @@ function fix_alphatag()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gsub( "1[.].*", "")
|
gsub( "1[.].*", "")
|
||||||
printf( "%s%s-1.%s%s\n",
|
printf( "%s%s-1.%s%s\n",
|
||||||
$0, version, release,dist)
|
$0, version, release,dist)
|
||||||
done = 1
|
done = 1
|
||||||
}
|
}
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
{ print }' \
|
{ print }' \
|
||||||
< $1 > $1.tmp && mv -f $1.tmp $1
|
< $1 > $1.tmp && mv -f $1.tmp $1
|
||||||
}
|
}
|
||||||
|
|
||||||
function fix_bundle_deps
|
function fix_bundle_deps
|
||||||
|
|
@ -81,7 +81,7 @@ function fix_bundle_deps
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
{ print}' \
|
{ print}' \
|
||||||
< $1 > $1.tmp && mv -f $1.tmp $1
|
< $1 > $1.tmp && mv -f $1.tmp $1
|
||||||
}
|
}
|
||||||
|
|
||||||
function patch()
|
function patch()
|
||||||
|
|
@ -90,7 +90,7 @@ function patch()
|
||||||
{
|
{
|
||||||
sed -e "/^%define/s|HEAD|$2|" \
|
sed -e "/^%define/s|HEAD|$2|" \
|
||||||
-e '/^Version:/s|.*|Version: '$1'|' \
|
-e '/^Version:/s|.*|Version: '$1'|' \
|
||||||
<diaspora.spec >dist/diaspora.spec
|
<diaspora.spec >dist/diaspora.spec
|
||||||
fix_alphatag dist/diaspora.spec $1 $2
|
fix_alphatag dist/diaspora.spec $1 $2
|
||||||
bundle_id=$(git_id dist/diaspora/Gemfile)
|
bundle_id=$(git_id dist/diaspora/Gemfile)
|
||||||
dist_tag=$(rpm --eval %dist)
|
dist_tag=$(rpm --eval %dist)
|
||||||
|
|
@ -98,7 +98,7 @@ function patch()
|
||||||
sed -e "/^%define/s|HEAD|$bundle_id|" \
|
sed -e "/^%define/s|HEAD|$bundle_id|" \
|
||||||
-e '/^Version:/s|.*|Version: '$1'|' \
|
-e '/^Version:/s|.*|Version: '$1'|' \
|
||||||
< diaspora-bundle.spec > dist/diaspora-bundle.spec
|
< diaspora-bundle.spec > dist/diaspora-bundle.spec
|
||||||
|
|
||||||
cp dist/diaspora.spec dist/diaspora/diaspora.spec
|
cp dist/diaspora.spec dist/diaspora/diaspora.spec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -106,12 +106,12 @@ function checkout()
|
||||||
# Checkout last version of diaspora unless it's already there.
|
# Checkout last version of diaspora unless it's already there.
|
||||||
# Usage: checkout [commit id, defaults to HEAD]
|
# Usage: checkout [commit id, defaults to HEAD]
|
||||||
# Returns: commit for current branch's HEAD.
|
# Returns: commit for current branch's HEAD.
|
||||||
{
|
{
|
||||||
mkdir dist >/dev/null 2>&1 || :
|
mkdir dist >/dev/null 2>&1 || :
|
||||||
(
|
(
|
||||||
cd dist
|
cd dist
|
||||||
test -d diaspora || {
|
test -d diaspora || {
|
||||||
git clone --quiet $GIT_REPO;
|
git clone --quiet $GIT_REPO;
|
||||||
(
|
(
|
||||||
cd diaspora;
|
cd diaspora;
|
||||||
git remote add upstream \
|
git remote add upstream \
|
||||||
|
|
@ -121,11 +121,11 @@ function checkout()
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
cd diaspora;
|
cd diaspora;
|
||||||
git fetch --quiet upstream
|
git fetch --quiet upstream
|
||||||
git merge --quiet upstream/master
|
git merge --quiet upstream/master
|
||||||
git checkout --quiet ${1:-'HEAD'}
|
git checkout --quiet ${1:-'HEAD'}
|
||||||
git_id -n
|
git_id -n
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,10 +136,10 @@ function make_dist
|
||||||
{
|
{
|
||||||
commit=$(checkout ${1:-'HEAD'})
|
commit=$(checkout ${1:-'HEAD'})
|
||||||
echo "Creating source tarball for $commit"
|
echo "Creating source tarball for $commit"
|
||||||
patch $VERSION $commit
|
patch $VERSION $commit
|
||||||
|
|
||||||
RELEASE_DIR="diaspora-$VERSION-$commit"
|
RELEASE_DIR="diaspora-$VERSION-$commit"
|
||||||
rm -rf dist/${RELEASE_DIR}
|
rm -rf dist/${RELEASE_DIR}
|
||||||
mkdir dist/${RELEASE_DIR}
|
mkdir dist/${RELEASE_DIR}
|
||||||
cp diaspora-ws diaspora-setup diaspora.logconf dist/${RELEASE_DIR}
|
cp diaspora-ws diaspora-setup diaspora.logconf dist/${RELEASE_DIR}
|
||||||
cd dist
|
cd dist
|
||||||
|
|
@ -173,7 +173,7 @@ function make_bundle()
|
||||||
test -e "dist/$bundle_name.tar.gz" || {
|
test -e "dist/$bundle_name.tar.gz" || {
|
||||||
echo "Creating bundle $bundle_name"
|
echo "Creating bundle $bundle_name"
|
||||||
cd dist
|
cd dist
|
||||||
rm -rf $bundle_name
|
rm -rf $bundle_name
|
||||||
mkdir -p $bundle_name/bundle
|
mkdir -p $bundle_name/bundle
|
||||||
pushd diaspora > /dev/null
|
pushd diaspora > /dev/null
|
||||||
bundle install --deployment \
|
bundle install --deployment \
|
||||||
|
|
@ -186,7 +186,7 @@ function make_bundle()
|
||||||
tar czf $bundle_name.tar.gz $bundle_name
|
tar czf $bundle_name.tar.gz $bundle_name
|
||||||
cd ..
|
cd ..
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
echo "Bundle: dist/$bundle_name.tar.gz"
|
echo "Bundle: dist/$bundle_name.tar.gz"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -201,7 +201,7 @@ function make_links()
|
||||||
echo "Linking sources to $dest"
|
echo "Linking sources to $dest"
|
||||||
|
|
||||||
src_commit="${1:-$( checkout)}"
|
src_commit="${1:-$( checkout)}"
|
||||||
|
|
||||||
src="dist/diaspora-$VERSION-$src_commit.tar.gz"
|
src="dist/diaspora-$VERSION-$src_commit.tar.gz"
|
||||||
ln -sf $PWD/$src $dest
|
ln -sf $PWD/$src $dest
|
||||||
|
|
||||||
|
|
@ -227,7 +227,7 @@ function usage()
|
||||||
dist Build a diaspora application tarball.
|
dist Build a diaspora application tarball.
|
||||||
bundle Build a bundler(1) bundle for diaspora.
|
bundle Build a bundler(1) bundle for diaspora.
|
||||||
links Symlink bundle and source tarballs to rpm source dir.
|
links Symlink bundle and source tarballs to rpm source dir.
|
||||||
|
|
||||||
All results are stored in dist/
|
All results are stored in dist/
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
@ -246,10 +246,10 @@ test "$1" = "-c" && {
|
||||||
commit="$2"
|
commit="$2"
|
||||||
shift; shift
|
shift; shift
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
|
|
||||||
"bundle") make_bundle $commit
|
"bundle") make_bundle $commit
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
@ -262,11 +262,11 @@ case $1 in
|
||||||
"fix_gemfile")
|
"fix_gemfile")
|
||||||
fix_gemfile
|
fix_gemfile
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*) usage
|
*) usage
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue