Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialized project 'ebsmount' from template
- Loading branch information
0 parents
commit fd7b7b8
Showing
11 changed files
with
211 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# standard Python project Makefile | ||
progname = $(shell awk '/^Source/ {print $$2}' debian/control) | ||
name= | ||
|
||
prefix = /usr/local | ||
PATH_BIN = $(prefix)/bin | ||
PATH_INSTALL_LIB = $(prefix)/lib/$(progname) | ||
PATH_DIST := $(progname)-$(shell date +%F) | ||
|
||
all: help | ||
|
||
debug: | ||
$(foreach v, $V, $(warning $v = $($v))) | ||
@true | ||
|
||
dist: clean | ||
-mkdir -p $(PATH_DIST) | ||
|
||
-cp -a .git .gitignore $(PATH_DIST) | ||
-cp -a *.sh *.c *.py Makefile pylib/ libexec* $(PATH_DIST) | ||
|
||
tar jcvf $(PATH_DIST).tar.bz2 $(PATH_DIST) | ||
rm -rf $(PATH_DIST) | ||
|
||
### Extendable targets | ||
|
||
# target: help | ||
help: | ||
@echo '=== Targets:' | ||
@echo 'install [ prefix=path/to/usr ] # default: prefix=$(value prefix)' | ||
@echo 'uninstall [ prefix=path/to/usr ]' | ||
@echo | ||
@echo 'clean' | ||
@echo | ||
@echo 'dist # create distribution tarball' | ||
|
||
# DRY macros | ||
truepath = $(shell echo $1 | sed -e 's/^debian\/$(progname)//') | ||
libpath = $(call truepath,$(PATH_INSTALL_LIB))/$$(basename $1) | ||
subcommand = $(progname)-$$(echo $1 | sed 's|.*/||; s/^cmd_//; s/_/-/g; s/.py$$//') | ||
echo-do = echo $1; $1 | ||
|
||
# first argument: code we execute if there is just one executable module | ||
# second argument: code we execute if there is more than on executable module | ||
define with-py-executables | ||
@modules=$$(find -maxdepth 1 -type f -name '*.py' -perm -100); \ | ||
modules_len=$$(echo $$modules | wc -w); \ | ||
if [ $$modules_len = 1 ]; then \ | ||
module=$$modules; \ | ||
$(call echo-do, $1); \ | ||
elif [ $$modules_len -gt 1 ]; then \ | ||
for module in $$modules; do \ | ||
$(call echo-do, $2); \ | ||
done; \ | ||
fi; | ||
endef | ||
|
||
# target: install | ||
install: | ||
@echo | ||
@echo \*\* CONFIG: prefix = $(prefix) \*\* | ||
@echo | ||
|
||
install -d $(PATH_BIN) $(PATH_INSTALL_LIB) | ||
cp *.py $(PATH_INSTALL_LIB) | ||
|
||
$(call with-py-executables, \ | ||
ln -fs $(call libpath, $$module) $(PATH_BIN)/$(progname), \ | ||
ln -fs $(call libpath, $$module) $(PATH_BIN)/$(call subcommand, $$module)) | ||
|
||
# target: uninstall | ||
uninstall: | ||
rm -rf $(PATH_INSTALL_LIB) | ||
|
||
$(call with-py-executables, \ | ||
rm -f $(PATH_BIN)/$(progname), \ | ||
rm -f $(PATH_BIN)/$(call subcommand, $$module)) | ||
|
||
# target: clean | ||
clean: | ||
rm -f *.pyc *.pyo _$(progname) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
changelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Source: ebsmount | ||
Section: misc | ||
Priority: optional | ||
Maintainer: Alon Swartz <alon@sterilesecurity.com> | ||
Build-Depends: debhelper (>> 4.2.0) | ||
Standards-Version: 3.6.1 | ||
|
||
Package: ebsmount | ||
Architecture: all | ||
Depends: python (>= 2.4) | ||
Section: misc | ||
Description: Example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Author: Liraz Siri <liraz@turnkeylinux.org> | ||
|
||
License: | ||
|
||
Copyright (C) 2010 Liraz Siri <liraz@turnkeylinux.org> | ||
|
||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
|
||
On Debian and Ubuntu systems, the complete text of the GNU General Public | ||
License can be found in /usr/share/common-licenses/GPL file. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
|
||
#DEBHELPER# | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
|
||
#DEBHELPER# | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#! /usr/bin/make -f | ||
|
||
progname=$(shell awk '/^Source/ {print $$2}' debian/control) | ||
buildroot=debian/$(progname) | ||
prefix=$(buildroot)/usr | ||
|
||
clean: | ||
dh_clean | ||
|
||
build: | ||
mkdir -p $(prefix) | ||
|
||
install: | ||
dh_testroot | ||
dh_clean -k | ||
dh_testdir | ||
dh_installdirs | ||
dh_install | ||
$(MAKE) install prefix=$(prefix) | ||
|
||
binary-indep: install | ||
dh_testdir | ||
dh_testroot | ||
dh_installdocs | ||
dh_installdeb | ||
dh_gencontrol | ||
dh_md5sums | ||
dh_builddeb | ||
|
||
binary-arch: install | ||
|
||
binary: binary-indep binary-arch | ||
.PHONY: clean binary-indep binary-arch binary install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/python | ||
"""Example command template | ||
Options: | ||
-q --quiet don't print anything | ||
-f=FOO print FOO | ||
--fatal fatal error | ||
""" | ||
import sys | ||
import getopt | ||
|
||
def usage(e=None): | ||
if e: | ||
print >> sys.stderr, "error: " + str(e) | ||
|
||
print >> sys.stderr, "Syntax: %s [args]" % sys.argv[0] | ||
print >> sys.stderr, __doc__.strip() | ||
sys.exit(1) | ||
|
||
def fatal(s): | ||
print >> sys.stderr, "error: " + str(s) | ||
sys.exit(1) | ||
|
||
def main(): | ||
try: | ||
opts, args = getopt.gnu_getopt(sys.argv[1:], 'qf:h', ['fatal']) | ||
except getopt.GetoptError, e: | ||
usage(e) | ||
|
||
opt_quiet = False | ||
for opt, val in opts: | ||
if opt == '-h': | ||
usage() | ||
|
||
if opt in ('-q', '--quiet'): | ||
opt_quiet = True | ||
|
||
elif opt == '-f': | ||
print "printing foo: " + val | ||
|
||
elif opt == '--fatal': | ||
fatal("fatal condition") | ||
|
||
if not opt_quiet: | ||
print "printing args: " + `args` | ||
|
||
|
||
if __name__=="__main__": | ||
main() | ||
|