Jump to content











Photo
* * * * - 2 votes

[PortableApps] Make portable using NSIS (More detailes on portable apps)


  • Please log in to reply
3 replies to this topic

#1 Shirin Zaban

Shirin Zaban

    Frequent Member

  • Tutorial Writer
  • 423 posts
  • Location:Tehran
  • Interests:1_Making Unattended and Customized XP<br /><br />2_Making different types of Bootable and Multiboot CD/DVD<br /><br />3_Like to learn more about grub and grub4DOS
  •  
    Iran

Posted 17 March 2009 - 06:30 PM

=================================================================
Make portable using NSIS (More detailes on portable apps)
=================================================================


Hi

In this Tutor we will learn the basic methodes to make our portable app
packs.I will try to describe easy methodes and introduce needed programs
to do this job.and because of some requests i will use NSIS as Launcher
of our portables (as portable app.com does).


****************
Step_01.Getting ready
****************

Any program that we install in our system,will do one or some of or all
changes below in our computer:

1.Add some files (and Directories) to our system.some of them will make a
folder in ...\program files\ directory and will put all it's needed files
in that folder,and some else will make several directories in several parts
of our system and will put files in those directories (for example they may
make directories in program files\common\ , windows,system32,drivers,and
many other places).

2. Most of apps will make changes,or will add new keys to our registry,and
even may delete some parts of our registry.

3. some apps will install in system but will work if we have installed some
programes befor installing them.For example some apps will not work if we
have not installed directX version xx or .net framework in our system befor
installing or using them.
-----------------------------

Each program will run if it has needed files in specified directory/directories
and also if the needed registry setting are ready.
So for making an portable version of an application we should put it's needed
files in correct places and also give correct registry settings they need.for
this pupose We should know whitch files are needed for an portable app to run
perfectly.
Does it need an special setting in INI files,registry,used computer,and ...?
and Is there any needs in system to be capable of running this App?
------------------------------

Getting informations above is not so easy at least for basic users ,So we
should use some powerful tools to do the job.

In other look we see that There are a lot of applications that we can make
them portable, But they are not all free softwares and None free softwares
need some kinds of registration to work for example serial number,crack ,
reg file or .... when making this kind of portables,after they are made,they
will run but will ask serial number or registration information,so will not
continue (of course most of them will work for trial time).So we should solve
this problem by some methodes.i will tell some kinds of bypassing this problem
during tutor,but because any app uses different kind of registering process
and we are not going to teach unautorized topics in this site,for other locks
I can not talk (and i do not know all),so you should think and find solosion.

In this tutor we will use tools below:
--------------------------------------

Total Uninstall: Really very very nice software BUT not freeware.I
could not find any similar free software that can do all jobs that
this software does.
May be this is the only software that can give us more than 90% of
informations needed to make portable apps. If you can find one of
it's old versions (versions 3.80 to v5 " not version 5") ,in it's
trial time ,you will be able to use that enough.(I used version 4.11
in this tutor)


NSIS (and some plugins):NSIS is very good and freeware install maker.
we will use it to launch our portable programs in this tutor.just do
not forget that use the version i used in this tutorial (v2.44),because
in some versions of that,the default variables and some other settings
are different,so if you use other versions they will not work unless you
can change the scripts for used version's form.
You can find all versions of that ready to download in http://sourceforge.net

Universal Extractor 1.6 :Is a very usfull and free program that as autor
says:"can extract files from any type of archive, whether it's a simple
zip file, an installation program (like Wise or NSIS), or even a Windows
Installer (.msi) package."


***************************************************
Step_02.Preparing files needed to make portable program
***************************************************
===========
Method_1 :
===========


Making portable version of some applications are very very easy.for example
we want to make portable version of CCleaner 2.10.618,we do as below:

1_instal "Universal Extractor 1.6"
2_Place "ccsetup210.exe" in desktop,Right click on it and select "UniExtract
to SubDir" (see pic_01 from attachment).The command window will be appeared and
after a few seconds you will have a directory by the name of "ccsetup210",in
desktop.that contains all files needed to run "CCleaner 2.10" as portable
version without installing it.
If you double click on "CCleaner.exe" inside this directory ,it will run.

Another examples of this kinds of apps are NSIS 2.44 , UPX Graphical 1.36,
WinImage 8.0.8000 ,RAR Recovery Toolbox v1.1.4.7 and else

So getting files needed for making portable version of some softwares as
example above are very easy process.Normally this kinds of apps does not
make any registry changes or at least we can say that changes they make are
not so important to damage system.
we can put this folder any where in any system and can run it without
installing,but because one of purposes of writting this tutor is,getting
standard launcher to run our portables,in other section i will talk about
making launcher for that too.


===========
Method_2 :
===========

Most of the times and for almost 90% of apps ,you will need and is better
to use this method.here i have selected a very easy software to work with.
We will use "SumatraPDF-0.9.3" as first and easy example here:

1_ Install "Total Uninstall" (I used version 4.11 in this example).

2_ Put "setup.exe" (setup File of SumatraPDF) some where (in this example in
C:\xxx\setup.exe).

3_ Run "Total Uninstall",click on "Install" button in top/left side of
program menue.

4_ In comming window give the address and name of setup.exe (see picture_2a),
be sure the item "Builda New Snapshot" is selected,then click on "Next"
button.

5_Program will start to get snapshot of your system befor installing the
application,then another page will be opened (picture 2b),Make sure that
"Launch setup app now" is selected,then click on "Next" button.


6_ At this time SumatraPDF setup process will begin.DO NOT CLOSE "Total Uninstall"
and just install that normally untill it finish.

7_ After ending setup process ,another window will be shown by total uninstall
(pictre 2c),be sure that item "Application is installed...." is selected,then click
on next button.

8_ Total Uninstall will begin to get snapshot of system after installing
SumatraPDF,then will compaire this snap shot by the one that has gotten befor,
then another page will be opened (picture 2d),click on "close" button.


9_Main window of "Total Uninstall" will be shown again,that the name of our
example (SumatraPDF) is selected in left panel,and changes made to system by
installing that is shown in right panel (in tab "Changes" as picture 2e).
Now go to File menue,select "Export" then click on changes (picture 2f).
the program will save all changes made in your system by installing SumatraPDF
as text file by the name of "SumatraPDF - Changes.txt" in "C\XXX\" directory.

10_ Again go to File menue,select "Export",then click on "Registry changes"
(picture 2g).another page will be shown,be sure that item "Install file"
is selected,then ok it.theprogram will save all registry settings made by
installing SumatraPDF in your system,as reg file by the name of "SumatraPDF.Install.reg"
in "C\XXX\" directory.

11_ Do the same of above step just in end window select "Uninstall File" and
ok it.the program will save your system registry settings before installing
SumatraPDF as reg file by the name of "SumatraPDF.Uninstall.reg" in "C\XXX\" directory.

-----------------------------------------

At this time we have all nesesory informations needed for making portable
version of SumatraPDF.

In text file "C\XXX\SumatraPDF - Changes.txt" you can see list of:
_ all files added to system.
_ all files deleted from system.
_ all files changed in system.
_ all changes made to system by installing SumatraPDF.
_ all made or deleted directories in system.

C\XXX\SumatraPDF.Install.reg is all changes that have ben applied to registry
during installation.

C\XXX\SumatraPDF.Uninstall.reg is the situation of registry befor installation

So in easiest way if we Copy all files and directories made by installation ,
to the any other windows system, and paste them in the SAME PLACES in that
system,then run SumatraPDF.Install.reg,after that we can use this application
without installing.and it should work perfect.
For example suppose that SumatraPDF has made c:\Program Files\XXX\ directory
and has placed all files inside that.Now if we copy xxx directory and paste
that in...\program files directory of other computer,after running ,
SumatraPDF.Install.reg this program will run and there is no need to installing that.

