Forum
« Syntax help with unzip on 7z please. »

Welcome Guest. Please Login or Register.
May 24, 2013, 5:55am



Return to or visit the SalineOS webpage

Forum :: General :: Software and Applications :: Syntax help with unzip on 7z please.
Page 1 of 4 » Jump to page   Go    [Search This Thread] [Share Topic] [Print]
 AuthorTopic: Syntax help with unzip on 7z please. (Read 808 times)
ukbrian
Senior Member
****
member is offline





Joined: Aug 2011
Gender: Male
Posts: 285
 Syntax help with unzip on 7z please.
« Thread Started on Jan 6, 2012, 12:25pm »

I'm trying to do a script to unzip a folder when a CD first boots ::)
Quote:
#!/bin/sh
unzip -f /home/user/ukbrian.zip
I've tried -x but no luck and manuals don't speak my language :(
I would much prefer to use .7z files as they get much, much greater compression than anything else I know of.

Edit
Is there any folder to put the script so it runs earlier than the ~/.config/autostart dir
« Last Edit: Jan 6, 2012, 12:45pm by ukbrian »Link to Post - Back to Top  IP: Logged
petrek
Senior Member
****
member is offline

[avatar]



Joined: Aug 2011
Gender: Male
Posts: 386
Location: Poland
 Re: Syntax help with unzip on 7z please.
« Reply #1 on Jan 6, 2012, 1:19pm »

What are you trying to do exactly? You run unzip only with path to file to extract it.

Code:
unzip /pathto/yourfile.zip
Link to Post - Back to Top  IP: Logged

Skallagrigg
Richard
Elder Member
*****
member is offline

[avatar]



Joined: Jan 2011
Gender: Male
Posts: 593
Location: Venezuela
 Re: Syntax help with unzip on 7z please.
« Reply #2 on Jan 6, 2012, 2:03pm »

Hey UK,

Try this:
Code:
$ 7z
Link to Post - Back to Top  IP: Logged

SalineOS-1.7, Xfce4.6.2, w/3.2.0-0.bpo.4-686-pae;
SalineOS-2.0, Xfce4.8, w/3.2.0-4-686-pae
LinuxMint-14, Xfce4.10, w/3.5.0-17-generic
ukbrian
Senior Member
****
member is offline





Joined: Aug 2011
Gender: Male
Posts: 285
 Re: Syntax help with unzip on 7z please.
« Reply #3 on Jan 6, 2012, 2:50pm »

I'm not succeeding and I've decided the best thing to do
is make a short video of what i'm trying to do and that will be a lot
more informative than me typing words.

Thank you for trying to help a 69 year old who spent his
working life in the building trade as a roofing contractor.
Link to Post - Back to Top  IP: Logged
Richard
Elder Member
*****
member is offline

[avatar]



Joined: Jan 2011
Gender: Male
Posts: 593
Location: Venezuela
 Re: Syntax help with unzip on 7z please.
« Reply #4 on Jan 6, 2012, 2:55pm »

if you have p7zip installed,
Code:
$ 7z -f /home/user/ukbrian.zip

should unzip ukbrian.zip

[-e without paths, -f with paths]

We didn't have computers in school.
Didn't know what computers were.
Is that why this is more fun today?
« Last Edit: Jan 6, 2012, 2:58pm by Richard »Link to Post - Back to Top  IP: Logged

SalineOS-1.7, Xfce4.6.2, w/3.2.0-0.bpo.4-686-pae;
SalineOS-2.0, Xfce4.8, w/3.2.0-4-686-pae
LinuxMint-14, Xfce4.10, w/3.5.0-17-generic
beardedragon
Global Moderator
*****
member is offline

[avatar]



Joined: Feb 2011
Gender: Male
Posts: 858
 Re: Syntax help with unzip on 7z please.
« Reply #5 on Jan 6, 2012, 4:06pm »

How about a right click on ukbrian.zip, then, Extract here or to: Does that give you a choice?
Link to Post - Back to Top  IP: Logged

Robert Collard, Madison, WI
HP s5710f, 2x AMD Athlon II 260@3.2Ghz 3GB RAM, 640GB HD
Debian 7.0 XFCE-4.10 3.2.0-4-amd64

If you are satisfied with the results, please Edit your first post and add [Solved] to the Subject line.
ukbrian
Senior Member
****
member is offline





Joined: Aug 2011
Gender: Male
Posts: 285
 Re: Syntax help with unzip on 7z please.
« Reply #6 on Jan 6, 2012, 8:47pm »

I've made a video but unfortunately it ended up 10 minutes long at 199 MB but 7zip got that down to 40 MB.

I get a bit lost sometimes but I think I covered everything, just a bit tired at the moment.
http://lin.me.uk/help/problem-01.mp4.7z

I'm wondering if it's possible to zip up other parts of the OS to reduce the CD size and then unpack when the OS boots, maybe I'm crazy.

Everything I do i expect is very crude but if anyone knows a more elegant way please feel free.

It's 2 in the morning so i might go to bed soon
once again thank you for helping an old fool.
[image]
Link to Post - Back to Top  IP: Logged
Anthony Nordquist
Administrator
*****
member is offline




[homepage]

Joined: Dec 2010
Gender: Male
Posts: 1,338
 Re: Syntax help with unzip on 7z please.
« Reply #7 on Jan 6, 2012, 9:21pm »

Doing it after X starts wouldn't be too hard, just create a script and tell Xfce to run it Xfce4 Settings Manager > Sessions and Startup > Application Autostart. For the command on the autostart I would do this:

gksu "exec /usr/bin/xfce4-terminal -H -x /path/to/script/script-name" (Leave gksu off if you don't need root)

You can follow this guide somewhat http://www.debian-administration.org/articles/28 Keep in mind there would be more bash scripting involved.
Link to Post - Back to Top  IP: Logged
Richard
Elder Member
*****
member is offline

[avatar]



Joined: Jan 2011
Gender: Male
Posts: 593
Location: Venezuela
 Re: Syntax help with unzip on 7z please.
« Reply #8 on Jan 6, 2012, 9:46pm »

@UKBrian,
Maybe cfdisk, the CLI partition manger might do better for this?
GUI things don't always lend themselves to non-interactive operations.
Link to Post - Back to Top  IP: Logged

SalineOS-1.7, Xfce4.6.2, w/3.2.0-0.bpo.4-686-pae;
SalineOS-2.0, Xfce4.8, w/3.2.0-4-686-pae
LinuxMint-14, Xfce4.10, w/3.5.0-17-generic
petrek
Senior Member
****
member is offline

[avatar]



Joined: Aug 2011
Gender: Male
Posts: 386
Location: Poland
 Re: Syntax help with unzip on 7z please.
« Reply #9 on Jan 7, 2012, 12:18am »

It's perfectly reasonable, there are CD filesystems, that exactly do that. Knoppix is working this way, it uses squashfs (at least it used when I last checked, but that was quite time ago). Is this thread connected with qt-fsarchiver? Maybe after watching your video my mind will become more clear :)
Link to Post - Back to Top  IP: Logged

Skallagrigg
ukbrian
Senior Member
****
member is offline





Joined: Aug 2011
Gender: Male
Posts: 285
 Re: Syntax help with unzip on 7z please.
« Reply #10 on Jan 7, 2012, 9:01am »


Quote:
Is this thread connected with qt-fsarchiver?
Sorry, I got side tracked, to clarify.
Problem 1
I think qt4-restore CD does all that is required of it. The only thing I'd like to change is the hard coding in the /home/user/xfce-menus/desktop.menu file which doesn't matter in the CD as it's not for installing.
Quote:
<AppDir>/home/user/xfce-menus/applications/</AppDir>
<DefaultDirectoryDirs/>
<DefaultMergeDirs/>
If the red text could be replaced with "~/" or "$HOME" or some alias it would mean that any end user unzipping the xfce-menus folder into their user folder and then creating a new menu launcher in their panel could point at the "/home/user/xfce-menus/desktop.menu" file and would then have my custom menu on their panel. I'm trying to make these menus portable I guess.

If this can be achieved with the .menu file then the same method can be used in the .desktop files to point at their icons.

Problem 2 is the unzip business which isn't urgent as the qt4-fsarchiver already fits on a CD

I think the qt4-fsarchiver iso you downloaded was 705 MB when remastersys'ed but I tried another snapshot script and that got the snapshot down to 647 MB so I removed midori and put firefox on instead but with firefox and a firefox profile the size went up to 714 MB. :'(

I put the firefox app and profile in the folder "ukbrian" and when I zipped up the folder before doing a snapshot I got the size back down to 700 MB. :) hence my interest in
unzipping the folder on the fly while the system boots

I've been playing with another menuing approach as well and it just amazes me why mozilla don't use it for their default firefox profile.

If you want a bit of fun for a moment, maybe Anthony will smile again, Sorry the profile is not quite right, I'll redo the link when i've uploaded a new profile
download and unzip this folder "ukbrian" into your home

Create a profile in firefox/iceweasel with
Quote:
firefox -P
and point it at
Quote:
/home/user/ukbrian/firefox/profiles/menus
If you don't have firefox or iceweasel on your machine there's a copy of firefox in the firefox dir
Quote:
/home/user/ukbrian/firefox


I'm using Josep Del Rio's Speed Dial extension to create a menuing system that I think has promse. :-X There is no other Speed Dial version that comes anywhere near what Josep has done.

I've got into a long rambling post again, I'd better go and hide
« Last Edit: Jan 7, 2012, 9:57am by ukbrian »Link to Post - Back to Top  IP: Logged
petrek
Senior Member
****
member is offline

[avatar]



Joined: Aug 2011
Gender: Male
Posts: 386
Location: Poland
 Re: Syntax help with unzip on 7z please.
« Reply #11 on Jan 7, 2012, 11:18am »

In quote you're writing about /home/user/xfce-menus but you don't have /home/user/xfce-menus nor /home/user/ukbrian/xfce-menus in your system, maybe that's a reason?

To unzip you must have exec before unzip and -f is not needed

Code:
#!/bin/sh
exec unzip /home/user/ukbrian.zip


It will be good to tell unzip where to unzip files, independent from where it was started, with option, example: unzip /home/user/ukbrian.zip -d $HOME/xfce-menus otherwise everything will be in vain, if user extracted somewhere else than you expected. And first check if user have unzip, if not use other program, and if failed to find any be verbose that it can't be extracted and about lack of needed program. Let the fun be with you! ;)

and -v mode is better to resolve problems than hiding ;)
« Last Edit: Jan 7, 2012, 11:39am by petrek »Link to Post - Back to Top  IP: Logged

Skallagrigg
ukbrian
Senior Member
****
member is offline





Joined: Aug 2011
Gender: Male
Posts: 285
 Re: Syntax help with unzip on 7z please.
« Reply #12 on Jan 7, 2012, 1:10pm »

That exec did it now I can unzip them on boot up. thank you petrik :)

