Commit ddb274fd authored by Cédric Moreau's avatar Cédric Moreau
Browse files

Fix #421 Debian packaging directly in source code repository

parent a1ef3226
......@@ -53,8 +53,7 @@ before_deploy:
- cd ucoin_release
- tar czf ../duniter-x64.tar.gz * --exclude ".git" --exclude "coverage" --exclude "test"
- cd ..
- git clone https://github.com/ucoin-io/debpkg.git duniter-x64
- rm -Rf duniter-x64/.git
- mv ucoin_release/sources/ci/travis/debian duniter-x64
- mkdir -p duniter-x64/opt/duniter/
- chmod 755 duniter-x64/DEBIAN/post*
- chmod 755 duniter-x64/DEBIAN/pre*
......
#!/bin/bash
export GITHUB_TOKEN=92472757742be0862c0020197ce7896b66043742
rm -Rf ucoin*
rm -Rf duniter*
git clone https://github.com/duniter/duniter
cd duniter
echo "Fetching tags..."
git fetch --tags
COMMIT=`git rev-list --tags --max-count=1`
DUNITER_VER=`echo $(git describe --tags $COMMIT) | sed 's/^v//'`
ARCH=`uname -m | sed "s/86_//"`
url="https://github.com/duniter/duniter/releases/download/v${DUNITER_VER}/duniter-v${DUNITER_VER}-linux-${ARCH}.deb"
echo $DUNITER_VER
echo "Checking if release exists..."
if curl --output /dev/null --silent --head --fail "$url"; then
echo "Artifact already published."
else
echo "Checkout to last tag..."
echo ">> Release v$DUNITER_VER"
git checkout v$DUNITER_VER
NVER="v5.9.1"
DUNITER_DEB_VER=" $DUNITER_VER"
echo "$ARCH"
echo "$NVER"
echo "$DUNITER_VER"
echo "$DUNITER_DEB_VER"
wget http://nodejs.org/dist/${NVER}/node-${NVER}-linux-${ARCH}.tar.gz
tar xzf node-${NVER}-linux-${ARCH}.tar.gz
mv node-${NVER}-linux-${ARCH} node
rm node-${NVER}-linux-${ARCH}.tar.gz
node/bin/npm install
node/bin/npm prune --production
SRC=`pwd`
echo $SRC
cd ..
mkdir -p duniter_release
cp -R ${SRC}/ duniter_release/sources/
mv duniter_release/sources/node duniter_release
rm -Rf duniter_release/sources/ui/package/node_modules
rm -Rf duniter_release/sources/ui/package/bower_components
git clone https://github.com/ucoin-io/debpkg.git duniter-${ARCH}
rm -Rf duniter-${ARCH}/.git
mkdir -p duniter-${ARCH}/opt/duniter/
chmod 755 duniter-${ARCH}/DEBIAN/post*
chmod 755 duniter-${ARCH}/DEBIAN/pre*
sed -i "s/Version:.*/Version:$DUNITER_DEB_VER/g" duniter-${ARCH}/DEBIAN/control
cd duniter_release/sources
pwd
rm -Rf .git
zip -qr ../duniter-desktop.nw *
cd ../..
mv duniter_release/duniter-desktop.nw duniter-${ARCH}/opt/duniter/
mv duniter_release/node duniter-${ARCH}/opt/duniter/
fakeroot dpkg-deb --build duniter-${ARCH}
mv duniter-${ARCH}.deb duniter-v${DUNITER_VER}-linux-${ARCH}.deb
./github-release upload -u ucoin-io -r ucoin --tag v${DUNITER_VER} --name duniter-v${DUNITER_VER}-linux-${ARCH}.deb --file ~/dev/duniter-v${DUNITER_VER}-linux-${ARCH}.deb
fi
Package: duniter
Version: 0.4
Section: misc
Priority: optional
Architecture: all
Installed-Size: 200000
Maintainer: Cedric Moreau <cem.moreau@gmail.com>
Description: Duniter desktop version
#!/bin/bash
DUN_ROOT=/opt/duniter
mkdir $DUN_ROOT/sources
# Duniter sources
if [[ -f $DUN_ROOT/duniter-desktop.nw ]]; then
unzip -d $DUN_ROOT/sources/ $DUN_ROOT/duniter-desktop.nw
fi
# Duniter-Desktop
if [[ -f $DUN_ROOT/nw.nwb ]]; then
unzip -d $DUN_ROOT/nw $DUN_ROOT/nw.nwb
cp -R $DUN_ROOT/sources/gui/* $DUN_ROOT/nw/
chmod +x $DUN_ROOT/nw/nw $DUN_ROOT/nw/lib $DUN_ROOT/nw/locales
ln -s $DUN_ROOT/nw/nw /usr/bin/duniter-desktop
fi
# Duniter CLI executes with embedded node
if [[ -d $DUN_ROOT/node ]]; then
chmod 755 $DUN_ROOT/sources/bin/ucoind
sed -i "s/usr\/bin\/env node/opt\/duniter\/node\/bin\/node/g" $DUN_ROOT/sources/bin/ucoind
fi
# Else will execute with environment node
ln -s $DUN_ROOT/sources/bin/ucoind /usr/bin/duniter
chmod +r -R $DUN_ROOT
#!/bin/bash
rm /usr/bin/duniter
rm /usr/bin/duniter-desktop
rm -Rf /opt/duniter
[Desktop Entry]
Name=Duniter Desktop
Exec=duniter-desktop
Icon=/opt/duniter/nw/duniter.png
Type=Application
Categories=Utility
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