I created a little application using Bash and Zenity that I wish to install on my system as a native application as well as a package that I can distribute. I have a .desktop file for my application, a .png icon, and the .sh file. Where do these files go to make a "native" application, and by what process would I need to go to create a package that can be compiled to install this application on another system?
2 Answers
About the first part:
To start with, I would make the script executable and remove .sh extension from both the script and the .desktop file. If you want to use it system wide, then copy the whole directory, except the .desktop file, to /opt. The .desktop file would then be:
[Desktop Entry]
Version=1.0
Type=Application
Name=GTeaKup
Comment=The perfect GTK tea timer!
Exec=/bin/bash gteakup
Icon=gteacup.png
Path=/opt/GTeaKup/
Terminal=false
StartupNotify=false
...and copy that to /usr/share/applications
About the second half of your question: take a look here, especially this one is nice to start with if you never created Debian packages before. You will then get an installer like this. When you install it via the software center, it will complain, because the usual files like changelog, copyright etc. files are not included, but it works fine.
btw you do know that your script acts differently on double-click and when the ok button is chosen? ;)
- 85,475
You can use a shell script install.sh as given below to install your tea timer script to another machine.
#!/bin/bash
install_dir="$HOME/teaKup"
current_dir="$(pwd)"
dpkg -s sox > /dev/null 2>&1
if [ $? = 0 ]; then
mkdir $install_dir #create directory to place files.
cp $current_dir/gteakup.sh $install_dir/ # copies the file.
cp $current_dir/gteakup.png $install_dir/
cp $current_dir/sound.ogg $install_dir/
cat > $HOME/Desktop/GTeaKup.desktop << EOF # create desktop file at desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=GTeaKup
Comment=The perfect GTK tea timer!
Exec=bash $install_dir/gteakup.sh
Icon=$install_dir/gteakup.png
Terminal=false
StartupNotify=false
EOF
chmod u+x $HOME/Desktop/GTeaKup.desktop # give execution permission to desktop file.
else
# ask user to install sox which is needed to use play command
echo -e "The program 'play' is currently not installed. You can install it by typing:\nsudo apt-get install sox"
fi
Instruction
- put this
install.shalong with other files in azipfile. No need to provide.desktopfile, script will make one. - copy the zip file to other systems and unzip them.
- just run
bash install.sh, it will take care of the rest including coping the files in proper places and will make a desktop file to run it.
Note
Be careful with the position of EOF in install.sh. It should at the beginning of that line.
- 46,120