This is not all you should know,and there are many other things that we
sould learn , but for this section of tutor ,it is enough and lets go and
work a litle more on this example.note that by this example i just want to
show you very basic situations of project.this tutor got very long till
now and i am in the middle of the informations that i want to tell you !!!
let's go to next step:

12_ We will not need all files that are installed and also we will not need all
registry settings (SumatraPDF.Install.reg),so lets minimize our project.

Let's take a look at text file "C\XXX\SumatraPDF - Changes.txt",in my
test it was as below:

All files and directories added to system:

D:\Documents and Settings\MCS\Start Menu\Programs\SumatraPDF\SumatraPDF.lnk
D:\Documents and Settings\MCS\Start Menu\Programs\SumatraPDF\Uninstall.lnk
D:\Program Files\SumatraPDF\SumatraPDF.exe
D:\Program Files\SumatraPDF\Uninstall.exe


All registry setting made are :

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SumatraPDF]
"DisplayName"="Sumatra PDF reader"
"NoModify"=dword:00000001
"NoRepair"=dword:00000001
"UninstallString"="\"D:\\Program Files\\SumatraPDF\\uninstall.exe\""

[HKEY_LOCAL_MACHINE\SOFTWARE\SumatraPDF]
"Install_Dir"="D:\\Program Files\\SumatraPDF"


If we make closer attention,we will see that:

_we do not need installed files inside D:\Documents and Settings\ directory,because as
you see they are just shortcuts.

_We see that there are only two files in D:\Program Files\SumatraPDF\ directory:
SumatraPDF.exe
Uninstall.exe.
we do not need Uninstall.exe,so we delete it.by now for this application to run,we need
just SumatraPDF.exe.
_by reading the registry changes ,first part is for uninstall of product,so we do not need this
section of registry change in making portable project.

the second section is the path of installation,we do not need this section too,because our
portable will not placed in that place that registry says.

so for making portable version of this program we will not need special registry settings
and we jus will need D:\Program Files\SumatraPDF\SumatraPDF.exe.So save that some place,in
other step of this tutor we will need it.

***********************************************
Step_03.Using NSIS to make our portable apps
***********************************************


Because some of BootLand users asked me to write a tutor about making portables
as "portable app.com" does ,so lets do as you want (I like my methodes,of course
"portable app.com" method is realy nice):




As you can see in picture 3a,Directory layout in PortableApps.com Format,for
each portable app is consists of Directories below ( Note that i have selected
older version of format that is easier to under stand):

_ "Portable AppName" directory:(for example Portable Firefox or
Portable Sudoku)

_ There are 3 other directories inside ApplicationNamePortable directory :
Appdata
portable
source

I will try to give more information about these directories during tutor
if needed.

_ Untill now we realized that each portable app in this system will have directories
and configuration above.and we should put our portabe app's files inside these
directories to work.and i am going to explain how to do this .

_ We have prepaired files needed to run two portable apps in first parts of
tutor (Portable CCleaner210 and Portable SumatraPDF).
First lets Go and prepair "Portable CCleaner 2.10" that we have made befor,to
work in this method.


1.Make folders that you see in picture 3a.

2.Rename the AppNamePortable directory to "Portable ccsetup210"

3.Copy All contents of folder "ccsetup210" (that we have made Befor in step_02
Methode_1 section) into ...\Portable ccsetup210\Appdata\ Directory.

4.Select an icon for Portable CCleaner and rename that to "Portable ccsetup210.ico"
and put it inside ...\Portable ccsetup210\Source\ Directory.(It is better to use your
favorite program to extract CCleaner icon from main.exe and use that here).

5.Now we should write script for our launcher,Because in this example we do not have
registry setting or ini settings so i will use very basic and easy script that will Do
our job.so open notepad and type lines below on it,then save that as "Portable ccsetup210.nsi",
and put that inside "Source" directory too
(Make sure you saved it as "Portable ccsetup210.nsi" not
"Portable ccsetup210.nsi.txt"!!!).

