Creating Installer and/or Package


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Creating Installer and/or Package
# 1  
Old 02-11-2015
Creating Installer and/or Package

I have an open source tool I am working on. As of right now, version 1 is complete but it's a set of programs in a directory. What I would like to do is create a flexible installer or package that puts things in the appropriate directories (/usr/bin ? ) or perhaps the user's personal bin directory if they don't have root privileges.

Is there a standard way of building an installer? Or, if I wanted to make it flexible, would I have multiple packages / installers for different *nixes?

I also have environment variables associated with it. Should I write those to the user's .bashrc or .profile and if so, prompt first to let the user decide if that's ok?

Thanks in advance.
# 2  
Old 02-15-2015
I would consider using /opt for everything.

Regards
Peasant.

---------- Post updated at 08:22 ---------- Previous update was at 08:22 ----------

I would consider using /opt for everything.

Regards
Peasant.
This User Gave Thanks to Peasant For This Post:
# 3  
Old 02-15-2015
To get started:
For an arch-based distro, read into AUR for aur-packages.
For redhat based distros, read into specfiles for rpm-packages.
For debian based distros, read into XY? for deb-packages.

If it is binary, requires compiling just prepare a proper config & make "script" (what language are those anyway?) These 2 scripts (if binary) could also be used to install it on the system.

If your projects are just scrips, its worth to think about wether they even require installation, or if you could prepare them better so they dont.

Hope this helps.

If not, share more info. Smilie


Environmentvariables, such as XDG_DOWNLOAD_DIR?
They are already saved, you better reuse them, instead of setting them your own.
However, (shared) Variables c/would be safed inside your application, or, less nice, in /etc/profile.d/project-scriptfile-containain-variables.sh

Remember, not every variable must be shared, only a few required ones.

hth

Last edited by sea; 02-15-2015 at 04:11 PM..
This User Gave Thanks to sea For This Post:
# 4  
Old 02-15-2015
Peasant and sea - thanks for the responses, they are helpful. I can provide more info - the project page is here:

https://github.com/tinypigdotcom/clpm

The install script I have been using for myself but contains assumptions I don't want to make for anyone else (like existence of $HOME/bin):

Code:
BIN=$HOME/bin
CLPM=$HOME/clpm

cd $BIN &&
cp $CLPM/p . &&
echo copied p &&
ln -f p f &&
echo linked f &&
ln -f p fa &&
echo linked fa &&
ln -f p x &&
echo linked x &&
ln -f p xa &&
echo linked xa &&
ln -f p z &&
echo linked z &&
ln -f p zdir &&
echo linked zdir &&
cp $CLPM/af . &&
echo copied af &&
cp $CLPM/v . &&
echo copied v &&
cp $CLPM/d . &&
echo copied d &&
chmod 700 p f fa x xa z zdir af v d &&
echo chmod 700

settings from .bash_profile:

Code:
alias d='. d'
alias v='. v'
AF_DIR=$HOME/app


Last edited by tinypig; 02-15-2015 at 03:21 PM.. Reason: no c alias, that is from a different script
# 5  
Old 02-18-2015
If you are worried about your assumptions, check them.

Code:
die() {
        echo "$@" >&2
        exit 1
}

[ -z "$BIN" ] && die "BIN not set"
[ -d "$BIN" ] || die "BIN($BIN) does not exist or is not a folder"
[ -z "$CPLM" ] && die "CPLM is not set"
[ -d "$CPLM" ] || die "CPLM($CPLM) does not exist or is not a folder"
# etc

This User Gave Thanks to Corona688 For This Post:
# 6  
Old 02-18-2015
Make yourself clear on your projects range.
Its not a simple 30 line script.

It will become complex, thus it is an application, thus it should be 'installed' properly.
By that i mean, use your system default paths to place your application pieces.

Examples: (valid for redhat based distros)
The start binary (or script) to /usr/bin/cplm
Your other cplm files to /usr/share/cplm
Your manpages should go to something like: /usr/share/man/man1/cplm.1
Your bash completition to /etc/bash_completion.d/

Also, make sure the installation process works without removing the original data, so you can run your install script straight from your projects folder, overwriting the installed data -> so you always use the installed version - NOT the version you working on.

