Creating a terminal application from a shell script
up vote
2
down vote
favorite
I have a shell script. I want to convert the shell script to an application for Ubuntu which can be installed using (sudo apt-get install)
command and after installing, the application can run from the terminal by typing the name of the application.
shell ubuntu
add a comment |
up vote
2
down vote
favorite
I have a shell script. I want to convert the shell script to an application for Ubuntu which can be installed using (sudo apt-get install)
command and after installing, the application can run from the terminal by typing the name of the application.
shell ubuntu
4
Depending on what you're doing, either developer.ubuntu.com or debian.org/doc/manuals/developers-reference (yes, that's a Debian link, I don't believe Ubuntu has its own version, you can skim over a lot of sections about internal Debian stuff).
– derobert
Apr 4 '13 at 17:17
Just to make sure, is your intention to package your script just to be able to run it "from the terminal by typing the name"?
– Adrian Frühwirth
Apr 6 '13 at 18:07
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I have a shell script. I want to convert the shell script to an application for Ubuntu which can be installed using (sudo apt-get install)
command and after installing, the application can run from the terminal by typing the name of the application.
shell ubuntu
I have a shell script. I want to convert the shell script to an application for Ubuntu which can be installed using (sudo apt-get install)
command and after installing, the application can run from the terminal by typing the name of the application.
shell ubuntu
shell ubuntu
edited Nov 25 at 22:49
Rui F Ribeiro
38.3k1477127
38.3k1477127
asked Apr 4 '13 at 17:07
rohangulati
111
111
4
Depending on what you're doing, either developer.ubuntu.com or debian.org/doc/manuals/developers-reference (yes, that's a Debian link, I don't believe Ubuntu has its own version, you can skim over a lot of sections about internal Debian stuff).
– derobert
Apr 4 '13 at 17:17
Just to make sure, is your intention to package your script just to be able to run it "from the terminal by typing the name"?
– Adrian Frühwirth
Apr 6 '13 at 18:07
add a comment |
4
Depending on what you're doing, either developer.ubuntu.com or debian.org/doc/manuals/developers-reference (yes, that's a Debian link, I don't believe Ubuntu has its own version, you can skim over a lot of sections about internal Debian stuff).
– derobert
Apr 4 '13 at 17:17
Just to make sure, is your intention to package your script just to be able to run it "from the terminal by typing the name"?
– Adrian Frühwirth
Apr 6 '13 at 18:07
4
4
Depending on what you're doing, either developer.ubuntu.com or debian.org/doc/manuals/developers-reference (yes, that's a Debian link, I don't believe Ubuntu has its own version, you can skim over a lot of sections about internal Debian stuff).
– derobert
Apr 4 '13 at 17:17
Depending on what you're doing, either developer.ubuntu.com or debian.org/doc/manuals/developers-reference (yes, that's a Debian link, I don't believe Ubuntu has its own version, you can skim over a lot of sections about internal Debian stuff).
– derobert
Apr 4 '13 at 17:17
Just to make sure, is your intention to package your script just to be able to run it "from the terminal by typing the name"?
– Adrian Frühwirth
Apr 6 '13 at 18:07
Just to make sure, is your intention to package your script just to be able to run it "from the terminal by typing the name"?
– Adrian Frühwirth
Apr 6 '13 at 18:07
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
Packaging a binary or script is very simple. In the most trivial case, you need a .deb
package which contains a copy of your binary in usr/bin/yourbinary
. However, there are a number of things you should take care of if you want others to find it usable.
In concrete terms, have a look at the package dh-make, which contains all the infrastructure you need to create a well-behaved Debian package.
When you run dh_make -s -n
in the directory where you develop your script, you get to fill in some details, such as a package description and your name and email address. The tool will create a debian/
directory with some template files which you should either modify or remove. (The ones with *.ex
names are probably all good to remove.)
(dh_make
is particular about the directory name; it will print an error message directing you to use dh_make -s -n -p yourpackage_0.01
to proceed without renaming the directory.)
- The package should have a useful name and a description. This is in the
debian/control
file. This is also where you can make it depend on other packages, or even particular versions of other packages. - There needs to be a modicum of documentation; the files
debian/README
anddebian/changelog
should be updated to contain more than just the boilerplate. If you have notes for the package itself, you might want to put them indebian/README.Debian
; otherwise, delete this file. Similar fordebian/README.source
, i.e. notes for somebody downloading the package's sources withapt-get source yourpackage
. These files will end up in/usr/share/doc/yourpackage
when you installyourpackage
. If you want to put other files there, add their names to the (now empty) text filedebian/docs
. Otherwise, you can delete this file, too. - Review
debian/copyright
and update it if necessary. This too will end up in/usr/share/doc/yourpackage
.
There is a wealth of material about Debian packaging and dh-make
all over the Internet; this answer is obviously very brief and summaric. For a really proper package, you need to read and understand all of the Debian Policy.
For a single script, you might also look atequivs
, which however is more oriented towards creating an empty meta-package which pulls in other packages as dependencies. It does have a facility for including arbitrary files in the package as well, though. The instructions are less oriented towards actually packaging something, but once you understand the basics ofdh_make
you might want to use just a single source file for the entire package, whichequivs
does for you (it basically offers a superset of thedebian/control
file for controlling the entire package).
– tripleee
Jun 6 '13 at 8:12
To publish the package so thatapt-get
finds it, you need to set up a repo, and add the repo's URL to a file in/etc/apt/sources.list.d
; some package managers also provide a GUI for this. If a public repo is acceptable, Launchpad offers to host a PPA for you, but setting up a private repo isn't too hard, either; you basically need to rundpkg-scanpackages
to generate thePackages
file.
– tripleee
Jul 10 '13 at 5:37
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Packaging a binary or script is very simple. In the most trivial case, you need a .deb
package which contains a copy of your binary in usr/bin/yourbinary
. However, there are a number of things you should take care of if you want others to find it usable.
In concrete terms, have a look at the package dh-make, which contains all the infrastructure you need to create a well-behaved Debian package.
When you run dh_make -s -n
in the directory where you develop your script, you get to fill in some details, such as a package description and your name and email address. The tool will create a debian/
directory with some template files which you should either modify or remove. (The ones with *.ex
names are probably all good to remove.)
(dh_make
is particular about the directory name; it will print an error message directing you to use dh_make -s -n -p yourpackage_0.01
to proceed without renaming the directory.)
- The package should have a useful name and a description. This is in the
debian/control
file. This is also where you can make it depend on other packages, or even particular versions of other packages. - There needs to be a modicum of documentation; the files
debian/README
anddebian/changelog
should be updated to contain more than just the boilerplate. If you have notes for the package itself, you might want to put them indebian/README.Debian
; otherwise, delete this file. Similar fordebian/README.source
, i.e. notes for somebody downloading the package's sources withapt-get source yourpackage
. These files will end up in/usr/share/doc/yourpackage
when you installyourpackage
. If you want to put other files there, add their names to the (now empty) text filedebian/docs
. Otherwise, you can delete this file, too. - Review
debian/copyright
and update it if necessary. This too will end up in/usr/share/doc/yourpackage
.
There is a wealth of material about Debian packaging and dh-make
all over the Internet; this answer is obviously very brief and summaric. For a really proper package, you need to read and understand all of the Debian Policy.
For a single script, you might also look atequivs
, which however is more oriented towards creating an empty meta-package which pulls in other packages as dependencies. It does have a facility for including arbitrary files in the package as well, though. The instructions are less oriented towards actually packaging something, but once you understand the basics ofdh_make
you might want to use just a single source file for the entire package, whichequivs
does for you (it basically offers a superset of thedebian/control
file for controlling the entire package).
– tripleee
Jun 6 '13 at 8:12
To publish the package so thatapt-get
finds it, you need to set up a repo, and add the repo's URL to a file in/etc/apt/sources.list.d
; some package managers also provide a GUI for this. If a public repo is acceptable, Launchpad offers to host a PPA for you, but setting up a private repo isn't too hard, either; you basically need to rundpkg-scanpackages
to generate thePackages
file.
– tripleee
Jul 10 '13 at 5:37
add a comment |
up vote
1
down vote
Packaging a binary or script is very simple. In the most trivial case, you need a .deb
package which contains a copy of your binary in usr/bin/yourbinary
. However, there are a number of things you should take care of if you want others to find it usable.
In concrete terms, have a look at the package dh-make, which contains all the infrastructure you need to create a well-behaved Debian package.
When you run dh_make -s -n
in the directory where you develop your script, you get to fill in some details, such as a package description and your name and email address. The tool will create a debian/
directory with some template files which you should either modify or remove. (The ones with *.ex
names are probably all good to remove.)
(dh_make
is particular about the directory name; it will print an error message directing you to use dh_make -s -n -p yourpackage_0.01
to proceed without renaming the directory.)
- The package should have a useful name and a description. This is in the
debian/control
file. This is also where you can make it depend on other packages, or even particular versions of other packages. - There needs to be a modicum of documentation; the files
debian/README
anddebian/changelog
should be updated to contain more than just the boilerplate. If you have notes for the package itself, you might want to put them indebian/README.Debian
; otherwise, delete this file. Similar fordebian/README.source
, i.e. notes for somebody downloading the package's sources withapt-get source yourpackage
. These files will end up in/usr/share/doc/yourpackage
when you installyourpackage
. If you want to put other files there, add their names to the (now empty) text filedebian/docs
. Otherwise, you can delete this file, too. - Review
debian/copyright
and update it if necessary. This too will end up in/usr/share/doc/yourpackage
.
There is a wealth of material about Debian packaging and dh-make
all over the Internet; this answer is obviously very brief and summaric. For a really proper package, you need to read and understand all of the Debian Policy.
For a single script, you might also look atequivs
, which however is more oriented towards creating an empty meta-package which pulls in other packages as dependencies. It does have a facility for including arbitrary files in the package as well, though. The instructions are less oriented towards actually packaging something, but once you understand the basics ofdh_make
you might want to use just a single source file for the entire package, whichequivs
does for you (it basically offers a superset of thedebian/control
file for controlling the entire package).
– tripleee
Jun 6 '13 at 8:12
To publish the package so thatapt-get
finds it, you need to set up a repo, and add the repo's URL to a file in/etc/apt/sources.list.d
; some package managers also provide a GUI for this. If a public repo is acceptable, Launchpad offers to host a PPA for you, but setting up a private repo isn't too hard, either; you basically need to rundpkg-scanpackages
to generate thePackages
file.
– tripleee
Jul 10 '13 at 5:37
add a comment |
up vote
1
down vote
up vote
1
down vote
Packaging a binary or script is very simple. In the most trivial case, you need a .deb
package which contains a copy of your binary in usr/bin/yourbinary
. However, there are a number of things you should take care of if you want others to find it usable.
In concrete terms, have a look at the package dh-make, which contains all the infrastructure you need to create a well-behaved Debian package.
When you run dh_make -s -n
in the directory where you develop your script, you get to fill in some details, such as a package description and your name and email address. The tool will create a debian/
directory with some template files which you should either modify or remove. (The ones with *.ex
names are probably all good to remove.)
(dh_make
is particular about the directory name; it will print an error message directing you to use dh_make -s -n -p yourpackage_0.01
to proceed without renaming the directory.)
- The package should have a useful name and a description. This is in the
debian/control
file. This is also where you can make it depend on other packages, or even particular versions of other packages. - There needs to be a modicum of documentation; the files
debian/README
anddebian/changelog
should be updated to contain more than just the boilerplate. If you have notes for the package itself, you might want to put them indebian/README.Debian
; otherwise, delete this file. Similar fordebian/README.source
, i.e. notes for somebody downloading the package's sources withapt-get source yourpackage
. These files will end up in/usr/share/doc/yourpackage
when you installyourpackage
. If you want to put other files there, add their names to the (now empty) text filedebian/docs
. Otherwise, you can delete this file, too. - Review
debian/copyright
and update it if necessary. This too will end up in/usr/share/doc/yourpackage
.
There is a wealth of material about Debian packaging and dh-make
all over the Internet; this answer is obviously very brief and summaric. For a really proper package, you need to read and understand all of the Debian Policy.
Packaging a binary or script is very simple. In the most trivial case, you need a .deb
package which contains a copy of your binary in usr/bin/yourbinary
. However, there are a number of things you should take care of if you want others to find it usable.
In concrete terms, have a look at the package dh-make, which contains all the infrastructure you need to create a well-behaved Debian package.
When you run dh_make -s -n
in the directory where you develop your script, you get to fill in some details, such as a package description and your name and email address. The tool will create a debian/
directory with some template files which you should either modify or remove. (The ones with *.ex
names are probably all good to remove.)
(dh_make
is particular about the directory name; it will print an error message directing you to use dh_make -s -n -p yourpackage_0.01
to proceed without renaming the directory.)
- The package should have a useful name and a description. This is in the
debian/control
file. This is also where you can make it depend on other packages, or even particular versions of other packages. - There needs to be a modicum of documentation; the files
debian/README
anddebian/changelog
should be updated to contain more than just the boilerplate. If you have notes for the package itself, you might want to put them indebian/README.Debian
; otherwise, delete this file. Similar fordebian/README.source
, i.e. notes for somebody downloading the package's sources withapt-get source yourpackage
. These files will end up in/usr/share/doc/yourpackage
when you installyourpackage
. If you want to put other files there, add their names to the (now empty) text filedebian/docs
. Otherwise, you can delete this file, too. - Review
debian/copyright
and update it if necessary. This too will end up in/usr/share/doc/yourpackage
.
There is a wealth of material about Debian packaging and dh-make
all over the Internet; this answer is obviously very brief and summaric. For a really proper package, you need to read and understand all of the Debian Policy.
edited Jun 6 '13 at 8:09
answered Jun 6 '13 at 7:35
tripleee
4,91911727
4,91911727
For a single script, you might also look atequivs
, which however is more oriented towards creating an empty meta-package which pulls in other packages as dependencies. It does have a facility for including arbitrary files in the package as well, though. The instructions are less oriented towards actually packaging something, but once you understand the basics ofdh_make
you might want to use just a single source file for the entire package, whichequivs
does for you (it basically offers a superset of thedebian/control
file for controlling the entire package).
– tripleee
Jun 6 '13 at 8:12
To publish the package so thatapt-get
finds it, you need to set up a repo, and add the repo's URL to a file in/etc/apt/sources.list.d
; some package managers also provide a GUI for this. If a public repo is acceptable, Launchpad offers to host a PPA for you, but setting up a private repo isn't too hard, either; you basically need to rundpkg-scanpackages
to generate thePackages
file.
– tripleee
Jul 10 '13 at 5:37
add a comment |
For a single script, you might also look atequivs
, which however is more oriented towards creating an empty meta-package which pulls in other packages as dependencies. It does have a facility for including arbitrary files in the package as well, though. The instructions are less oriented towards actually packaging something, but once you understand the basics ofdh_make
you might want to use just a single source file for the entire package, whichequivs
does for you (it basically offers a superset of thedebian/control
file for controlling the entire package).
– tripleee
Jun 6 '13 at 8:12
To publish the package so thatapt-get
finds it, you need to set up a repo, and add the repo's URL to a file in/etc/apt/sources.list.d
; some package managers also provide a GUI for this. If a public repo is acceptable, Launchpad offers to host a PPA for you, but setting up a private repo isn't too hard, either; you basically need to rundpkg-scanpackages
to generate thePackages
file.
– tripleee
Jul 10 '13 at 5:37
For a single script, you might also look at
equivs
, which however is more oriented towards creating an empty meta-package which pulls in other packages as dependencies. It does have a facility for including arbitrary files in the package as well, though. The instructions are less oriented towards actually packaging something, but once you understand the basics of dh_make
you might want to use just a single source file for the entire package, which equivs
does for you (it basically offers a superset of the debian/control
file for controlling the entire package).– tripleee
Jun 6 '13 at 8:12
For a single script, you might also look at
equivs
, which however is more oriented towards creating an empty meta-package which pulls in other packages as dependencies. It does have a facility for including arbitrary files in the package as well, though. The instructions are less oriented towards actually packaging something, but once you understand the basics of dh_make
you might want to use just a single source file for the entire package, which equivs
does for you (it basically offers a superset of the debian/control
file for controlling the entire package).– tripleee
Jun 6 '13 at 8:12
To publish the package so that
apt-get
finds it, you need to set up a repo, and add the repo's URL to a file in /etc/apt/sources.list.d
; some package managers also provide a GUI for this. If a public repo is acceptable, Launchpad offers to host a PPA for you, but setting up a private repo isn't too hard, either; you basically need to run dpkg-scanpackages
to generate the Packages
file.– tripleee
Jul 10 '13 at 5:37
To publish the package so that
apt-get
finds it, you need to set up a repo, and add the repo's URL to a file in /etc/apt/sources.list.d
; some package managers also provide a GUI for this. If a public repo is acceptable, Launchpad offers to host a PPA for you, but setting up a private repo isn't too hard, either; you basically need to run dpkg-scanpackages
to generate the Packages
file.– tripleee
Jul 10 '13 at 5:37
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f71213%2fcreating-a-terminal-application-from-a-shell-script%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
Depending on what you're doing, either developer.ubuntu.com or debian.org/doc/manuals/developers-reference (yes, that's a Debian link, I don't believe Ubuntu has its own version, you can skim over a lot of sections about internal Debian stuff).
– derobert
Apr 4 '13 at 17:17
Just to make sure, is your intention to package your script just to be able to run it "from the terminal by typing the name"?
– Adrian Frühwirth
Apr 6 '13 at 18:07