Skip to content

Commit

Permalink
Debian package build for the first time.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz bla Fortuna committed Oct 26, 2013
1 parent cec0bff commit e8df62f
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 36 deletions.
14 changes: 8 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ ENDIF (NLS)
# PAM
FIND_PATH(PAM_INCLUDE_DIR pam_modules.h /usr/include/security /usr/include/pam)
INCLUDE_DIRECTORIES(${PAM_INCLUDE_DIR})
FIND_PATH(PAM_MODULE_DIR pam_unix.so /lib/security /usr/lib/security /lib /usr/lib)
#FIND_PATH(PAM_MODULE_DIR pam_unix.so /lib/security /usr/lib/security /lib /usr/lib)
SET(PAM_MODULE_DIR /lib/security)

# Intl: On FreeBSD gettext is in another library
# Also we install PAM modules in /usr/lib.
Expand Down Expand Up @@ -166,18 +167,19 @@ SET(man_src "${man_src_1}" "${man_src_1a}" "${man_src_5}" "${man_src_8}")
# Install target
##
SET(CMAKE_INSTALL_PREFIX /usr)
#SET(CMAKE_INSTALL_PREFIX /home/bla/_projects/_otp/otpasswd/prefix/usr)
INSTALL(TARGETS pam_otpasswd otpasswd agent_otp
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${PAM_MODULE_DIR})

INSTALL(FILES examples/otpasswd-login DESTINATION /etc/pam.d)
INSTALL(FILES examples/otpasswd.conf DESTINATION /etc/otpasswd)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pl.gmo DESTINATION /usr/share/otpasswd)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pl.gmo DESTINATION usr/share/otpasswd)

INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${man_src_1} DESTINATION "share/man/man1")
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${man_src_1a} DESTINATION "share/man/man1")
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${man_src_5} DESTINATION "share/man/man5")
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${man_src_8} DESTINATION "share/man/man8")
INSTALL(FILES ${man_src_1} DESTINATION "share/man/man1")
INSTALL(FILES ${man_src_1a} DESTINATION "share/man/man1")
INSTALL(FILES ${man_src_5} DESTINATION "share/man/man5")
INSTALL(FILES ${man_src_8} DESTINATION "share/man/man8")


##
Expand Down
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Trying to sort tasks according to their priority.
* [-] Update Polish translation
* [-] Relicense so it can be used more universally - will require changing of sha256
implementation, but it would be best to use system openssl lib probably.
* [-] Check how SUID version works. It should su to root, read config drop to nobody.
No dedicated user! As the binary can then be modified and affect root more easily.

2010-03-31 0.7_rc2
Done:
Expand Down
47 changes: 47 additions & 0 deletions tools/debian_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# Call from outside of project directory: ./otpasswd/tools/<SCRIPT> <VERSION>
# Assuming otpasswd is inside $DEVDIR directory.
# Call AFTER calling package.sh

DEVDIR=otpasswd

if [ -z "$1" ]; then
echo "Pass version as a first argument"
exit 1
fi

VERSION=$1
PACKAGE="otpasswd-$VERSION"
TARBALL="otpasswd_$VERSION".tar.xz
ORIG_TARBALL="otpasswd_$VERSION".orig.tar.xz

if [ ! -f $TBZ2 ]; then
echo "Call package.sh first and get back here"
exit 1
fi


echo '* CLEANUP'
rm -rf debian_packaging

echo '* CREATE STRUCTURE'
mkdir debian_packaging
cp $TARBALL "debian_packaging/"$ORIG_TARBALL


echo '* UNPACK'
pushd debian_packaging
tar -Jxf $ORIG_TARBALL
popd

echo
echo '* MOVE DEBIAN FILES'
cp otpasswd/tools/debian_pkg_template debian_packaging/$PACKAGE/debian -Rv

echo
echo '* BUILD PACKAGE'
pushd debian_packaging/$PACKAGE
dpkg-buildpackage -kD59B22FE
popd