If it was a single file, using a single configuration file, it could be made running from anywhere one wants, but i doubt you can limit this project to a single execution and a single config file only.
And to get started, as a first approach - make your install script work for you.
You cant expect people to run an incomplete application, so for the time beeing you're currently the only one using the installation script, until it reaches some kind of quality, and by that time, you'll know enough to improve the install script to work for others as well.

Hope this helps
This User Gave Thanks to sea For This Post:
# 7  
Old 02-18-2015
I think it would be a good idea to develop a shell script containing the installation binaries inside supported on command you will find in every unix flavor, specially in aix, solaris and linux, like the "tar" command.

If the package you need to install is tiny, you can make a tar with it, and put inside the script in which you will make a function that "echoes" the tar out and then untar it the way you know, this will sweeten your life a lot.

hope this helps

Roque
This User Gave Thanks to riacovino For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Emergency UNIX and Linux Support

Problem when trying to remove a package using rpm command - error: package is not installed

Hello, i have installed a package by using the command sudo rpm -i filepackage.rpm package filepackage is already installed when i try to remove it, i get an error saying "is not installed": sudo rpm -e filepackage.rpm error: package filepackage is not installed How can... (4 Replies)
Discussion started by: g_p
4 Replies

2. UNIX for Dummies Questions & Answers

Can't install rpm package with --prefix in new path.Error: package is not relocatable

Hello, i have downloaded an rpm package "hadoop-0.20.205.0-1.amd64.rpm" in /usr/local/ directory. I'm trying to install the rpm package in a new path/location (/usr/local/hadoop-0.20.205), but i can't. I did: 1st try: Didn't work sudo rpm -i --prefix=/usr/local/hadoop-0.20.205... (1 Reply)
Discussion started by: g_p
1 Replies

3. Red Hat

Creating rpm package file

Hi, I have a binary file ans some scripts which copy the binary file to a location and create some files and then add a entry to cron . I want to create a rpm package file for all these.So that if a user run: rpm -i my.rpm the binary is copied and scripts are run. Can anyone help me in... (1 Reply)
Discussion started by: kailash19
1 Replies

4. UNIX for Advanced & Expert Users

How to find dependancies of .dstream package (Solaris) & .rpm package( linux)

Friends, Please let meknow, How we can find the dependancies of .dstream package & .rpm package before installation ? For AIX, We can use the inutoc . command to create the .toc file for the bff package, What about Solaris & Linux ? (0 Replies)
Discussion started by: yb4779
0 Replies

5. AIX

mkinstallp package creation failing "no such file: ./usr/lpp/<package name>/inst_root"

Hello, I'm trying to build a (bff) package from an already installed program (clam antivirus) using mkinstallp. However, mkinstallp fails with "no such file: ./usr/lpp/<package name>/inst_root" I'm not sure why all files get created ok except for these particular ones. Any help would be... (2 Replies)
Discussion started by: omonte
2 Replies

6. Ubuntu

Problem creating Desktop shortcuts through Debian dpkg installer scripts

Hi, I am creating a debian package (*.deb) for my application using the command I am using debian pre/post installer scripts to do certain tasks before/after installation/uninstallation. One such task is to create a shortcut on the user's desktop to launch my application. I am trying to do this... (0 Replies)
Discussion started by: royalibrahim
0 Replies

7. Solaris

Design for development of solaris package (installer)

Hi, I am new to solaris. As I am assigned to a new task to develop a installer for an application on solaris10 machine, I need to prepare the design document for the installer. ( I came to know that in solaris all the instllables will be considered as packages and and are not like .exe's). So... (0 Replies)
Discussion started by: raghu.amilineni
0 Replies

8. Linux

how to restore original package after uninstalling the upgraded package using rpm

have following package installed rpm -qa |grep ADMIN It will give the following package installed: ADMIN-4.0.0.1 Now I will upgrade the ADMIN package using the following command. rpm --upgrade ADMIN-4.1.0.1 It will upgrade the ADMIN packagge to ADMIN-4.1.0.1 Now I want that... (0 Replies)
Discussion started by: amitpansuria
0 Replies
Login or Register to Ask a Question