Skip to content

Instantly share code, notes, and snippets.

@syntaxerrormmm
Created September 3, 2015 17:50
Show Gist options
  • Save syntaxerrormmm/647fb4f1793eab148205 to your computer and use it in GitHub Desktop.
Save syntaxerrormmm/647fb4f1793eab148205 to your computer and use it in GitHub Desktop.
#!/bin/bash
name=doraemon
version=1.0.0
tmpdir=/tmp/src_build/${name}-${version}
function srcbuild() {
cwd=$(pwd)
mkdir -p ${tmpdir}
cp -r initrd doraemon.py doraemon.ini doraemon.logrotate README.md LICENSE defaults/ ${tmpdir}
cd ${tmpdir}/..
tar czvf ${cwd}/${name}-${version}.tar.gz ${name}-${version}
# Cleanup
rm -rf /tmp/src_build
cd ${cwd}
}
function srcupload() {
scp ${name}-${version}.tar.gz ${name}.spec makepkg@192.168.1.1:rpmbuild/SOURCES/
}
function build() {
ssh makepkg@192.168.1.1 "cd rpmbuild/SOURCES; rpmbuild -ba ${name}.spec"
ssh makepkg@192.168.1.1 "cd rpmbuild/RPMS/noarch; rpmlint *.rpm"
ssh makepkg@192.168.1.1 "cd rpmbuild/SRPMS; rpmlint *.rpm"
echo -n "Premere un tasto per continuare oppure Ctrl+C per interrompere."
read
}
function getpkg() {
scp makepkg@192.168.1.1:rpmbuild/RPMS/noarch/* ../
scp makepkg@192.168.1.1:rpmbuild/SRPMS/* ../
}
function publishpkg() {
scp ../${name}-* rpi:/srv/http/personal/downloads/rpm/
}
function default() {
srcbuild
srcupload
build
getpkg
publishpkg
}
if [[ $# -eq 0 ]]; then
default
else
$@
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment