2 Copyright © 2003, 2009, The AROS Development Team. All rights reserved.
6 /******************************************************************************
22 Command to unpack/unarchive AROS .pkg files.
26 NAME - The name of the file to unpack.
27 TO – The drive or path to be unpacked.
32 Standard DOS error codes.
36 This command is not a tool like lha, lzx or unzip.
37 The .pkg files may be created with the python program
38 in tools/package/pkg and compressed with bzip2 afterwards.
43 Unpack AROS.pkg TO Ram:
53 04.05.2000 SDuvan implemented
55 ******************************************************************************/
58 #include <dos/rdargs.h>
59 #include <proto/exec.h>
60 #include <proto/dos.h>
62 #define SH_GLOBAL_DOSBASE 1
63 #define SH_GLOBAL_SYSBASE 1
65 #include <aros/shcommands.h>
71 struct IntuitionBase
*IntuitionBase
;
72 struct GfxBase
*GfxBase
;
77 AROS_SHA( STRPTR
, , FILE, /A
, NULL
),
78 AROS_SHA( STRPTR
, , TO
, /A
, NULL
)
87 if( SHArg(FILE) == NULL
) goto cleanup
;
88 if( SHArg(TO
) == NULL
) goto cleanup
;
90 IntuitionBase
= (struct IntuitionBase
*)OpenLibrary( "intuition.library", 0 );
91 GfxBase
= (struct GfxBase
*)OpenLibrary( "graphics.library", 0 );
93 //Printf( "%s, %s\n", SHArg(FILE), SHArg(TO) );
95 pkg
= PKG_Open( SHArg(FILE), MODE_READ
);
96 if( pkg
== NULL
) goto cleanup
;
98 newDir
= Lock( SHArg(TO
), SHARED_LOCK
);
99 if( newDir
== NULL
) goto cleanup
;
100 oldDir
= CurrentDir( newDir
);
102 if( !GUI_Open() ) goto cleanup
;
104 PKG_ExtractEverything( pkg
);
109 if( oldDir
!= NULL
) CurrentDir( oldDir
);
110 if( newDir
!= NULL
) UnLock( newDir
);
111 if( pkg
!= NULL
) PKG_Close( pkg
);
113 if( IntuitionBase
!= NULL
) CloseLibrary( (struct Library
*) IntuitionBase
);
114 if( GfxBase
!= NULL
) CloseLibrary( (struct Library
*) GfxBase
);