Displaying instructions to user after .deb installer completes - linux

Is there a commonly used approach for displaying 'how to get started' instructions to a user after a .deb installer has finished installing a package?
I need an approach that works for users working via a terminal as well as from a desktop environment.
Server admins will probably know to check for a README file but many others won't.

I'd suggest running the "tty" command from your postinstall script. That will tell you if you have a tty and are running as a terminal program. Once you know that you could either "more" a readme file if you're running in terminal mode or you could call "gnome-text-editor" if not. You might also want to put in some detection to check "/etc/lsb-release" so that you know what distribution your .deb is being installed on and which editors will be suitable.

I use the tty command like Benj suggested, but I use the dialog command to display post install chatter if its available on the system.
Try this command:
dialog --backtitle "All done" --title "Installation complete" --textbox /etc/passwd 0 0
... but replace /etc/passwd with your README of choice. Its a much nicer way to scroll through information.

After a bit of experimentation it looks like I can detect how the .deb package has been installed by checking the value of the DEBIAN_FRONTEND variable in the postint.sh script. When run from the desktop it contains the value 'gnome', but when run via dpkg from the command-line it isn't set, so something like this might work:
HELP_URL="http://mysite.com/help.html"
if [ "$DEBIAN_FRONTEND" = "gnome" ]; then
nohup gnome-www-browser $HELP_URL &
else
echo For help visit $HELP_URL
fi

Related

How do you get a launcher for firefox?

I hope that I'm tagging/asking on the correct page. I'm Using Linux Mint 6.0, but it could be OS independent.
So the used command for installing Firefox was
nix-env -iA nixpkgs.firefox-esr
When I type which firefox, I get:
/home/foo/.nix-profile/bin/firefox
So Linux Mint comes with Chrome preinstalled, which has a launcher, e.g. also in the start menu. How do I get that for firefox as well? I didn't find a tool to create such a launcher in Mint and I actually think, that nix should do that for me.
EDIT: I also found this page which seemed helpful and advertised e.g. the KDE Kickoff, but I wasn't able to get that one to run.
I can only speak for Ubuntu launchers, but other distros will have launcher files that will have a similar setup
TLDR, add ~/.nix-profile/share to XDG_DATA_DIRS env variable on login. Add the following to ~/.profile after nix loading commands
export XDG_DATA_DIRS=$HOME/.nix-profile/share:$XDG_DATA_DIRS
Explanation:
Installed packages via nix will have an immutable path in nix/store. ~/.nix-profile/bin/firefox is the derivation your current nix environment is linked to (if you update the firefox package, it'll point to the new one)
This means you can create a launcher file for that executable. Lets see if the firefox-esr derivation comes with a desktop launcher or not:
$ nix-build '<nixpkgs>' -A firefox-esr
This will build the package and give you a derivation path. For my current channel it is /nix/store/3iipcmiykgr4p34fg3rkicdz1bw584gm-firefox-102.2.0esr
If I check inside it, there is a .desktop file which defines Ubuntu launchers:
$ ls /nix/store/3iipcmiykgr4p34fg3rkicdz1bw584gm-firefox-102.2.0esr/share/applications
firefox.desktop
These files will also be available under ~/.nix-profile/share/applications so you can simply add that to XDG_DATA_DIRS env variable before boot
If an application did not have one, you can manually make one and add it under ~/.local/share/applications, then set the executable path to the nix one
So SuperSandro2000 explained in the comments, that firefox from nix ships with a .desktop file already. This can be easily added to the start menu and lies in
/nix/store/...-firefox-XXX.X/share/applications/firefox.desktop
If there is no such file included, the most direct way could be (imho) to just create a simple bash script:
#!/bin/bash
./home/foo/.nix-profile/bin/firefox & #Run Firefox
echo Firefox was started with PID $!
In order to make it runnable, enter chmod +x your_skript_name.sh. Afterwards, ./firefox 2> /dev/null & can be used instead to run it silently in the background.
You can also consider the developer/command line options for firefox (Archive) or this blog article here.
Maybe /usr/bin/menulibre is also the right application, it allows you to create .desktop files. This app can also be found by right-clicking on the start "menu".

how to use exiftool with cygwin basic startup

ok here is the situation. I'm a complete newbie at all this and have no idea what is going on. Currently I have a race website with thousands of photos and each time I basically upload via FTP to a temporary folder and use Cygwin with exiftool (I think) to tag each image and then use Cygwin to move them to where I want on my website. During the process I make a filename.sh file and then do a chmod 755 and then tell it to run and I can tag several thousand photos individually with my filename.sh file data. All that is good. Most of the time. haaha.
My question is I want to keep the images on my desktop and tag them using the same steps and then FTP them to my site. So I think what I'm trying to figure out is how to get exiftool to work on my desktop computer the way it works on my website.
I tried to do all the right things, but when I run the filename.sh file it says:
exiftool command not found
What do I need to do? Any help would be greatly appreciated. Thanks!
install perl
then cpan Image::ExifTool
done.
The exiftool command is available through Cygwin Ports, an extra package repository for Cygwin.
To install:
Follow the Cygwin Ports installation guide (summarized here)
Download the regular Cygwin installer from https://www.cygwin.com/
In a cygwin terminal, run cygstart -- /path/to/setup-x86.exe -K http://cygwinports.org/ports.gpg. The Cygwin installer should open.
On the Choose Installation Type page, select "Install from Internet".
On the Choose Download Site(s) page, select a regular cygwin distro mirror, then enter ftp://ftp.cygwinports.org/pub/cygwinports in the User URL field and press Add. Select both, then click Next.
At the Select Packages screen
Set the View dropdown to "Full"
Search for perl-Image-exiftool
Click it to install it
Continue to click Next until the installation completes
https://sourceware.org/cygwinports/
https://sourceforge.net/projects/cygwin-ports/

Equivalent for Linux's "screen"

Is there anything similiar to Linux's "screen"? What I want to do is launch console application created in Java. Then let's say I want to execute command to the running application. For example I want to tell it to exit so I'll tell it command 'exit'. On Linux I can open the application "in screen" and later if I want to tell it any command I can attach the "screen", tell it the command and detach. I don't need screen but I need something that can do this. It would also be cool if I could do it without installing any additional software.
You can install cygwin and within cygwin install screen.

How to add a custom tool/command to tortoisehg in linux?

I am trying to trying to execute a shell command from tortiseHg. My end goal is to run a large shell command with {REV} being a parameter. Does anyone know of a way to do this?
I tried using the custom tools option in tortiseHg and it is not working for me.
No matter what I add as the command, It always returns:
The command "my command and args" could not be executed.
"No such file or directory"
Please check that the command path is valid and that it is a valid application
How to reproduce:
In tortoiseHg (linux), go to Settings> Tools > New Tool, add a new command.
Eg. touch /path/success.txt
Add tool to list
Restart thg
Click on the tool.
As lgriZdes mentioned in his answer, custom tool seems to accept only hg commands. Got around this issue by creating an alias in hg which executes a shell command, and calling this alias from custom tools. Let me know if you guys want more detailed info.
In old prehistoric versions of tortoisehg only hg commands were working. It is said here that now shell commands should work without problem How to add a custom tool/command to tortoisehg in linux?

Can Linux Bash scripts respond to install options

I need to script the installation of a number of products on Redhat Linux
I am installing from previously downloaded tar files that each contain their own specific install.sh.
My problem is that by executing the install.sh scripts a number of questions are asked such as ...
a). Accept license
b). set default path(s)
c). do i wish to start service
etc...
Can Bash detect these questions and respond correctly? or do i require another linux based product/function?
For windows based installs i have used AutoItScript.
What are my options on Linux Redhat?
To establish whether the scripts support any command line options, you can:
Read the readme file of the software, if there is one. This should explain any options.
Read the top of the install.sh script. Usually options are at least listed there.
Read the code itself, which might be a lot of work.
Once you have established that the scripts do not support options, the standard way of automating this would be with an expect script. See for example automating install.sh script using an expect script.
Depending on how the install script works, you may be able to send it commands on standard input. For example, if you press Tab once, then Enter, then y and lastly Enter again, you can try the following:
printf %s $'\t\ny\n' | ./install.sh

Resources