Page 1 of 1

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

Posted: 03 Dec 2015, 10:03
by gregor001
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

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

Posted: 03 Dec 2015, 11:53
by Bogomips
^ You are talking windoze, so we have to wait for Ed_P, the windoze transition guy, to help you. :Search:

Welcome to Porteus.

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

Posted: 03 Dec 2015, 15:23
by Ed_P
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?

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

Posted: 03 Dec 2015, 18:38
by Bogomips
@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.

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

Posted: 03 Dec 2015, 19:01
by Ahau
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.

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

Posted: 04 Dec 2015, 06:09
by Ed_P
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

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

Posted: 04 Dec 2015, 07:12
by Ahau
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

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

Posted: 04 Dec 2015, 15:31
by Ed_P
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/

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

Posted: 05 Dec 2015, 02:08
by brokenman
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.

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

Posted: 05 Dec 2015, 05:05
by Ed_P
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.

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

Posted: 05 Dec 2015, 07:30
by Ahau
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.