Score:2

How to create your own Linux package from scratch?

ua flag

How do you create your own package in Linux, just like cd, ls, or any third party package?

All I know is how to create a .sh file, write a script in it and execute it using:

bash file_name

But in addition to that I want to understand in more depth. Please explain the complete steps from downloading using apt-get to how to run it.

sudodus avatar
jp flag
The easy part is to create the application, the tool. The difficult part is to get it accepted as a linux package (as part of an officially supported repository). A simpler alternative for Ubuntu is to upload it to a PPA at Launchpad or provide the tool in some [other] kind of container via for example GitHub.
C.S.Cameron avatar
cn flag
This link might be a good starting point for what you want: https://askubuntu.com/questions/1300540/how-to-duplicate-a-ubuntu-system-for-distribution
hr flag
Please unlearn the *"create a .sh file and write your script in it and execute it using "bash file_name"* paradigm - script files should use an appropriate [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) to indicate which interpreter should run them, rather than having the user specify an interpreter on the command line.
Score:7
us flag

I am assuming you want to write a new program and distribute it as a Debian package in Ubuntu.

Suppose you have the bash script, hello, and you have marked it as executable

#!/bin/bash
echo "Hello World"
  1. Now create a Debian package which will place this hello file in /usr/bin. The linked answer is about a single python script, but it works the same way with a bash script. Once installed, it can be run from the terminal with:

    username@computer~$ hello
    
  2. Upload the Debian source to a Launchpad PPA, so that users can add it to their system, and subsequently download it with apt.

  3. You can later submit it to Debian's repositories, so that it can be directly installed in Ubuntu and other derivatives of Debian (although I don't know if Debian maintainers allow simple bash scripts to be added to their repositories. But you can put any program in your own Launchpad PPA).

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.