WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Having a bit of an issue remastering with perl startup script  (Read 5266 times)

Offline initialhit

  • Newbie
  • *
  • Posts: 3
  • Lost much blood, it really is the bleeding edge!
Having a bit of an issue remastering with perl startup script
« on: November 24, 2014, 09:48:06 PM »
Greetings!
I've done a large amount of google fu work, looked on here, and obviously follow this guide: http://wiki.tinycorelinux.net/wiki:remastering

here's my bootlocal.sh (I know I don't have to indirectly call perl, but doing this so I can add bash system commands later)

Code: [Select]
#!/bin/sh
# put other system startup commands here
/opt/login.sh

here's login.pl ( a couple of scrubbed items)

Code: [Select]
#************************
# Written by Shades
# Description: This script simply pops open a firefox window for whitelisting, and
# once they close firefox, it will reboot them.
# This Script is built in such a way that it doesn't require any libraries to be
 brought in.
# Input / Output: None\

# Usage: Startup script to be put in rc.local, etc. on boot start.
# Version: 0.2.1
#************************

#---------
# Grab libraries needed that are included in base OS
#---------

use strict;

#---------
# Declare variables and set initial values
#---------

my $mac = `cat /sys/class/net/eth0/address` or die("Not a valid Linux system!");
 # Grab the mac from the mac file
my $url = 'https://internalwebsite/?mac=' . $mac;
my $statuslength = 10;
my $status = '';
my $verbose = 0; # Set to 1 if you want verbosity for troubleshooting

#--------
# Open Firefox and detect when it's done
#--------
system("firefox $url &") or die("Erroring running firefox command!");

# Commenting out the below until testing proves above will not move forward unti
l completed.
# Will be deperacated in version 0.3.0
#while ($statuslength > 2) {
# $status = `ps -eflno | grep -i firefox | grep -vi "grep"`;
# $statuslength = length($status); # Grab length of response, should be 1
if close for \n
# if ($verbose = 1) {
# # Output the verbose features here for this routine.
# print "Length of ps return: " . $statuslength;
# print "ps response: " . $status;
# }
# sleep 3; # To try and save on some memory / processing by sleeping for 3
 seconds.
#}

#--------
# Reboot system (into PXE?)
#--------
system("sudo reboot");

My issue is it throws this error after loading extensions:
Code: [Select]
mount: can't setup loop device: No space left on device
and  afterwards throws similar errors for each plugin. My perl script has been test on my normal TC box, and throws no errors / runs as expected when ran manually (not included in bootlocal.sh).  Any ideas as to why it does this when included in bootlocal.sh? Is it trying to run all these scripts before X startup? If so, how do I get it run automatically after X startup?  Cron spool file? Appreciate any help and hope the script gives ideas to any one else :)
>--------------------------------------------------<
Shades
*nix since 2002

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Having a bit of an issue remastering with perl startup script
« Reply #1 on: November 24, 2014, 10:00:06 PM »
bootlocal.sh runs in background, and may or may not finish before X starts, but it cannot access the X window anyway.
If you want it to run under X then you need to put it in ~/.X.d.

Offline initialhit

  • Newbie
  • *
  • Posts: 3
  • Lost much blood, it really is the bleeding edge!
Re: Having a bit of an issue remastering with perl startup script
« Reply #2 on: November 24, 2014, 10:05:13 PM »
 :P thanks for the quick reply, was afraid of that. Do I just drop the shell (perl maybe?) file in there?

I found out the issue was not  with my script anyways. Just unpacking and rebuilding the image according to the instructions given came up with the same result.  Curious if it's a ubuntu trying fishy things again.

UPDATE:
I realize this time it was an issue with permissions. This system is kind of finicky with permissions.

UPDATE2:
back to having the memory leak / loop issue from even normal unpack and repack with no mods. ugh.

« Last Edit: November 24, 2014, 10:57:09 PM by initialhit »
>--------------------------------------------------<
Shades
*nix since 2002

Offline initialhit

  • Newbie
  • *
  • Posts: 3
  • Lost much blood, it really is the bleeding edge!
Re: Having a bit of an issue remastering with perl startup script
« Reply #3 on: November 24, 2014, 10:14:08 PM »
bootlocal.sh runs in background, and may or may not finish before X starts, but it cannot access the X window anyway.
If you want it to run under X then you need to put it in ~/.X.d.

Can you point me to a good resource on this X script? Still need to get this thing running.
>--------------------------------------------------<
Shades
*nix since 2002

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Having a bit of an issue remastering with perl startup script
« Reply #4 on: November 24, 2014, 10:52:30 PM »