LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-19-2012, 06:28 AM   #1
Droa
Member
 
Registered: Oct 2011
Location: ~
Distribution: Debian 7
Posts: 60

Rep: Reputation: Disabled
one time, preinstall script as root


Hey Friends
i wonder if it is posable to make a script that only get runned once?

i am rolling out a linux trough PXE (FOG Project), and some drivers really messing up each time, however i found a way to install them easly preinstall.. however i want to make it automaticly, and wondered if there was a way to make a script run once as root?

i wanted to use the init.d or rc.d, but as i want to reboot the system, after the script is done, it would proberly mess up thouse daemons?

hope anyone can help, thanks
 
Old 03-19-2012, 06:30 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

You can use a script in /etc/init.d/ without problems, just include the command to 'deactivate' running it the next boot.

Kind regards,

Eric
 
Old 03-19-2012, 06:40 AM   #3
Droa
Member
 
Registered: Oct 2011
Location: ~
Distribution: Debian 7
Posts: 60

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by EricTRA View Post
Hello,

You can use a script in /etc/init.d/ without problems, just include the command to 'deactivate' running it the next boot.

Kind regards,

Eric
whould this work?

End of file
Code:
  # do stuff
  # my installscript for installing my Broadcom 80211 Card

  # remove itself
  rm /etc/init.d/wlinstall
  # restart
  init 6

Last edited by Droa; 03-19-2012 at 06:42 AM.
 
Old 03-19-2012, 06:50 AM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

Did you create the necessary symlink(s) to run the script in the correct runlevel with chkconfig/insserv/update-rc.d/other? If the script runs in the runlevel(s) you assigned it to, then it would work in my opinion. Best way to find out is to try.

Kind regards,

Eric
 
Old 03-19-2012, 07:05 AM   #5
Droa
Member
 
Registered: Oct 2011
Location: ~
Distribution: Debian 7
Posts: 60

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by EricTRA View Post
Hi,

Did you create the necessary symlink(s) to run the script in the correct runlevel with chkconfig/insserv/update-rc.d/other? If the script runs in the runlevel(s) you assigned it to, then it would work in my opinion. Best way to find out is to try.

Kind regards,

Eric
i am kinda of a newbie when it comes to doing changes to the init.d and rc.d
this is was i did so fare

1) created the file /etc/init.d/wlinstall
2) made a ln -s /etc/init.d/wlaninstall /etc/rc5.d/wlinstall

what do i need to do next, to make it run?

now i proberly need to add it and remove it?
 
Old 03-19-2012, 07:08 AM   #6
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

Did you make it executable also? If you created the symlink manually and the permission bits are set correctly then it should work. If you refer to add and remove by the use of commands like the ones I pointed to, then please specify what distribution and version you're using.

Kind regards,

Eric
 
Old 03-19-2012, 07:12 AM   #7
Droa
Member
 
Registered: Oct 2011
Location: ~
Distribution: Debian 7
Posts: 60

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by EricTRA View Post
Hi,

Did you make it executable also? If you created the symlink manually and the permission bits are set correctly then it should work. If you refer to add and remove by the use of commands like the ones I pointed to, then please specify what distribution and version you're using.

Kind regards,

Eric
well i only need to run the script once, and then it needs to be completly removed from the computer.. its a post-install script for when i have deployed the linux image to a new computer.. its a linux mint 12 LXDE 32Bit
 
Old 03-19-2012, 11:52 AM   #8
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
May be a little bit off topic here, but if this is a thing that you do constantly for many computers (I think so, otherwise the approach install wouldn't make much sense) wouldn't it be easier (and in my eyes more logical) to create a custom kernel package which already contains the necessary drivers instead of installing them afterwards? Or in case of FOG project (which seems to use an image based approach for installing the OS) to install the drivers first and then make the image?
 
Old 03-20-2012, 01:49 AM   #9
Droa
Member
 
Registered: Oct 2011
Location: ~
Distribution: Debian 7
Posts: 60

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TobiSGD View Post
May be a little bit off topic here, but if this is a thing that you do constantly for many computers (I think so, otherwise the approach install wouldn't make much sense) wouldn't it be easier (and in my eyes more logical) to create a custom kernel package which already contains the necessary drivers instead of installing them afterwards? Or in case of FOG project (which seems to use an image based approach for installing the OS) to install the drivers first and then make the image?
already tryed that.. but seems the drivers lock to the mac address.. and wont change.. so it keeps creating new netcards thats dosnt work.
i dont know how to change the mac-address it is locked to, so i need to install them each time

the drivers i am talking about is broadcom sta.. i used this script to install them.

Code:
#! /bin/bash
# Install the wifi drivers for Broadcom 4312 wifi
# Add contrib non-free to the app source list befor using - Note this may not
# be necessary on LMDE
############################################################################

## Update the list of available packages. Install the module-assistant and
##   wireless-tools packages:

   sudo aptitude update
   sudo aptitude -y install module-assistant wireless-tools

## Build and install a broadcom-sta-modules-* package for your system,
##   using Module-Assistant:

  sudo m-a --quiet --non-inter a-i broadcom-sta

## Rebuild your initial ramdisk, to blacklist modules defined at
##   /etc/modprobe.d/broadcom-sta-common.conf within initramfs:

  sudo update-initramfs -u -k $(uname -r)

## Unload conflicting modules:

  sudo modprobe -r b44 b43 b43legacy ssb
  sudo echo "blacklist b44" >> /etc/modprobe.d/blacklist.conf;
  sudo echo "blacklist b43" >> /etc/modprobe.d/blacklist.conf;
  sudo echo "blacklist b43legacy" >> /etc/modprobe.d/blacklist.conf;
  sudo echo "blacklist ssb" >> /etc/modprobe.d/blacklist.conf;  
  sudo echo "blacklist brcm80211">> /etc/modprobe.d/blacklist.conf;
  sudo echo "blacklist acer_wmi">> /etc/modprobe.d/blacklist.conf;

## Load the wl module:

  sudo modprobe wl

## Verify your device has an available interface:

  sudo iwconfig

## Configure your wireless interface as appropriate.

## At this point I don't think that the wl driver will load on startup so

sudo echo wl >> /etc/modules

#remove script from startup
sudo update-rc.d -f wlinstall remove
i had to blacklist alot of modules to get it to work on my lenovo ideapad s12
 
Old 03-20-2012, 07:28 AM   #10
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
I don't know much about Mint LXDE, but doesn't it contain the jockey program (known as "Additional Drivers" or "Restricted Drivers")? In that case a simple
Code:
jockey-text -e kmod:wl
should do all of that stuff for you.
 
Old 03-20-2012, 08:20 AM   #11
Droa
Member
 
Registered: Oct 2011
Location: ~
Distribution: Debian 7
Posts: 60

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TobiSGD View Post
I don't know much about Mint LXDE, but doesn't it contain the jockey program (known as "Additional Drivers" or "Restricted Drivers")? In that case a simple
Code:
jockey-text -e kmod:wl
should do all of that stuff for you.
The drivers didn't work, there is a hard switch, that jams, when I tried the restricted drivers :-(
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] preinstall Chapter 33 help spiky0011 Linux From Scratch 5 06-05-2011 01:30 PM
Is a script, run at boot time from init.d, run with root authority? tmbrwolf53 Linux - Server 2 03-31-2007 08:15 PM
Where is scrollkeeper-preinstall l0rddarkf0rce Slackware 1 11-17-2006 02:00 AM
Some preinstall questions nosix Linux - Newbie 4 09-10-2005 02:33 PM
5.4 preinstall question LivinLarge *BSD 9 06-04-2005 11:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration