print some info in a debian server


this is the message you get when you do a terminal login. so if you need to edit :

sudo nano /etc/motd

Create debian package for script and simple project with cmake and cpack


if you have not a launchpad account and you want share with your friend your little project you can use cmake and cpack to create your package , you can do DEBIAN RPM and other package it’s very simple:

We will start with a simple example using one of my projects  so  download it here    kde apps

/home/stuff/kate-folder-service-menu-0.1.0
└── usr
    ├── bin
    │   └── ktexeditor-open-folder
    └── share
        └── kde4
            └── services
                └── ServiceMenus
                      └── kate-folder.desktop

so we have a bash script

ktexeditor-open-folder

and a service menu for dolphin

kate-folder.desktop

ok now create your /home/stuff/kate-folder-service-menu-0.1.0/CMakeLists.txt

    ##Cmake template for service menus

    cmake_minimum_required(VERSION 2.8)
    #SET THE NAME FOR YOUR SERVICE MENU
    PROJECT("kate-folder-servicemenu")
    SET (CMAKE_PROJECT_NAME "kate-folder-servicemenu")
    #search for the minimal version of kde 4.0
    find_package(KDE4 4.0.0 REQUIRED)

    include(KDE4Defaults)

    #install the service menu on the correct folder
    install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/usr/share/kde4/services/ServiceMenus/kate-folder.desktop DESTINATION
    ${SERVICES_INSTALL_DIR}/ServiceMenus )

     #install the script where you should be
     INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/usr/bin/ktexeditor-open-folder
      DESTINATION bin)

    SET(MAJOR_VERSION "1")
    SET(MINOR_VERSION "0")
    SET(PATCH_VERSION "0")

    IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
    INCLUDE(InstallRequiredSystemLibraries)

    SET(CPACK_SET_DESTDIR "on")
    SET(CPACK_PACKAGING_INSTALL_PREFIX "/tmp")
    SET(CPACK_GENERATOR "DEB")

    SET(CPACK_PACKAGE_DESCRIPTION "kate service menu for folders")
    SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "It's a service menu for dolphin that allow you to open folders skipping no-text files")
    SET(CPACK_PACKAGE_VENDOR "nowardev")
    SET(CPACK_PACKAGE_CONTACT "nowardev@gmail.com")
    SET(CPACK_PACKAGE_VERSION_MAJOR "${MAJOR_VERSION}")
    SET(CPACK_PACKAGE_VERSION_MINOR "${MINOR_VERSION}")
    SET(CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}")
    SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${MAJOR_VERSION}.${MINOR_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}")
    SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${MAJOR_VERSION}.${MINOR_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}")
    #demo dependencies
    #SET(CPACK_DEBIAN_PACKAGE_DEPENDS " kate , plasma-desktop, libc6 (>= 2.1.3) ")

    #dependencies for this service menu
    SET(CPACK_DEBIAN_PACKAGE_DEPENDS " kate , dolphin ")

    SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
    SET(CPACK_DEBIAN_PACKAGE_SECTION "kde")
    SET(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})

    SET(CPACK_COMPONENTS_ALL Libraries ApplicationData)
    INCLUDE(CPack)

    ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")

after that you can always do

mkdir build ; cd build ; cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .. ; cpack ..

and you will get your debian package build 🙂

How to create a debian for a dolphin service menu with a bash script and upload it on launchpad


Hi in this tutorial you will learn how to create your own debian package for a simple project like this:

first of all, here you can see the project tree:

/kate-folder-service-menu-0.1.0$ tree
/kate-folder-service-menu-0.1.0

/kate-folder-service-menu-0.1.0
└── usr
    ├── bin
    │   └── ktexeditor-open-folder
    └── share
        └── kde4
            └── services
                └── ServiceMenus
                      └── kate-folder.desktop

so we have a bash script

ktexeditor-open-folder

and a service menu for dolphin

kate-folder.desktop

first of all you need to create the folder where you have the source code with this name

kate-folder-service-menu-0.1.0

note that are ALL MINUS and note there is the version …. 0.1.0

now compress again your sources files using tar.gz and RENAME in this way MAKE SURE YOU HAVE COMPRESSED THE MAIN FOLDER  (inside the tar.gz must see this kate-folder-service-menu like main folder)

kate-folder-service-menu_0.1.0.orig.tar.gz

note the there is _0.1.0 and not -0.1.0 for the tar.gz

ok now go in the folder

cd /kate-folder-service-menu-0.1.0

and type

dh_make -s -c gpl

this will create all the stuff even too much …. REMOVE ALL .EX FILES you should get this :

debianpackagingtest/
├── kate-folder-service-menu-0.1.0
│   ├── debian
│   │   ├── changelog
│   │   ├── compat
│   │   ├── control
│   │   ├── copyright
│   │   ├── docs
│   │   ├── README.Debian -----> you can remove it 
│   │   ├── README.source -----> you can remove it 
│   │   ├── rules
│   │   └── source
│   │       └── format
│   ├── install
│   └── usr
│       ├── bin
│       │   └── ktexeditor-open-folder
│       └── share
│           └── kde4
│               └── services
│                   └── ServiceMenus
│                       └── kate-folder.desktop
└── kate-folder-service-menu_0.1.0.orig.tar.gz
        ||
     kate-folder-service-menu
     └── usr
         ├── bin
         │   └── ktexeditor-open-folder
         └── share
             └── kde4
                 └── services
                     └── ServiceMenus
                           └── kate-folder.desktop

now we need to create a file here debian/install

where we put these lines :

usr/bin/ktexeditor-open-folder
usr/share/kde4/services/ServiceMenus/kate-folder.desktop

this is the system path where the script and the service menu should be ok save and exist like install now we have

debianpackagingtest/
├── kate-folder-service-menu-0.1.0
│   ├── debian
│   │   ├── changelog
│   │   ├── compat
│   │   ├── control
│   │   ├── copyright
│   │   ├── docs
│   │   ├── install
│   │   ├── README.Debian
│   │   ├── README.source
│   │   ├── rules
│   │   └── source
│   │       └── format
│   ├── install
│   └── usr
│       ├── bin
│       │   └── ktexeditor-open-folder
│       └── share
│           └── kde4
│               └── services
│                   └── ServiceMenus
│                       └── kate-folder.desktop
└── kate-folder-service-menu_0.1.0.orig.tar.gz
        ||
     kate-folder-service-menu
     └── usr
         ├── bin
         │   └── ktexeditor-open-folder
         └── share
             └── kde4
                 └── services
                     └── ServiceMenus
                           └── kate-folder.desktop

now what we need to build it’s edit :

changelog

it’s very important edit

kate-folder-service-menu (0.1.0-1) precise; urgency=low

* Initial release

— Nowardev Peace Thu, 12 Apr 2012 11:16:18 +0200

because you will see unstable instead of precise and ubuntu doens’t allow this … expecially if you want upload on launchpad

control

file should be like this

Source: kate-folder-service-menu
Section: kde
Priority: extra
Maintainer: Nowardev Peace
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 3.9.2
Homepage: http://kde-apps.org/content/show.php/kate+folder+service+menu?content=147325
#Vcs-Git: git://git.debian.org/collab-maint/kate-folder-service-menu.git
#Vcs-Browser: http://git.debian.org/?p=collab-maint/kate-folder-service-menu.git;a=summary

Package: kate-folder-service-menu
Architecture: any
Depends: kate , dolphin
Description: kate service menu to open folders
It's a service menu for dolphin that allow you
to open folders skipping no-text files

rules should be like this :

#!/usr/bin/make -f
%:
	dh $@

copyright

well copyright it’s your stuff so…

Format: http://dep.debian.net/deps/dep5
Upstream-Name: kate-folder-service-menu
Source: http://kde-apps.org/content/show.php/kate+folder+service+menu?content=147325

Files: *
Copyright: 2012 Nowardev Peace nowardev@gmail.com

License: GPL-3.0+

Files: debian/*
Copyright: 2012 Peace nowardev@gmail.com
License: GPL-3.0+

License: GPL-3.0+
 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 3 of the License, or
 (at your option) any later version.
 .
 This package 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, see .
 .
 On Debian systems, the complete text of the GNU General
 Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".

 

now we have all done!

so give this command :

debuild -uc -us --source-option=--include-binaries --source-option=-isession 

try to build it with

sudo pbuilder build debianpackagingtest/kate-folder-service-menu-0.1.0/kate-folder-service-menu_0.1.0-1.dsc

you will find it here

debianpackagingtest/
|    ├──kate-folder-service-menu-0.1.0/
|    ├── debian
|    │   ├── changelog
|    │   ├── compat
|    │   ├── control
|    │   ├── copyright
|    │   ├── docs
|    │   ├── install
|    │   ├── README.Debian
|    │   ├── README.source
|    │   ├── rules
|    │   ├── source
|    │   │   ├── format
|    │   │   └── include-binaries
|    │   └── usr
|    │       ├── bin
|    │       │   └── ktexeditor-open-folder
|    │       └── share
|    │           └── kde4
|    │               └── services
|    │                   └── ServiceMenus
|    │                       └── kate-folder.desktop
|    └── usr
|        ├── bin
|        └── ktexeditor-open-folder
|        └── share
|            └── kde4
|                └── services
|                    └── ServiceMenus
|                        └── kate-folder.desktop
├── kate-folder-service-menu_0.1.0-1.debian.tar.gz
├── kate-folder-service-menu_0.1.0-1.dsc                    >========pbuilder file ======================
├── kate-folder-service-menu_0.1.0-1_i386.build
├── kate-folder-service-menu_0.1.0-1_i386.changes
├── kate-folder-service-menu_0.1.0-1_i386.deb
├── kate-folder-service-menu_0.1.0-1_source.build
├── kate-folder-service-menu_0.1.0-1_source.changes    >=============lauchpad file 
├── kate-folder-service-menu_0.1.0-1_source.ppa.upload
└── kate-folder-service-menu_0.1.0.orig.tar.gz

now

debuild -k17E874FB -S -sa

where -k17E874FB it’s -k your openpgp key as you can see here

finallynow you can try to upload it on lauchpad with

dput ppa:nowardev/ppa  debianpackagingtest/kate-folder-service-menu-0.1.0/kate-folder-service-menu_0.1.0-1_source.changes