----------

!define SNAME "Portable ccsetup210"
!include "Registry.nsh"
CRCCheck off
AutoCloseWindow True
SilentInstall silent
WindowIcon off
XPSTYLE on
Name "${SNAME}"
Icon "${SNAME}.ico"
Caption "${SNAME} Launcher"
OutFile "..\${SNAME}.exe"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
VIProductVersion "0.1.0.0"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Portable ccsetup210 Launcher"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "� tpr 2007"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "ccsetup210"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "0.1"
Section "Main"
Exec "$EXEDIR\Appdata\CCleaner.exe"
SectionEnd

--------------

6.Right click on "Portable ccsetup210.nsi" and select "Compile NSIS script".after
a few seconds, if you have done as i explained,the NSIS will make file
"Portable ccsetup210.exe" in ...\Portable ccsetup210\ directory .Now our
Portable ccsetup210 is ready and if we take folder Portable ccsetup210 (by it's
contents) to any windows system,by double clicking on
...\Portable ccsetup210\Portable ccsetup210.exe it will run portably.


7.Do the same process for Making "Portable SumatraPDF",just you should change icon and
script file.you should change the name of script above to "Portable SumatraPDF.nsi"
and also change the nanes in script file.


Now we have two small portable apps that are working,in next step i will tell how to
make pack for these portables,but for now please note that i have talked just
about portablizing very basic apps.
In more than 90% of times you will need to aply registry setting by script file,may be
another time i can get time to talk about that,but any way i am not script developer,
so if our script developer friends in bootland,give help,we can do more in this topic.
and another tip is that most of the times ,programs add their needed files in several
directories of system and making portable version of them are harder and need mor time
and knowledg.


***********************************************
Step_04.Making portable app pack
***********************************************

1_ Run Newest Portable Application.com Platform (I used version 1.5) an install
it some where for example C:\My Portables directory.Then run it,you will have the
menue windowas picture_3b.you see that left panel of this window is empty.this is
because we have not added our portable apps to this plateform yet.

2_ Now if you download any portable apps that are made by portable app.com and put
them in C:\My Portables\PortableApps\ directory,and run it again you will see thos
portables are added to left panel and the name of them are in left pannel,and you
can click on any of them to work.(for example see picture_3c).

Or if you make your favorite one by the same method, (as we did in step above),and
put them in this directory,when you run the program again you will see thos portables
are added too.For example i just added "Portable SumatraPDF" and "Portable ccsetup210"
and you can see that in picture_3d

====================================================

For this time thats some of information that i wanted to give you in simple tutor.
hope will be some help

shirin zaban

Attached Thumbnails

  • Pictures_1_2.png
  • Pictures_3.png

  • eDvArDo likes this

#2 mahdi

mahdi

    Newbie

  • Members
  • 29 posts
  •  
    Iran

Posted 17 March 2009 - 10:03 PM

thank you shirin zaban
very good,but i wish to know more about nsis syntaxes for portable applications
by examples
thank you so much for tutor.
  • eDvArDo likes this

#3 johanes

johanes
  • Members
  • 1 posts
  •  
    Germany

Posted 25 September 2011 - 02:48 PM

Pretty good tutorial, but missing something: where to use the files " SumatraPDF - Changes.txt ", " SumatraPDF.Install.reg " and " SumatraPDF.Uninstall.reg " to clean out your host computer? Thanks!
  • eDvArDo likes this

#4 eDvArDo

eDvArDo
  • Members
  • 5 posts
  •  
    Iran

Posted 05 June 2013 - 02:31 PM

Hi "Ostaad"

 

thank's.  ...is nice. How to use "PortableApp.com Launcher"? no need it?

 

"SHIRIN Group"  is Life  :good:

 

زنده باد استاد

 

eDvArDo  دوستدار هميشگي شما


Edited by eDvArDo, 05 June 2013 - 02:34 PM.

  • Shirin Zaban likes this




2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users