From ed1837534a0a9a1ab8f8291cff73be031a5d493b Mon Sep 17 00:00:00 2001 From: Kamal Wickramanayake Date: Sat, 23 May 2026 14:50:05 +0530 Subject: Dir rename --- linux/deb/01-fs-hello-kamal/.gitignore | 1 + linux/deb/01-fs-hello-kamal/README | 21 ++++++++++++++++ linux/deb/01-fs-hello-kamal/build.sh | 29 ++++++++++++++++++++++ .../deb/01-fs-hello-kamal/package/DEBIAN/conffiles | 1 + linux/deb/01-fs-hello-kamal/package/DEBIAN/control | 8 ++++++ .../deb/01-fs-hello-kamal/package/DEBIAN/postinst | 10 ++++++++ linux/deb/01-fs-hello-kamal/package/DEBIAN/preinst | 8 ++++++ .../package/etc/fs-hello-kamal.conf | 3 +++ .../package/usr/bin/fs-hello-kamal | 16 ++++++++++++ linux/deb/fs-hello-kamal/.gitignore | 1 - linux/deb/fs-hello-kamal/README | 21 ---------------- linux/deb/fs-hello-kamal/build.sh | 29 ---------------------- linux/deb/fs-hello-kamal/package/DEBIAN/conffiles | 1 - linux/deb/fs-hello-kamal/package/DEBIAN/control | 8 ------ linux/deb/fs-hello-kamal/package/DEBIAN/postinst | 10 -------- linux/deb/fs-hello-kamal/package/DEBIAN/preinst | 8 ------ .../fs-hello-kamal/package/etc/fs-hello-kamal.conf | 3 --- .../fs-hello-kamal/package/usr/bin/fs-hello-kamal | 16 ------------ 18 files changed, 97 insertions(+), 97 deletions(-) create mode 100644 linux/deb/01-fs-hello-kamal/.gitignore create mode 100644 linux/deb/01-fs-hello-kamal/README create mode 100755 linux/deb/01-fs-hello-kamal/build.sh create mode 100644 linux/deb/01-fs-hello-kamal/package/DEBIAN/conffiles create mode 100644 linux/deb/01-fs-hello-kamal/package/DEBIAN/control create mode 100755 linux/deb/01-fs-hello-kamal/package/DEBIAN/postinst create mode 100755 linux/deb/01-fs-hello-kamal/package/DEBIAN/preinst create mode 100644 linux/deb/01-fs-hello-kamal/package/etc/fs-hello-kamal.conf create mode 100755 linux/deb/01-fs-hello-kamal/package/usr/bin/fs-hello-kamal delete mode 100644 linux/deb/fs-hello-kamal/.gitignore delete mode 100644 linux/deb/fs-hello-kamal/README delete mode 100755 linux/deb/fs-hello-kamal/build.sh delete mode 100644 linux/deb/fs-hello-kamal/package/DEBIAN/conffiles delete mode 100644 linux/deb/fs-hello-kamal/package/DEBIAN/control delete mode 100755 linux/deb/fs-hello-kamal/package/DEBIAN/postinst delete mode 100755 linux/deb/fs-hello-kamal/package/DEBIAN/preinst delete mode 100644 linux/deb/fs-hello-kamal/package/etc/fs-hello-kamal.conf delete mode 100755 linux/deb/fs-hello-kamal/package/usr/bin/fs-hello-kamal (limited to 'linux/deb') diff --git a/linux/deb/01-fs-hello-kamal/.gitignore b/linux/deb/01-fs-hello-kamal/.gitignore new file mode 100644 index 0000000..c00df13 --- /dev/null +++ b/linux/deb/01-fs-hello-kamal/.gitignore @@ -0,0 +1 @@ +*.deb diff --git a/linux/deb/01-fs-hello-kamal/README b/linux/deb/01-fs-hello-kamal/README new file mode 100644 index 0000000..114632c --- /dev/null +++ b/linux/deb/01-fs-hello-kamal/README @@ -0,0 +1,21 @@ +This directory contains everything to build a simple deb package. + +To build, run the following command: + + ./build.sh + +To install the build deb package run the following commands replacing the package.deb with the correct name of the deb file. + + cp package.deb /tmp + cd /tmp + apt install ./package.deb + +The above "apt install" will download dependencies if needed. Otherwise, dpkg command can just be used to install or upgrade the package: + + dpkg -i package.deb + +After installing the package, update the configuration file /etc/fs-hello-kamal.conf . + +To run the command found in this package after installing the deb file: + + fs-hello-kamal Debian is good diff --git a/linux/deb/01-fs-hello-kamal/build.sh b/linux/deb/01-fs-hello-kamal/build.sh new file mode 100755 index 0000000..bc77f92 --- /dev/null +++ b/linux/deb/01-fs-hello-kamal/build.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Define a function that sends messages to stderr. +errcho() { + echo "$@" 1>&2; +} + +# Check if fakeroot command is available +if ! command -v fakeroot > /dev/null 2>&1; then + errcho "[ERROR] fakeroot command not found. Install the fakeroot package."; + exit 1 +fi + +# Check if dpkg-deb command is available +if ! command -v dpkg-deb > /dev/null 2>&1; then + errcho "[ERROR] dpkg-deb command not found. dpkg package contains it. Are you not running this script on a Debian based system?"; + exit 1 +fi + +# Get the directory of this script +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Remove the deb files found inside DIR. Prompt the user before deleting. +if ls $DIR/*.deb 1> /dev/null 2>&1; then + rm -i $DIR/*.deb +fi + +# Build the deb package +fakeroot dpkg-deb --build $DIR/package $DIR diff --git a/linux/deb/01-fs-hello-kamal/package/DEBIAN/conffiles b/linux/deb/01-fs-hello-kamal/package/DEBIAN/conffiles new file mode 100644 index 0000000..c350b0c --- /dev/null +++ b/linux/deb/01-fs-hello-kamal/package/DEBIAN/conffiles @@ -0,0 +1 @@ +/etc/fs-hello-kamal.conf diff --git a/linux/deb/01-fs-hello-kamal/package/DEBIAN/control b/linux/deb/01-fs-hello-kamal/package/DEBIAN/control new file mode 100644 index 0000000..82f25db --- /dev/null +++ b/linux/deb/01-fs-hello-kamal/package/DEBIAN/control @@ -0,0 +1,8 @@ +Package: fs-hello-kamal +Version: 1.0.0-1 +Section: games +Priority: optional +Architecture: all +Depends: cowsay +Maintainer: Kamal Wickramanayake +Description: A demo Debian package that prints a message to the console. diff --git a/linux/deb/01-fs-hello-kamal/package/DEBIAN/postinst b/linux/deb/01-fs-hello-kamal/package/DEBIAN/postinst new file mode 100755 index 0000000..978306d --- /dev/null +++ b/linux/deb/01-fs-hello-kamal/package/DEBIAN/postinst @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +if [ "$1" == "configure" ] && [ -z "$2" ]; then + # Code here executes only during package install (but not during upgrade) + echo "postinst script is running and this line gets printed during first install of the package" +fi + +echo "postinst script is running and this line gets printed during install or upgrade of the package." diff --git a/linux/deb/01-fs-hello-kamal/package/DEBIAN/preinst b/linux/deb/01-fs-hello-kamal/package/DEBIAN/preinst new file mode 100755 index 0000000..61c2587 --- /dev/null +++ b/linux/deb/01-fs-hello-kamal/package/DEBIAN/preinst @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +# Put commands that should execute before the pckage is installed. + +# Example: Just print a message +echo "preinst script running..." diff --git a/linux/deb/01-fs-hello-kamal/package/etc/fs-hello-kamal.conf b/linux/deb/01-fs-hello-kamal/package/etc/fs-hello-kamal.conf new file mode 100644 index 0000000..ddba856 --- /dev/null +++ b/linux/deb/01-fs-hello-kamal/package/etc/fs-hello-kamal.conf @@ -0,0 +1,3 @@ +# This is a sample configuration file. + +PREFIX_NAME="Kamal" diff --git a/linux/deb/01-fs-hello-kamal/package/usr/bin/fs-hello-kamal b/linux/deb/01-fs-hello-kamal/package/usr/bin/fs-hello-kamal new file mode 100755 index 0000000..b8c827c --- /dev/null +++ b/linux/deb/01-fs-hello-kamal/package/usr/bin/fs-hello-kamal @@ -0,0 +1,16 @@ +#!/bin/bash + +# Define a function that sends messages to stderr. +errcho() { + echo "$@" 1>&2; +} + +# Source the configuration file. +. /etc/fs-hello-kamal.conf + +if [ "$1" = "" ]; then + errcho "Error! Provide some arguments to the command." + exit 1 +fi + +/usr/games/cowsay "$PREFIX_NAME's friend cow says $@" diff --git a/linux/deb/fs-hello-kamal/.gitignore b/linux/deb/fs-hello-kamal/.gitignore deleted file mode 100644 index c00df13..0000000 --- a/linux/deb/fs-hello-kamal/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.deb diff --git a/linux/deb/fs-hello-kamal/README b/linux/deb/fs-hello-kamal/README deleted file mode 100644 index 114632c..0000000 --- a/linux/deb/fs-hello-kamal/README +++ /dev/null @@ -1,21 +0,0 @@ -This directory contains everything to build a simple deb package. - -To build, run the following command: - - ./build.sh - -To install the build deb package run the following commands replacing the package.deb with the correct name of the deb file. - - cp package.deb /tmp - cd /tmp - apt install ./package.deb - -The above "apt install" will download dependencies if needed. Otherwise, dpkg command can just be used to install or upgrade the package: - - dpkg -i package.deb - -After installing the package, update the configuration file /etc/fs-hello-kamal.conf . - -To run the command found in this package after installing the deb file: - - fs-hello-kamal Debian is good diff --git a/linux/deb/fs-hello-kamal/build.sh b/linux/deb/fs-hello-kamal/build.sh deleted file mode 100755 index bc77f92..0000000 --- a/linux/deb/fs-hello-kamal/build.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# Define a function that sends messages to stderr. -errcho() { - echo "$@" 1>&2; -} - -# Check if fakeroot command is available -if ! command -v fakeroot > /dev/null 2>&1; then - errcho "[ERROR] fakeroot command not found. Install the fakeroot package."; - exit 1 -fi - -# Check if dpkg-deb command is available -if ! command -v dpkg-deb > /dev/null 2>&1; then - errcho "[ERROR] dpkg-deb command not found. dpkg package contains it. Are you not running this script on a Debian based system?"; - exit 1 -fi - -# Get the directory of this script -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -# Remove the deb files found inside DIR. Prompt the user before deleting. -if ls $DIR/*.deb 1> /dev/null 2>&1; then - rm -i $DIR/*.deb -fi - -# Build the deb package -fakeroot dpkg-deb --build $DIR/package $DIR diff --git a/linux/deb/fs-hello-kamal/package/DEBIAN/conffiles b/linux/deb/fs-hello-kamal/package/DEBIAN/conffiles deleted file mode 100644 index c350b0c..0000000 --- a/linux/deb/fs-hello-kamal/package/DEBIAN/conffiles +++ /dev/null @@ -1 +0,0 @@ -/etc/fs-hello-kamal.conf diff --git a/linux/deb/fs-hello-kamal/package/DEBIAN/control b/linux/deb/fs-hello-kamal/package/DEBIAN/control deleted file mode 100644 index 82f25db..0000000 --- a/linux/deb/fs-hello-kamal/package/DEBIAN/control +++ /dev/null @@ -1,8 +0,0 @@ -Package: fs-hello-kamal -Version: 1.0.0-1 -Section: games -Priority: optional -Architecture: all -Depends: cowsay -Maintainer: Kamal Wickramanayake -Description: A demo Debian package that prints a message to the console. diff --git a/linux/deb/fs-hello-kamal/package/DEBIAN/postinst b/linux/deb/fs-hello-kamal/package/DEBIAN/postinst deleted file mode 100755 index 978306d..0000000 --- a/linux/deb/fs-hello-kamal/package/DEBIAN/postinst +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -set -e - -if [ "$1" == "configure" ] && [ -z "$2" ]; then - # Code here executes only during package install (but not during upgrade) - echo "postinst script is running and this line gets printed during first install of the package" -fi - -echo "postinst script is running and this line gets printed during install or upgrade of the package." diff --git a/linux/deb/fs-hello-kamal/package/DEBIAN/preinst b/linux/deb/fs-hello-kamal/package/DEBIAN/preinst deleted file mode 100755 index 61c2587..0000000 --- a/linux/deb/fs-hello-kamal/package/DEBIAN/preinst +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -e - -# Put commands that should execute before the pckage is installed. - -# Example: Just print a message -echo "preinst script running..." diff --git a/linux/deb/fs-hello-kamal/package/etc/fs-hello-kamal.conf b/linux/deb/fs-hello-kamal/package/etc/fs-hello-kamal.conf deleted file mode 100644 index ddba856..0000000 --- a/linux/deb/fs-hello-kamal/package/etc/fs-hello-kamal.conf +++ /dev/null @@ -1,3 +0,0 @@ -# This is a sample configuration file. - -PREFIX_NAME="Kamal" diff --git a/linux/deb/fs-hello-kamal/package/usr/bin/fs-hello-kamal b/linux/deb/fs-hello-kamal/package/usr/bin/fs-hello-kamal deleted file mode 100755 index b8c827c..0000000 --- a/linux/deb/fs-hello-kamal/package/usr/bin/fs-hello-kamal +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# Define a function that sends messages to stderr. -errcho() { - echo "$@" 1>&2; -} - -# Source the configuration file. -. /etc/fs-hello-kamal.conf - -if [ "$1" = "" ]; then - errcho "Error! Provide some arguments to the command." - exit 1 -fi - -/usr/games/cowsay "$PREFIX_NAME's friend cow says $@" -- cgit v1.2.3