That was a good link Anthony but a bit above my abilities.
I put the unzip script in /etc/init.d and then did this and got an error
Quote:
root@saline:~# chmod 755 /etc/init.d/unzip-ukbrian.sh
root@saline:~# update-rc.d unzip-ukbrian.sh defaults
update-rc.d: using dependency based boot sequencing
insserv: warning: script 'unzip-ukbrian.sh' missing LSB tags and overrides
root@saline:~#
But no hurry I think I need a break for a bit. :-*
Link to Post - Back to Top  IP: Logged
petrek
Senior Member
****
member is offline

[avatar]



Joined: Aug 2011
Gender: Male
Posts: 386
Location: Poland
 Re: Syntax help with unzip on 7z please.
« Reply #13 on Jan 7, 2012, 1:35pm »

You need to put more things to that script, I think. And create proper symbolic link for yourself, only in one runlevel. Also, I would add some things to that script to go around this /home/user issue in the menu. You can do that in two ways, install it somewhere else, not in home directory, or change the files after unzip to contain the proper path.
« Last Edit: Jan 7, 2012, 1:56pm by petrek »Link to Post - Back to Top  IP: Logged

Skallagrigg
ukbrian
Senior Member
****
member is offline





Joined: Aug 2011
Gender: Male
Posts: 285
 Re: Syntax help with unzip on 7z please.
« Reply #14 on Jan 7, 2012, 2:08pm »


Jan 6, 2012, 2:55pm, Richard wrote:
if you have p7zip installed,
Code:
$ 7z -f /home/user/ukbrian.zip
should unzip ukbrian.zip
[-e without paths, -f with paths]
I have .zip files unzipping now thanks to petrik but no luck with the .7z files.
I've tried
Code:
7z /home/user/ukbrian.7z
exec 7z /home/user/ukbrian.7z
exec $ 7z /home/user/ukbrian.7z
[/code]all good fun but without success


Quote:
We didn't have computers in school.Didn't know what computers were.
Is that why this is more fun today?
I started in the dos days so I've watched the OS's evolve but very little has been done with the desktop, it's just been used for graffitti or decorations so I think shell and unity might well develop into something worth while, I think the tree menu will always be there but not for most users.

I'm going on again :-[,
Link to Post - Back to Top  IP: Logged
Page 1 of 4 » Jump to page   Go    [Search This Thread] [Share Topic] [Print]



Anthony Nordquist, on behalf of the SalineOS project, is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com. As such, if you click the above banner and then make any purchase including digital downloads, a small percentage will be paid to the SalineOS project.
Click Here To Make This Board Ad-Free


This Board Hosted For FREE By ProBoards
Get Your Own Free Message Boards & Free Forums!
Terms of Service | Privacy Policy | Notice | FTC Disclosure | Report Abuse | Mobile