Page 1 of 2

What am I missing??? [Solved]

Posted: 29 Dec 2014, 21:58
by Ed_P
I know my eye sight is going, and probably too my mind :( , but I don't see why this doesn't work.

I have 2 scripts. one a clone of the other. In them I have this piece of code:

Code: Select all

if [ `whoami` != "root" ]; then
    redpswd "Enter root's password"
    su -c "sh $0 $1"
    exit
fi
echo $rst

When I run one script I get:

Code: Select all

guest@porteus:~$ savedatremoveafile.sh
Enter root's password 
Password: 

Enter name of file to remove.

When I run the 2nd one I get:

Code: Select all

guest@porteus:~$ savedatspaceused.sh
./savedatspaceused.sh: line 22: unexpected EOF while looking for matching ``'
./savedatspaceused.sh: line 84: syntax error: unexpected end of file
guest@porteus:~$ 
Line 22 is the top line.

Now some will think the problem is due to lines before line 22, so here are lines 1-22 of the script with the error:

Code: Select all

#!/bin/sh
#  http://forum.porteus.org/viewtopic.php?f=81&t=1941&start=15#p13272
#  http://forum.porteus.org/viewtopic.php?f=117&t=3205&p=25099#p25097

#  mloop requires changes= cheatcodes not used (Always Fresh mode)

BOOTDEV=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
VERSION=$(cat /etc/porteus-version)
FOLDER=porteus${VERSION:9:3}
GUEST="$BOOTDEV/$FOLDER/Guest"
MODULES="$BOOTDEV/$FOLDER/Modules"`

# Color definitions
txtbld=$(tput bold)               # Bold
txtred=${txtbld}$(tput setaf 1)   # Red
rst=$(tput sgr0)                  # Reset

function redpswd() {
echo -e "$1" $txtred  
}

if [ `whoami` != "root" ]; then
    redpswd "Enter root's password"
    su -c "sh $0 $1"
    exit
fi
echo $rst
And the similar group from the script that works:

Code: Select all

#!/bin/sh 
# http://forum.porteus.org/viewtopic.php?f=81&t=3501&p=25182#p25178
# http://forum.porteus.org/viewtopic.php?f=81&t=3501&p=25151#p25162
# http://forum.porteus.org/viewtopic.php?f=81&t=3501&p=25151#p25178

# mloop requires changes= cheatcodes not be used (Always Fresh mode)

BOOTDEV=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
VERSION=$(cat /etc/porteus-version)
FOLDER=porteus${VERSION:9:3}
GUEST="$BOOTDEV/$FOLDER/Guest"
MODULES="$BOOTDEV/$FOLDER/Modules"

# Color definitions
txtbld=$(tput bold)               # Bold
txtred=${txtbld}$(tput setaf 1)   # Red
rst=$(tput sgr0)                  # Reset

function redpswd() {
echo -e "$1" $txtred  
}

if [ `whoami` != "root" ]; then
    redpswd "Enter root's password"
    su -c "sh $0 $1"
    exit
fi
echo $rst
As said the scripts are clones.

And for the concern as to the working script's name, it is only used to fix deleted files whose name contains a blank.

The script with the error has worked in the past and I was surprised to encounter the error today, which adds to my confusion.

Re: What am I missing???

Posted: 29 Dec 2014, 23:05
by Bogomips
Message does not seem to make sense: line 22: unexpected EOF while looking for matching ``'

End bit: ``'

Re: What am I missing???

Posted: 30 Dec 2014, 06:46
by Ed_P
Bogomips wrote:Message does not seem to make sense:
I know!!
phhpro wrote:Any chance you copy/pasted the file? /quote]
No, I opened the original and changed it to make the clone. And I have several that start similarly.
This single quote ` is not equal to this '
Where are you seeing this????

Re: What am I missing???

Posted: 30 Dec 2014, 13:51
by wread
You made a typo: it reads redpswd, shouldn' t it be readpswd?

Re: What am I missing???

Posted: 30 Dec 2014, 14:54
by Bogomips
Ed, if you are not using an editor with shell script highlighting, it might pay to use one like kwrite, which could then point out, what might have gone amiss.

Re: What am I missing???

Posted: 30 Dec 2014, 17:25
by Ed_P
FOUND IT!!! :Yahoo!:

In the script not working it had, on line 11 not line 22, :

Code: Select all

MODULES="$BOOTDEV/$FOLDER/Modules"`
rather than

Code: Select all

MODULES="$BOOTDEV/$FOLDER/Modules"
How that trailing character got there I have NO idea. How I missed it is easy, it looks like a spec of DUST on my screen.

Thanks for your help guys, I appreciate it. :friends:

BTW "redpswd" is for setting the password prompt red, not reading the password. :) And I will look into getting kwrite.

Thanks again. :beer:

Re: What am I missing???

Posted: 30 Dec 2014, 22:37
by Bogomips
Ed_P wrote:And I will look into getting kwrite.
Kwrite is stock KDE. Just switch desktops. Need 003-kde.xzm in porteus/optional, then restart with noload=razorqt load=3-kde, the (quick and dirty?) way I'm doing it at the moment, but then am running always fresh.

Re: What am I missing??? [Solved]

Posted: 31 Dec 2014, 07:22
by Ed_P
Thanks Bogomips. I tried switchin to KDE to try it but failed. I keep getting an xterm error about not finding a font. The noload option is working the problem is with the load cheatcode.

Code: Select all

title Porteus 3.0.1 extramod= KDE \n213MB\n %ISO30% 
find --set-root                       /ISOs/%ISO30%
map --heads=0 --sectors-per-track=0   /ISOs/%ISO30% (0xff) 
map --hook
root (0xff)
kernel /boot/syslinux/vmlinuz    from=/ISOs/%ISO30% extramod=/porteus3.0/Modules;/porteus3.0/modsavedat volume=33 noload=razor load=/porteus3.0/Optional/kde
initrd /boot/syslinux/initrd.xz
And

Code: Select all

set ISO30=Porteus-RazorQT-v3.0.1-x86_64.iso
And

Code: Select all

guest@porteus:~$ ls -ghlst /mnt/sda5/porteus3.0/Optional/
total 252M
68M -rwxrwxrwx 1 root 68M Nov  4 19:27 003-kde.xzm*
73M -rwxrwxrwx 2 root 73M Nov  4 19:16 003-razor.xzm*
21M -rwxrwxrwx 1 root 21M Jul  8 20:20 003-lxde.xzm*
27M -rwxrwxrwx 1 root 27M Jun 29 18:51 003-xfce.xzm*
66M -rwxrwxrwx 1 root 66M Jun 28 09:28 003-mate.xzm*
guest@porteus:~$ 

Re: What am I missing??? [Solved]

Posted: 31 Dec 2014, 12:12
by Bogomips
Ed, try load=3-kde as suggested ;)

Re: What am I missing??? [Solved]

Posted: 31 Dec 2014, 16:32
by Ed_P
Oh I tried that and numerous other variations all with the same result. I suspect the load cheatcode doesn't like my location for the alternate desktops. I suppose I could put them all in my Modules directory and then use only the noload cheatcode. noload=razor;lxde;mate;etc. to select one.

And I did read the documentation on the use of the load= cheatcode on Cheatcodes - what they are and how to use them Image

Re: What am I missing??? [Solved]

Posted: 31 Dec 2014, 17:06
by Bogomips
Ed_P wrote:I suspect the load cheatcode doesn't like my location for the alternate desktops.
Works for me with porteus/optional. All lower case. Don't know if porteus3.0/modules would work. If it does, then porteus3.0/optional should work.

Re: What am I missing??? [Solved]

Posted: 31 Dec 2014, 18:06
by Ed_P
Bogomips wrote: Don't know if porteus3.0/modules would work. If it does, then porteus3.0/optional should work.
It doesn't which is why I use the capital M. I suspect the same applies for "optional".

See http://forum.porteus.org/viewtopic.php? ... les#p28494.

Re: What am I missing??? [Solved]

Posted: 31 Dec 2014, 18:40
by Bogomips
load=module
load=module[1];module[n]

... Load optional modules from /optional/ directory on the booting
media. Additional modules can be listed, separated
by semicolons, without spaces.
Exampe: 'load=gimp;inkscape' would search for and load any
modules in the /porteus/optional folder that contain the strings
'gimp' or 'inkscape'.
Looks like this will only work if you have a /porteus/optional available. If you can't then it's worth trying
Ed_P wrote: noload=razor;lxde;mate;etc. to select one.
and not getting sidetracked. :Search:

Re: What am I missing??? [Solved]

Posted: 05 Jan 2015, 17:46
by Bogomips
Ed, been mulling over your problem, tried a different approach, and see no reason why it should not work in your case.
  • Boot into text mode

    Code: Select all

    guest@porteus:~$ dmesg|grep command
    [    0.000000] Kernel command line: quiet copy2ram ramsize=30% noauto timezone=Europe/London volume=60% noload=xorg;kde autoexec=telinit-3
    
    Got landed in xterm when using just: noload=kde and autoexec=telinit-3, although according to that link, the only pertinent link turning up in search, it should have been Runlevel 3.
    • Then as root

      Code: Select all

      # init 3
      # activate /<Path to>/002-xorg.xzm
      # activate /<Path to>/003-mate.xzm
      # init 4
      
      loop0     7:0    0    16M  0 loop /mnt/live/memory/images/000-kernel.xzm
      loop1     7:1    0    46M  0 loop /mnt/live/memory/images/001-core.xzm
      loop2     7:2    0     4K  0 loop /mnt/live/memory/images/0099-settings.xzm
      loop3     7:3    0  29.2M  0 loop /mnt/live/memory/images/nVidia-304.123-porteus
      loop4     7:4    0   528K  0 loop /mnt/live/memory/images/sudo-1.8.9p5-i486-1.xz
      loop5     7:5    0  43.7M  1 loop /mnt/live/memory/images/002-xorg.xzm
      loop6     7:6    0  56.5M  1 loop /mnt/live/memory/images/003-mate.xzm
      

    Re: What am I missing??? [Solved]

    Posted: 05 Jan 2015, 18:16
    by fanthom
    @Bogomips
    you have mixed up 'autoexec=' with 'cliexec=' :wink:
    please refer to chetcodes.txt when in doubts.