Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
how to copy script with ssh in chroot-ed directory?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
neptune3nl
n00b
n00b


Joined: 31 Mar 2004
Posts: 26

PostPosted: Sat May 29, 2004 6:47 pm    Post subject: how to copy script with ssh in chroot-ed directory? Reply with quote

I wrote 2 install scripts. I copy them over with ssh after booting my gentoo system with the livecd.
The first script goes till the chroot command.
Then, the second script should run but I can't make it to work.
How to go on with this?
Back to top
View user's profile Send private message
andrewy
l33t
l33t


Joined: 07 Apr 2004
Posts: 602

PostPosted: Sat May 29, 2004 7:38 pm    Post subject: Reply with quote

Explain what you're trying to do better, I don't understand what you're asking.
Back to top
View user's profile Send private message
neptune3nl
n00b
n00b


Joined: 31 Mar 2004
Posts: 26

PostPosted: Sat May 29, 2004 7:42 pm    Post subject: Reply with quote

here is my first script:
mke2fs /dev/hda1
mkswap /dev/hda2
swapon /dev/hda2
mke2fs -j /dev/hda3 # or:
# mkreiserfs /dev/hda3 < echo y
# reboot

echo # (Mount the root partition)
mount /dev/hda3 /mnt/gentoo
echo # (Create the boot mountpoint)
mkdir /mnt/gentoo/boot
echo # (Mount the boot partition)
mount /dev/hda1 /mnt/gentoo/boot
echo # (Go to the mountpoint)
mkdir /mnt/gentoo/proc
mount -t proc none /mnt/gentoo/proc

cd /mnt/gentoo
# (Extract a stage tarball... This will take some moments:
# ls /mnt/cdrom/stages
# For GRP, use stage3-tarball
#
tar -xvjpf /mnt/cdrom/stages/stage3-pentium4-20040218.tar.bz2
wait
# (or download the latest tarball...)
# lynx http://www.gentoo.org/main/en/mirrors.xml
# ( ... and extract)
# tar -xvjpf stage*

# (Optional: unpack a portage tree. This will take some moments:

echo "Unpack portage tree..."
tar -xvjf /mnt/cdrom/snapshots/portage-20040223.tar.bz2 -C /mnt/gentoo/usr
wait
# (Optional: copy over distfiles)
echo "Copy over distfiles."
cp -R /mnt/cdrom/distfiles /mnt/gentoo/usr/portage/distfiles
wait
# Optional: Copy packages from CD2. You can also do this at the end of the install (see below)
# cp -a /mnt/cdrom/packages /mnt/gentoo/usr/portage/packages
# (Select a mirror)

echo "Select a mirror automatically..."
mirrorselect -a -s4 -o >> /mnt/gentoo/etc/make.conf
echo "Copy over nameserver information "

cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
wait
echo # "Chroot into the new environment "
# chroot /mnt/gentoo /bin/bash
# OR:

cp ginstall2.sh /mnt/gentoo
chroot /mnt/gentoo


then, my second script some here.
However, after the last 2 lines of the firstscript I get this:
cp: cannot stat 'ginstall2.sh': No such file or directory
bash-2.05b#