2 changes: 1 addition & 1 deletion tools/debian_pkg_template/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ otpasswd (0.8) experimental; urgency=low
* This is a package suitable for tests on non-critical systems.
* Updated package (Closes: #562968)

-- Tomasz bla Fortuna (bla@thera.be) Sat 26 Oct 14:20:55 CEST 2013
-- Tomasz bla Fortuna <bla@thera.be> Sat, 26 Oct 2013 14:20:55 +0200

otpasswd (0.4-0local1) experimental; urgency=low

Expand Down
2 changes: 1 addition & 1 deletion tools/debian_pkg_template/compat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9
8
2 changes: 1 addition & 1 deletion tools/debian_pkg_template/control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Source: otpasswd
Section: admin
Priority: extra
Priority: optional
Maintainer: Tomasz bla Fortuna <bla@thera.be>
Build-Depends: cdbs, debhelper (>= 7), cmake, libpam0g-dev
Standards-Version: 3.8.3
Expand Down
1 change: 1 addition & 0 deletions tools/debian_pkg_template/dirs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib/security
6 changes: 3 additions & 3 deletions tools/debian_pkg_template/otpasswd-bin.docs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
docs/README
docs/INSTALL
docs/ChangeLog
README
INSTALL
ChangeLog
docs/SECURITY
37 changes: 20 additions & 17 deletions tools/debian_pkg_template/rules
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,36 @@

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/cmake.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk

export DH_VERBOSE=1

# Add here any variable or target overrides you need.
.PHONY: get-orig-source
#.PHONY: get-orig-source


# Rules for fetching the upstream tarball
CURRENT_TREEISH =$(shell dpkg-parsechangelog | sed -rne 's,^Version: .*git([^-]+).*,\1,p')
CURVER=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p')
#CURRENT_TREEISH =$(shell dpkg-parsechangelog | sed -rne 's,^Version: .*git([^-]+).*,\1,p')
#CURVER=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p')

SOURCE_DIR=otpasswd-$(CURVER)
TARBALL=otpasswd_$(CURVER).orig.tar.gz
#SOURCE_DIR=otpasswd-$(CURVER)
#TARBALL=otpasswd_$(CURVER).orig.tar.gz

#%:
# dh $@

$(SOURCE_DIR): https://github.com/blaa/OTPasswd.git
git clone https://github.com/blaa/OTPasswd.git $(SOURCE_DIR)
if [ x$(CURRENT_TREEISH) = x ]; then \
cd $(SOURCE_DIR) && git checkout v$(CURVER); \
else \
cd $(SOURCE_DIR) && git checkout $(CURRENT_TREEISH); \
fi

#$(SOURCE_DIR): https://github.com/blaa/OTPasswd.git
# git clone https://github.com/blaa/OTPasswd.git $(SOURCE_DIR)
# if [ x$(CURRENT_TREEISH) = x ]; then \
# cd $(SOURCE_DIR) && git checkout v$(CURVER); \
# else \
# cd $(SOURCE_DIR) && git checkout $(CURRENT_TREEISH); \
# fi

$(TARBALL): $(SOURCE_DIR)
tar czvf $(TARBALL) $(SOURCE_DIR)

get-orig-source: $(TARBALL)
rm -rf $(SOURCE_DIR) $(SOURCE_DIR).temp
#$(TARBALL): $(SOURCE_DIR)
# tar czvf $(TARBALL) $(SOURCE_DIR)

#get-orig-source: $(TARBALL)
# rm -rf $(SOURCE_DIR) $(SOURCE_DIR).temp

18 changes: 11 additions & 7 deletions tools/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ if [ -z "$1" ]; then
fi

VERSION=$1
PACKAGE="otpasswd_$VERSION"
PACKAGE="otpasswd-$VERSION"
TARBALL="otpasswd_$VERSION".tar.xz

# FUNCTIONS
test_build () {
Expand Down Expand Up @@ -68,12 +69,13 @@ create_tree () {
pushd $PACKAGE
rm -rf .git .gitignore tools/.gitignore
rm -rf .emacs*
rm -rf tools/debian_pkg_template

echo "YOU MIGHT WANT TO MANUALLY REMOVE THOSE:"
find . -type f -iname '.*'
find . -iname '*~*'
find . -iname '*#*'

echo "END OF LIST"
popd
}

Expand All @@ -83,18 +85,20 @@ sleep 1
pushd $DEVDIR

check_versions;
test_build;
if [ "$SKIPBUILD" != "1" ]; then
test_build;
fi


popd

create_tree;

TBZ2="$PACKAGE".tar.bz2
tar -jcf $TBZ2 $PACKAGE || exit 1
tar -Jcf $TARBALL $PACKAGE || exit 1

echo
ls -l $TBZ2
sha256sum $TBZ2
ls -l $TARBALL
sha256sum $TARBALL

echo
echo "Remember to TAG in git and sign the tarball."
Expand Down

0 comments on commit e8df62f

Please sign in to comment.