Porteus "GUIEXEC" start COMMAND ----- How to AutocopyFolder?

For discussions about programming and projects not necessarily associated with Porteus.
Post Reply
gregor001
Ronin
Ronin
Posts: 1
Joined: 03 Dec 2015, 09:47
Distribution: porteus
Location: Slovenia

Porteus "GUIEXEC" start COMMAND ----- How to AutocopyFolder?

Post#1 by gregor001 » 03 Dec 2015, 10:03

Maybe someone is EXCELLENT in programming because i am not so i ask for help here.

SETTINGS:
PORTEUS on a USB drive, Boot to RAM


PROBLEM:
I need a command for "GUIEXEC" which will
COPY FOLDER "TEST" from USB drive (DRIVE LETTER MAY BE DIFFERENT, is there any variable with this data set?) to
1)DRIVE "F:"
2)Desktop

I ask for any help

Thank you
Gregor

Bogomips
Full of knowledge
Full of knowledge
Posts: 2563
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Porteus "GUIEXEC" start COMMAND ----- How to AutocopyFol

Post#2 by Bogomips » 03 Dec 2015, 11:53

^ You are talking windoze, so we have to wait for Ed_P, the windoze transition guy, to help you. :Search:

Welcome to Porteus.
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

User avatar
Ed_P
Contributor
Contributor
Posts: 3405
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: Porteus "GUIEXEC" start COMMAND ----- How to AutocopyFol

Post#3 by Ed_P » 03 Dec 2015, 15:23

Bogomips wrote:^ You are talking windoze, so we have to wait for Ed_P, the windoze transition guy, to help you.
:) I don't think I qualify. gregor001 is look for someone "EXCELLENT in programming" which i think better fits you.

I'm afraid I have more questions than help for you Gregor.
gregor001 wrote:PROBLEM:
I need a command for "GUIEXEC" which will
What is "GUIEXEC"??
COPY FOLDER "TEST" from USB drive
The same USB drive Porteus is booted from?
to
1)DRIVE "F:"
2)Desktop
Is "DRIVE "F:"" another USB drive or a partition on a harddrive? And I assume "Desktop" refers to the Porteus desktop.

Is the version of Porteus you are working with the Kiosk version?
Ed

Bogomips
Full of knowledge
Full of knowledge
Posts: 2563
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Porteus "GUIEXEC" start COMMAND ----- How to AutocopyFol

Post#4 by Bogomips » 03 Dec 2015, 18:38

@Ed Think in mind is guiexec= bootcode. Was going to suggest a simple script (two-liner), but then when it got to drive F, out of depth. WinMe was when my hard drive gave out. IMHO you are better placed here.
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: Porteus "GUIEXEC" start COMMAND ----- How to AutocopyFol

Post#5 by Ahau » 03 Dec 2015, 19:01

Are you looking to do this on one computer (only) where it will always be the same USB drive and the same hard drive (assuming F:\ is a hard drive?) or do you need something that will work using multiple USB drives on multiple computers? This will be relatively straightforward if it's only for one USB drive (or if it is always from the same partition Porteus is booted from) and one hard drive, but I think it will require more gymnastics if this needs to be extensible to work across any hardware.

you will need a script placed in one of the folders in your $PATH, this script will do the work. Then you'll call the script with the guiexec= cheatcode.

For example, "copymyfiles" gets placed in /usr/bin and marked executable. Then you'll boot with "guiexec=copymyfiles" (no quotes in the actual line).

We can help you a bit with the script when we know more about what you're doing. I think you can use UUID's to find the correct drives if you will always be using the same drives. If not, you might need to use something like a signature file or some other trick to know that you're pointing to the right drive.
Please take a look at our online documentation, here. Suggestions are welcome!

User avatar
Ed_P
Contributor
Contributor
Posts: 3405
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: Porteus "GUIEXEC" start COMMAND ----- How to AutocopyFol

Post#6 by Ed_P » 04 Dec 2015, 06:09

OK, I think I understand this a little better at this point.

So, you make a script similar to this one to fit your needs:

copymyfolder.sh

Code: Select all

#!/bin/bash

BOOTDEV=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
folderTEST=$BOOTDEV/TEST
DriveF=/mnt/sda?/TEST      # <--- Change the ? to the drive number seen in Porteus file manager for hdd DRIVE F:

if [ ! -d "$DriveF/" ]; then
  mkdir $DriveF
fi

cp -u -v $folderTEST/*  $DriveF/
cp -u -v $folderTEST/*  /home/guest/Desktop/
And to make the script executable run this command for it:

chmod +x copymyfolder.sh
Ed

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: Porteus "GUIEXEC" start COMMAND ----- How to AutocopyFol

Post#7 by Ahau » 04 Dec 2015, 07:12

Yep. And if his hard drive and/or flash drive will remain the same physical piece of hardware but might change letters (sdb instead of sda, etc) you can query the uuid out of blkid:

Code: Select all

#must be set manually by user
BOOTUUID=ba155345-b858-4c96-9e21-13ba3ce84708

BOOTDEV=`blkid|grep $BOOTUUID|cut -d ':' -f1|cut -d '/' -f3`
folderTEST=/mnt/$BOOTDEV/TEST
Please take a look at our online documentation, here. Suggestions are welcome!

User avatar
Ed_P
Contributor
Contributor
Posts: 3405
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: Porteus "GUIEXEC" start COMMAND ----- How to AutocopyFol

Post#8 by Ed_P » 04 Dec 2015, 15:31

Actually querying the F: drive's Volume Label might offer more flexibility.

Code: Select all

#!/bin/bash

#  must be set manually by user
drvFvlabel="???????????"                          # <----- Unique Volume Label of the DRIVE F: 

BOOTDEV=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
folderTEST=$BOOTDEV/TEST

DriveF=`blkid | greg "$drvFvlabel"`
DriveF=/mnt/${DriveF:5:4}/TEST

if [ ! -d "$DriveF/" ]; then
  mkdir $DriveF
fi

cp -u -v $folderTEST/*  $DriveF/
cp -u -v $folderTEST/*  /home/guest/Desktop/
Ed

User avatar
brokenman
Site Admin
Site Admin
Posts: 5652
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: Porteus "GUIEXEC" start COMMAND ----- How to AutocopyFol

Post#9 by brokenman » 05 Dec 2015, 02:08

Actually querying the F: drive's Volume Label might offer more flexibility.
If you are looking for a universal solution then UUID is the way to go. I have 15 partitions but blkid doesn't show a LABEL for all of them. Some have PARTLABEL set and some have LABEL set and others have nothing. UUID will remain constant even when other devices are added and drive letters are bumped.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 3405
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: Porteus "GUIEXEC" start COMMAND ----- How to AutocopyFol

Post#10 by Ed_P » 05 Dec 2015, 05:05

brokenman wrote:If you are looking for a universal solution then UUID is the way to go. I have 15 partitions but blkid doesn't show a LABEL for all of them.
Wow. I have a machine like that, partitions/drives C: - P:. I will have to try Porteus on it and see what blkid shows on it. All have volume labels under Windows.
UUID will remain constant even when other devices are added and drive letters are bumped.
I understand, and agree, but many new Porteus users may not relate to UUIDs. And there is no confirmation that this script will be run on a single machine.
Ed

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: Porteus "GUIEXEC" start COMMAND ----- How to AutocopyFol

Post#11 by Ahau » 05 Dec 2015, 07:30

Yes, UUID is a foreign concept, especially for someone coming from Windows. Like brokenman, I have several partitions without labels on them.

Here, we're looking at one script for one person's specific task, and I think UUID can be reasonably explained for that purpose. Another way to approach this would be to have the user place uniquely named files on the target drives and build the script to search for those. Porteus (and Slax before it, for that matter), use an .sgn, or "signature" file for this purpose to help locate the porteus data.

For example, the user would place a file at /mnt/sdb2/data/test/copyhere.sgn and /mnt/sdc1/home/Ahau/pastehere.sgn. The script would then search all mounted drives for the sgn file and when it finds the sgn file, it sets that as the target drive.

This requires a little more scripting and the clutter of the sgn files, but you could set it up so that it would work on several flash drives and several hard drives.
Please take a look at our online documentation, here. Suggestions are welcome!

Post Reply