(ginstall2.sh = my second install script whe I put the commands to be run after chroot.
Back to top
View user's profile Send private message
andrewy
l33t
l33t


Joined: 07 Apr 2004
Posts: 602

PostPosted: Sat May 29, 2004 7:44 pm    Post subject: Reply with quote

Try using the full path to ginstall2.sh in the script.
Back to top
View user's profile Send private message
neptune3nl
n00b
n00b


Joined: 31 Mar 2004
Posts: 26

PostPosted: Sat May 29, 2004 8:05 pm    Post subject: Reply with quote

I also tried to put :
chroot /mnt/gentoo /gen_install/ginstall2.sh
but then it comes up with the same error.
I thought this was right after I got this info from another script which I found on this forum (gensys).
Because the installation after chroot takes most of the time, i would like to do this with a script, including generating the conf-files for me as well.
By the way, here is my second script:

# # #

# Marcel's Installation script voor Gentoo
#

# **********************************************
# ginstall2.sh
# **********************************************

# "Load the necessary variables "

echo "Going to ginstall2.sh
# call ginstall2.sh


source /etc/profile

# (Network-only, non-GRP: update Portage)
# This will take a while!
# When using GRP-installation, ignore emerge sync

# update Portage
emerge --usepkg mirrorselect
mirrorselect -a -s3
emerge sync
# # # Code Listing 1.3: Installing Gentoo
# Stage1 and Stage2:
# (Change USE, CFLAGS and CXXFLAGS. Stage1 can also change CHOST)
# For stage3, all is already OK!
nano -w /etc/make.conf
# (Stage1 only: bootstrap system)
# cd /usr/portage; scripts/bootstrap.sh
# (Stage1, Stage2 only: install base system)
# emerge system

# Stage 3:
# Optional to make Stage3 up-to-date:
# 1 maak backup van /etc/make.conf
# 2 doe: CONFIG_PROTECT="-*" emerge -u system
# 3 zet backup weer terug:
cp /etc/make.conf /etc/make.conf.org
CONFIG_PROTECT="-*" emerge -u system
wait
cp /etc/make.conf.org /etc/make.conf

# # # Code Listing 1.4: Setting up Configuration Files
# Alleen voor Stage1:
# cd /usr/portage
# scripts/bootstrap.sh
# wait
# You now have a Stage2
# emerge -p system
# wait
# emerge system
# wait


# (Set timezone information)
ln -sf /usr/share/zoneinfo/CET /etc/localtime
# (Edit fstab file)
# If this is correct you can just copy the file over.
nano -w /etc/fstab
wait

# # # Code Listing 1.6: Installing the Kernel

# (Install your OWN kernel)
# Install Kernel of your choice.
# Also see: http://www.gentoo.org/doc/en/gentoo-kernel.xml
# 1. gentoo-sources: for full performance and gaming
# 2. vanilla-sources: 2.4 kernel
# 3. gentoo-dev-sources: 2.6 kernel
# 4. gs-sources: for servers
# 5. xfs-sources: used by the LiveCD
# 6. gaming-sources: for gaming...lol!
# 7. love-sources:
emerge gentoo-sources
# OR: Use your OWN menuconfig-file with emerge 'my_own_kernel'

# (or (1) manually build your kernel)
# cd /usr/src/linux; make menuconfig;
# ( (2) Include VM fs, /proc fs, /dev fs, /dev fs auto mount at boot)
# ( (3) Compile your kernel)
make dep && make bzImage modules modules_install
# bzImage can be renamed to identify your own kernel(s)
# ( (4) Copy over the kernel)
cp arch/i386/boot/bzImage /boot; cp System.map /boot

# # # Code Listing 1.7: Install important system tools

# (Install system logger; choice: sysklogd, metalog, msyslog, syslog-ng)
emerge syslog-ng && rc-update add syslog-ng default
# (Install cron daemon; choice: vixie-cron, dcron, fcron)
emerge vixie-cron && rc-update add vixie-cron default
# (genkernel users only: have hotplug automatically started at boot)
emerge hotplug && rc-update add hotplug default
# (Non-ext2,ext3 users only; choice: reiserfsprogs, xfsprogs, jfsutils)
emerge reiserfsprogs
# (Domain name init script)
rc-update add domainname default
# (sshd : startup automatcially at boot)
rc-update add sshd default
rc-update add xinetd default
emerge net-dns/bind-tools

emerge pciutils
emerge ntp
rc-update add ntp-client default
echo You'll need to configure /etc/conf.d/ntp-client.
echo Uncomment the second statement and replace the place holder with your timeserver.
sleep 10
emerge logrotate
# /etc/logrotate.conf contains the default configuration for logrotate.
# Specify that file here to use the defaults, or point it to your own custom configuration file.
# $ logrotate -f /etc/logrotate.conf


# If you need specialised kernel ebuilds, now is a good time to install them:
# # # Code Listing 1.8: Install Specialised Kernel Ebuilds
# emerge pcmcia-cs (or nforce-net, nforce-audio, e100, e1000, ati-drivers, rp-pppoe)
# VIDEO_CARDS="yourcard" emerge xfree-drm (for ATI Radeon up to 9200, Rage128, Matrox, Voodoo and other cards)

# # # Code Listing 1.9: Finalise the Configuration Settings

# (Create a user)
useradd marcel -m -G users,wheel,audio -s /bin/bash

echo gentoo > /etc/hostname
# (Set the system domainname)
echo mydomain.com > /etc/dnsdomainname
# (Set the hostsfile, ex:"127.0.0.1 localhost mymachine")
# If this is correct you can just copy the file over:
# nano -w /etc/hosts

# (Configure basic system settings; follow comments)
# If this is correct you can just copy the file over:
# nano -w /etc/rc.conf
# Set time to 'LOCAL'
echo 192.168.1.7 gentoo > /etc/hosts

# # # Code Listing 1.10: Set up Networking

# (Setup networking; dhcp-users should set iface_eth0="dhcp")
nano /etc/conf.d/net

# (List modules to be loaded at startup)
# nano -w /etc/modules.autoload.d/<kernel-version>
# (Non-PCMCIA only: start networking automatically at boot)
rc-update add net.eth0 default

# (Only if you have multiple network interfaces:)
# (1) Create initscripts for each interface) # ln -s /etc/init.d/net.eth0 /etc/init.d/net.ethx
# (2) Automatically start at boot if no PCMCIA) # rc-update add net.ethx default
# (PCMCIA only: verify /etc/conf.d/pcmcia and load PCMCIA at boot) # rc-update add pcmcia boot


# # # Code Listing 1.11: Install and configure GRUB

emerge --usepkg grub
wait
# emerge grub
# wait
grub

# grub> root (hd0,0)
# grub> setup (hd0)
# grub> quit

ls /usr/src/linux
echo "Wait 30 seconds..."
sleep 30
grub
# # # If this is correct you can just copy the file over:
# nano -w /boot/grub/grub.conf
# default 0
# timeout 15
# splashimage=(hd0,0)/grub/splash.xpm.gz

# title=Gentoo Linux
# root (hd0,0)
# # genkernel users:
# kernel (hd0,0)/kernel-version root=/dev/ram0 init=/linuxrc real_root=/dev/hda3
# initrd (hd0,0)/initrd-version

# # non-genkernel users:
# kernel /kernel-<kernel version> root=/dev/hda3

# Do an 'env-update' AT THE END to finish everything off!
wait
env-update
wait
etc-update
wait

# # # Code Listing 1.13: Finishing off and installing GUI

# (Exiting the chroot)
exit; cd /


echo "Returning to ginstall1.sh after executing ginstall2.sh...

echo # (Unmounting partitions)
umount /mnt/gentoo/boot
umount /mnt/gentoo/proc
umount /mnt/gentoo


clear
echo ###############################################################
echo # #
echo # Rebooting... #
echo # #
echo # Don't forget to remove the install CD from the tray!!! #
echo # #
echo ###############################################################
sleep 10
# reboot
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum