creating a .deb package and autorun it

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












4















I'm using a Raspberry Pi 2 Model B running the latest Raspbian Stretch Lite 2018-11-13.



I built a program that communicates with a LoRa chip (SX1276) using SPI, gets some data from a temperature sensor and prints the temperature on the screen.



My program consists of only one executable (apart from wiringpi library).



I was searching for a tutorial to make my program a *.deb package. Using this tutorial I managed to build a lora.deb package.



When I installed my lora.deb package sudo dpkg -i lora.deb the executable just deployed in a directory.



How can I make that package automatically run the executable and also run it every time the system boots?










share|improve this question



















  • 5





    Check out systemd service files. If your deb package contains a service file, and you add a postinstall script to your package, you can bring up a service after install automatically and on boot.

    – datUser
    Jan 12 at 20:48






  • 1





    See here here for guides to writing systemd unit files, which will be used by systemd (which handles startup) to start your service.

    – novice
    Jan 13 at 1:00















4















I'm using a Raspberry Pi 2 Model B running the latest Raspbian Stretch Lite 2018-11-13.



I built a program that communicates with a LoRa chip (SX1276) using SPI, gets some data from a temperature sensor and prints the temperature on the screen.



My program consists of only one executable (apart from wiringpi library).



I was searching for a tutorial to make my program a *.deb package. Using this tutorial I managed to build a lora.deb package.



When I installed my lora.deb package sudo dpkg -i lora.deb the executable just deployed in a directory.



How can I make that package automatically run the executable and also run it every time the system boots?










share|improve this question



















  • 5





    Check out systemd service files. If your deb package contains a service file, and you add a postinstall script to your package, you can bring up a service after install automatically and on boot.

    – datUser
    Jan 12 at 20:48






  • 1





    See here here for guides to writing systemd unit files, which will be used by systemd (which handles startup) to start your service.

    – novice
    Jan 13 at 1:00













4












4








4








I'm using a Raspberry Pi 2 Model B running the latest Raspbian Stretch Lite 2018-11-13.



I built a program that communicates with a LoRa chip (SX1276) using SPI, gets some data from a temperature sensor and prints the temperature on the screen.



My program consists of only one executable (apart from wiringpi library).



I was searching for a tutorial to make my program a *.deb package. Using this tutorial I managed to build a lora.deb package.



When I installed my lora.deb package sudo dpkg -i lora.deb the executable just deployed in a directory.



How can I make that package automatically run the executable and also run it every time the system boots?










share|improve this question
















I'm using a Raspberry Pi 2 Model B running the latest Raspbian Stretch Lite 2018-11-13.



I built a program that communicates with a LoRa chip (SX1276) using SPI, gets some data from a temperature sensor and prints the temperature on the screen.



My program consists of only one executable (apart from wiringpi library).



I was searching for a tutorial to make my program a *.deb package. Using this tutorial I managed to build a lora.deb package.



When I installed my lora.deb package sudo dpkg -i lora.deb the executable just deployed in a directory.



How can I make that package automatically run the executable and also run it every time the system boots?







packaging deb






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 13 at 14:46









Jeff Schaller

40.1k1054126




40.1k1054126










asked Jan 12 at 20:45









MrBitMrBit

1264




1264







  • 5





    Check out systemd service files. If your deb package contains a service file, and you add a postinstall script to your package, you can bring up a service after install automatically and on boot.

    – datUser
    Jan 12 at 20:48






  • 1





    See here here for guides to writing systemd unit files, which will be used by systemd (which handles startup) to start your service.

    – novice
    Jan 13 at 1:00












  • 5





    Check out systemd service files. If your deb package contains a service file, and you add a postinstall script to your package, you can bring up a service after install automatically and on boot.

    – datUser
    Jan 12 at 20:48






  • 1





    See here here for guides to writing systemd unit files, which will be used by systemd (which handles startup) to start your service.

    – novice
    Jan 13 at 1:00







5




5





Check out systemd service files. If your deb package contains a service file, and you add a postinstall script to your package, you can bring up a service after install automatically and on boot.

– datUser
Jan 12 at 20:48





Check out systemd service files. If your deb package contains a service file, and you add a postinstall script to your package, you can bring up a service after install automatically and on boot.

– datUser
Jan 12 at 20:48




1




1





See here here for guides to writing systemd unit files, which will be used by systemd (which handles startup) to start your service.

– novice
Jan 13 at 1:00





See here here for guides to writing systemd unit files, which will be used by systemd (which handles startup) to start your service.

– novice
Jan 13 at 1:00










1 Answer
1






active

oldest

votes


















3














change '/usr/bin/something' to '/directory/path/to/deployed/executable' below:



$ cat /etc/systemd/system/something.service

[Unit]
Description = Something Service
After = network.target

[Service]
ExecStart = /usr/bin/something

[Install]
WantedBy = multi-user.target

$ systemctl daemon-reload
$ systemctl enable something
$ systemctl start something





share|improve this answer























  • Thank you very much! Reading through all those sites and tutorials I came up to the solution for the whole method. First of all I need to add a myapp.service into my *.deb package, then I'll have to write a postinst script that will copy the myapp.service into the proper path and enable the service. I'm not quite sure if instead of a copy you just have to add the myapp.service into the *.deb package with the proper path.

    – MrBit
    Jan 13 at 12:39










Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494159%2fcreating-a-deb-package-and-autorun-it%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














change '/usr/bin/something' to '/directory/path/to/deployed/executable' below:



$ cat /etc/systemd/system/something.service

[Unit]
Description = Something Service
After = network.target

[Service]
ExecStart = /usr/bin/something

[Install]
WantedBy = multi-user.target

$ systemctl daemon-reload
$ systemctl enable something
$ systemctl start something





share|improve this answer























  • Thank you very much! Reading through all those sites and tutorials I came up to the solution for the whole method. First of all I need to add a myapp.service into my *.deb package, then I'll have to write a postinst script that will copy the myapp.service into the proper path and enable the service. I'm not quite sure if instead of a copy you just have to add the myapp.service into the *.deb package with the proper path.

    – MrBit
    Jan 13 at 12:39















3














change '/usr/bin/something' to '/directory/path/to/deployed/executable' below:



$ cat /etc/systemd/system/something.service

[Unit]
Description = Something Service
After = network.target

[Service]
ExecStart = /usr/bin/something

[Install]
WantedBy = multi-user.target

$ systemctl daemon-reload
$ systemctl enable something
$ systemctl start something





share|improve this answer























  • Thank you very much! Reading through all those sites and tutorials I came up to the solution for the whole method. First of all I need to add a myapp.service into my *.deb package, then I'll have to write a postinst script that will copy the myapp.service into the proper path and enable the service. I'm not quite sure if instead of a copy you just have to add the myapp.service into the *.deb package with the proper path.

    – MrBit
    Jan 13 at 12:39













3












3








3







change '/usr/bin/something' to '/directory/path/to/deployed/executable' below:



$ cat /etc/systemd/system/something.service

[Unit]
Description = Something Service
After = network.target

[Service]
ExecStart = /usr/bin/something

[Install]
WantedBy = multi-user.target

$ systemctl daemon-reload
$ systemctl enable something
$ systemctl start something





share|improve this answer













change '/usr/bin/something' to '/directory/path/to/deployed/executable' below:



$ cat /etc/systemd/system/something.service

[Unit]
Description = Something Service
After = network.target

[Service]
ExecStart = /usr/bin/something

[Install]
WantedBy = multi-user.target

$ systemctl daemon-reload
$ systemctl enable something
$ systemctl start something






share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 13 at 5:12









tkjeftkjef

26125




26125












  • Thank you very much! Reading through all those sites and tutorials I came up to the solution for the whole method. First of all I need to add a myapp.service into my *.deb package, then I'll have to write a postinst script that will copy the myapp.service into the proper path and enable the service. I'm not quite sure if instead of a copy you just have to add the myapp.service into the *.deb package with the proper path.

    – MrBit
    Jan 13 at 12:39

















  • Thank you very much! Reading through all those sites and tutorials I came up to the solution for the whole method. First of all I need to add a myapp.service into my *.deb package, then I'll have to write a postinst script that will copy the myapp.service into the proper path and enable the service. I'm not quite sure if instead of a copy you just have to add the myapp.service into the *.deb package with the proper path.

    – MrBit
    Jan 13 at 12:39
















Thank you very much! Reading through all those sites and tutorials I came up to the solution for the whole method. First of all I need to add a myapp.service into my *.deb package, then I'll have to write a postinst script that will copy the myapp.service into the proper path and enable the service. I'm not quite sure if instead of a copy you just have to add the myapp.service into the *.deb package with the proper path.

– MrBit
Jan 13 at 12:39





Thank you very much! Reading through all those sites and tutorials I came up to the solution for the whole method. First of all I need to add a myapp.service into my *.deb package, then I'll have to write a postinst script that will copy the myapp.service into the proper path and enable the service. I'm not quite sure if instead of a copy you just have to add the myapp.service into the *.deb package with the proper path.

– MrBit
Jan 13 at 12:39

















draft saved

draft discarded
















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494159%2fcreating-a-deb-package-and-autorun-it%23new-answer', 'question_page');

);

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






Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)