Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Install script for Gentoo
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
MC_Gen
n00b
n00b


Joined: 03 Jan 2015
Posts: 3
Location: WI

PostPosted: Sat Jan 03, 2015 2:50 am    Post subject: Install script for Gentoo Reply with quote

I got tired of reinstall manually, so broke down and wrote a script.
I hope others can use it, here is Gentoo_Install followed by Continue and Instruction that I used to install Gentoo.

Let me know if you like it, by posing here.

Code:
#!/bin/bash
#    This program installs Gentoo 2014 & Newer.
#    Remember This wipes out the entire Hard Drive.
#    Make sure this is what you want to do !!!!!!!!!!
#
#    All programs Copyrighted by there respective companies.
#
#    Copyright (C) 2014-15  Eric Teeter teetere @ charter.net
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#    This License only cover this script the software that is installed from
#    Ubuntu package by this script and they may use other licenses
#    it is up to the user to verfiy those and approve them.

#variables to used between scripts
export genkern password3 password4 ipans IP_add NetMask Broadcast Gateway HostName Realm ans User
password3=1
password4=2

#Number of proccessors plus one to set -j
NoProc=$(( $(nproc) + 1 ))
genkern=$1

if [ `whoami` != "root" ]; then
   echo "You must run this as root"
   exit 1
fi

#Figure the swap size
mem=`grep MemTotal /proc/meminfo | awk '{print $2}'`
swap=`echo "($mem+50)/100+131" | bc` #ending postion for Swap partion
clear


echo -e "\e[1;31mRemoving\e[0m the old partions and putting on new ones"
echo -e "\e[41m\e[1;33m Caution !!! \e[1;36mYou are about to loose all info on this drive \e[0m"
read -p "Do you still want to partion this drive (y,n)? " par
if [ "${par:0:1}" == "n" ] || [ "${par:0:1}" == "N" ]
then exit 1
fi

# Remove each partition
for v_partition in $(parted -s /dev/sda print|awk '/^ / {print $1}')
do
   parted -s /dev/sda rm ${v_partition}
done

#Make sure that you remove all data
parted -s /dev/sda -- mkpart primary 1 -1
parted -s /dev/sda mklabel msdos
mkfs.vfat /dev/sda1
parted -s /dev/sda rm 1

#Setup Hard Drive
parted -s /dev/sda mklabel gpt
parted -s /dev/sda unit mib
parted -s /dev/sda mkpart primary 1 3
parted -s /dev/sda name 1 grub
parted -s /dev/sda toggle 1 bios_grub
parted -s /dev/sda mkpart primary 3 131
parted -s /dev/sda name 2 boot
parted -s /dev/sda toggle 2 boot
parted -s /dev/sda mkpart primary linux-swap 131 $swap
parted -s /dev/sda name 3 swap
parted -s /dev/sda -- mkpart primary $swap -1
parted -s /dev/sda name 4 rootfs
mkfs.ext2 -F /dev/sda2
mkfs.ext4 -F /dev/sda4
mkswap /dev/sda3
swapon /dev/sda3

#Mount
mount /dev/sda4 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sda2 /mnt/gentoo/boot
cd /mnt/gentoo
clear

echo -e "Please change the root password"
while [ -z "$password3" ] || [ "$password3" != "$password4" ]
do
echo -en "New password: "
read -s  password3
echo -en "\nRetype new password: "
read -s password4

 if [ "$password3" == "$password4" ] && [ -n "$password3" ]
 then
   echo -e "\npasswd: password updated successfully\n"
   break  # Skip entire rest of loop.
 fi

#No null string
 if [ -z "$password3" ]
 then
 echo -e "\nNo \e[4;31mnull sting or blank\e[0m passwords allowed!"
 else
 echo -e "\nSorry, passwords do not match."
 fi

done

#Setting IP address

echo -en "Would you like \e[1;36mStatic\e[0m or \e[0;32mDynamic\e[0m address (s,d)? "
read ipans
if [[ $ipans == "s" ]]; then
echo -en "                What is the \e[0;32mStatic\e[0m IP address? "
read IP_add
echo -en "                          What is the \e[0;32mNetmask\e[0m? "
read NetMask
echo -en "                What is the \e[0;32mBroadcast\e[0m address? "
read Broadcast
echo -en "What is the default \e[0;32mGateway\e[0m or \e[0;32mRouter\e[0m address? "
read Gateway
fi
echo ""
echo -en "What is the \e[0;92mname\e[0m of this computer? "
read HostName
echo -en "What is the \e[0;92mRealm\e[0m (i.e. home.com)? "
read Realm

#Set Time zone
clear
echo -e "What is your Time Zone\nType in number below\n"
echo -e "1)  Alaska  \n2)  Aleutian  \n3)  Arizona  \n4)  Central  \n5)  East-Indiana  \n6)  Eastern  \n7)  Hawaii  \n8)  Indiana-Starke  \n9)  Michigan  \n10) Mountain  \n11) Pacific  \n12) Pacific-New   \n13) Samoa"
read -p "Your Zone is? " ans

re='^[0-9]+$'
if ! [[ $ans =~ $re ]] && (( ans < 1)) || (( ans > 13)); then
echo "Since I did not understand your request, I set you time zone to Central Time Zone"
echo "You can change that later manually if that is not what you would like."
ans=4
fi

echo ""

#Download tarball
if [ `uname -m` == 'x86_64' ]; then
  # 64-bit stuff
wget --glob=on ftp://gentoo.cites.uiuc.edu/pub/gentoo/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-2*.tar.bz2
wget --glob=on ftp://gentoo.cites.uiuc.edu/pub/gentoo/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-2*.tar.bz2.D*

echo -e "Getting \e[1;34mkeys\e[0m and \e[1;34mverify downloaded\e[0m files, will take a few mins."
#Get & test Keys
gpg --keyserver subkeys.pgp.net --recv-keys 0xBB572E0E2D182910 &> key
gpg --verify stage3-amd64-*.tar.bz2.DIGESTS.asc &> ver
test=`grep $(awk -F'key ID' '{ print $2 }' ver) key`
   if [[ $test != "" ]]; then
   echo -e "\n\e[42mThe key has been verifyed\e[0m\n"
   else
   echo -e "\n\e[41mThe key can not be verifyed, Need to stop!\e[0m\n"
   rm -f stage3-*.tar.*
        exit 1
        fi


#Check integrity
ver_W=$(grep $(openssl dgst -r -whirlpool stage3-amd64-*.tar.bz2 | awk '{print $1}') stage3-amd64-*.tar.bz2.DIGESTS.asc)
ver_s=$(grep $(openssl dgst -r -sha512 stage3-amd64-*.tar.bz2 | awk '{print $1}') stage3-amd64-*.tar.bz2.DIGESTS.asc)

        if [[ $ver_W != "" ]] && [[ $ver_s != "" ]]
        then

        echo -e "\n\e[42mThe integrity of files have been verifyed\e[0m\n"
        else

        echo -e "\n\e[41mThe integrity of files can not be verifyed, Need to stop!\e[0m\n"
   rm -f stage3-*.tar.*
        exit 1
        fi

else
  # 32-bit stuff
wget --glob=on ftp://gentoo.cites.uiuc.edu/pub/gentoo/releases/x86/autobuilds/current-stage3-i686/stage3-i686-2*.tar.bz2
wget --glob=on ftp://gentoo.cites.uiuc.edu/pub/gentoo/releases/x86/autobuilds/current-stage3-i686/stage3-i686-2*.tar.bz2.D*
ver_W=$(grep $(openssl dgst -r -whirlpool stage3-i686-*.tar.bz2 | awk '{print $1}') stage3-i686-*.tar.bz2.DIGESTS.asc)
ver_s=$(grep $(openssl dgst -r -sha512 stage3-i686-*.tar.bz2 | awk '{print $1}') stage3-i686-*.tar.bz2.DIGESTS.asc)

echo -e "Getting \e[1;34mkeys\e[0m and \e[1;34mverify downloaded\e[0m files, will take a few mins."
#Get & test Keys
gpg --keyserver subkeys.pgp.net --recv-keys 0xBB572E0E2D182910 &> key
gpg --verify stage3-i686-*.tar.bz2.DIGESTS.asc &> ver
test=`grep $(awk -F'key ID' '{ print $2 }' ver) key`
   if [[ $test != "" ]]; then
   echo -e "\n\e[42mThe key has been verifyed\e[0m\n"
   else
   echo -e "\n\e[41mThe key can not be verifyed, Need to stop!\e[0m\n"
        rm -f stage3-*.tar.*
   exit 1
        fi


#Check integrity
        if [ $ver_W != "" ] && [ $ver_s != "" ]
        then

        echo -e "\e[42mThe the integrity of files have been verifyed\e[0m"
        else

        echo -e "\e[41mThe the integrity of files can not be verifyed, Need to stop!\e[0m"
        rm -f stage3-*.tar.*
   exit 1
        fi

fi

sleep 3 #just to see answers before the roll off the screen

tar xvjpf stage3-*.tar.bz2
rm -f stage3-*.tar.bz2
rm -f stage3-*.tar.bz2.D*
rm -f key
rm -f ver


#Mounting the necessary filesystems
mount -t proc proc /mnt/gentoo/proc
mount --make-rprivate --rbind /sys /mnt/gentoo/sys
mount --make-rprivate --rbind /dev /mnt/gentoo/dev

mkdir /mnt/gentoo/usr/portage
sed -i 's/${CFLAGS}\"/${CFLAGS}\"\nMAKEOPTS=\"-j'$NoProc'\"/g' /mnt/gentoo/etc/portage/make.conf
sed -i 's/-O2 -pipe/-march=native -O2 -pipe/g' /mnt/gentoo/etc/portage/make.conf

echo -e "\nGetting mirrors for your slection for \e[0;32mDownload\e[0m this \nmay take 1 to 5 min depending on Internet & Hardware\n\nPlease select the closest site to speed up your Downloads\n"

mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf
clear
echo -e "\nGetting mirrors for your slection for \e[0;94mRsync\e[0m this \nmay take 1 to 5 min depending on Internet & Hardware\n\nPlease select the closest site to speed up your Rsync\n"
mirrorselect -i -r -o >> /mnt/gentoo/etc/portage/make.conf
clear

cp -L /etc/resolv.conf /mnt/gentoo/etc/
mount --rbind /sys /mnt/gentoo/sys
mount --make-rslave /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
mount --make-rslave /mnt/gentoo/dev

mount -t tmpfs -o nosuid,nodev,noexec shm /dev/shm

#Entering the new environment
cp /mnt/key/Continue /mnt/gentoo/tmp/Continue

# ----------------------> Entering chroot environment <------------------------------

echo -e "\nEntering chroot environment \n"
chroot /mnt/gentoo /bin/bash /tmp/./Continue

# ----------------------> Return from chroot environment <---------------------------

#Change Root password
echo -e "$password3\n$password4\n" | passwd &> /dev/null
cd /
rm -fr /tmp
mkdir tmp
#returning from Continue
echo -e "They system will \e[1;31mreboot\e[0m in 15 seconds!"
rm -f /mnt/gentoo/tmp/Continue
umount -l /mnt/gentoo/dev{/shm,/pts,}
umount /mnt/gentoo{/boot,/sys,/proc,}
fuser -c /dev/sda
umount /mnt/key
fuser -c /mnt/key
sleep 15
reboot


And also needed Continue

Code:
#!/bin/bash
#    This program Continues installs Gentoo 2014 & Newer .
#    All programs Copyrighted by there respective companies.
#
#    Copyright (C) 2014-15  Eric Teeter teetere @ charter.net
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#    This License only cover this script the software that is installed from
#    Ubuntu package by this script and they may use other licenses
#    it is up to the user to verfiy those and approve them.

eth_card=`ifconfig -a | grep MULTICAST |awk '{ print $1 }' | sed 's/:$//'`

source /etc/profile
export PS1="(chroot) $PS1"

#Installing a portage snapshot
echo -e "\n Installing \e[1;36mPortage SnapShot\e[0m will take a 3 to 7 Mins.\n"
emerge-webrsync

#Setting USE varable in etc/portage/make.conf
sed -i 's/sse2/sse2 acl afs apm berkdb cdr cups curl cxx dbm dvd dvdr git networkmanager nis odbc perl php python readline smp udev udisks usb xattr truetype jpeg png fontconfig/g' etc/portage/make.conf

#Set Time zone
case $ans in
   1)
echo "US/Alaska" > /etc/timezone
   ;;
   2)
echo "US/Aleutian" > /etc/timezone
   ;;
   3)
echo "US/Arizona" > /etc/timezone
   ;;
   4) 
echo "US/Central" > /etc/timezone
   ;;
   5) 
echo "US/East-Indiana" > /etc/timezone
   ;;
   6) 
echo "US/Eastern" > /etc/timezone
   ;;
   7) 
echo "US/Hawaii" > /etc/timezone
   ;;
   8) 
echo "US/Indiana-Starke" > /etc/timezone
   ;;
   9) 
echo "US/Michigan" > /etc/timezone
   ;;
   10) 
echo "US/Mountain" > /etc/timezone
   ;;
   11) 
echo "US/Pacific" > /etc/timezone 
   ;;
   12)
echo "US/Pacific-New" > /etc/timezone
   ;;
   13)
echo "US/Samoa" > /etc/timezone
   ;;
   *)
echo "Since I did not understand your request, I set you time zone to Central Time Zone"
echo "You can change that later manually if that is not what you would like."
echo "US/Central" > /etc/timezone

esac

emerge --config sys-libs/timezone-data

#Configure locales
sed -i 's/#en_US ISO-8859-1/en_US ISO-8859-1/g' /etc/locale.gen
sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen
locale-gen

eselect locale set 3
. /etc/profile
env-update && source /etc/profile

#--------------->Installing the sources<----------------------------
if [ `uname -m` == 'x86_64' ]; then
  # 64-bit stuff
     emerge sys-kernel/gentoo-sources
  else
  # 32-bit stuff
    emerge gentoo-sources
fi

emerge sys-kernel/genkernel

#Building kernel
if [[ $genkern == 'a' ]] || [[ $genkern == 'all' ]]
then
#Build kernel with all

genkernel --lvm --mdadm all
emerge sys-apps/pciutils

#Modify /etc/fstab
cp /etc/fstab{,.default}

else
   emerge sys-apps/pciutils

read -p "Do you want to build the kernel Manually (y)es, or Automatically (n)o? " kans

   if [[ $kans = 'y' ]] || [[ $kans == 'yes' ]]
   then
   #Build kernel manually

   echo -e "\nDo you need LVM and soft RAID (y)es, (n)o"
   read -p "Not sure press (y)" ians

   
   cd /usr/src/linux
   make menuconfig

   #Compiling
   make && make modules_install
   make install
   genkernel --menuconfig --install initramfs
   mkdir -p /boot/efi/boot
   cp /boot/vmlinuz /boot/efi/boot/bootx64.efi
   
      if [ $ians == "y" ] || [ $ians == "Y" ]
      then
      echo -e "\nWill build with LVM and soft RAID"
      sleep 3
      genkernel --menuconfig --lvm --mdadm --install initramfs
      
      else
      genkernel --menuconfig --install initramfs
      #mkdir -p /boot/efi/boot
      #cp /boot/vmlinuz /boot/efi/boot/bootx64.efi
      fi

   else
   #Build kernel with all

   genkernel --lvm --mdadm all
      emerge sys-apps/pciutils
   #Modify /etc/fstab

   clear

   fi

fi

cp /etc/fstab{,.default}

sed -i 's/\/dev\/BOOT/\/dev\/sda2/g' /etc/fstab # Boot
sed -i 's/\/dev\/ROOT/\/dev\/sda4/g' /etc/fstab # Root partion
sed -i 's/ext3/ext4/g' /etc/fstab               # Root format
sed -i 's/\/dev\/SWAP/\/dev\/sda3/g' /etc/fstab # Swap



sed -i 's/localhost/'$HostName'/g' /etc/conf.d/hostname
echo -e "dns_domain_lo=\"$Realm\"" > /etc/conf.d/net

#Configuring the network
emerge --noreplace net-misc/netifrc

if [[ $ipans == 's' ]]; then
echo "
config_$eth_card=\"$IP_add netmask $NetMask brd $Broadcast\"
routes_$eth_card=\"default via $Gateway\"" >> /etc/conf.d/net

echo "
#Ip address for local hosts
$IP_add       $HostName.$Realm   $HostName" >> /etc/hosts

else
echo "
config_$eth_card=\"dhcp\"" >> /etc/conf.d/net
fi

sed -i 's/localhost/'$HostName.$Realm $HostName localhost'/g' /etc/hosts


#Updating root password
echo -e "$password3\n$password4\n" | passwd &> /dev/null

cd /etc/init.d
ln -s net.lo net.$eth_card
rc-update add net.$eth_card default

#------> Change Root password <---------------------
echo -e "password3\npassword4\n" | passwd &> /dev/null

#------> Install Logging <--------------------------
emerge app-admin/syslog-ng
rc-update add syslog-ng default

#------> Install Cron daemon <----------------------
emerge sys-process/cronie
rc-update add cronie default

#------> Install File indexing <--------------------
emerge sys-apps/mlocate

#------> Setup Remote access <--------------------
rc-update add sshd default

if [[ $ipans == "d" ]]; then
#------> Install DHCP client <----------------------
emerge net-misc/dhcpcd
fi

#------> Install GRUB2 <----------------------------
emerge sys-boot/grub
mkdir /boot/grub/
grub2-install /dev/sda
grub2-mkconfig -o /boot/grub/grub.cfg

#------> finish Installing software & return <------
#emerge --autounmask-write =net-dns/dnssec-tools-2.1 =app-admin/webmin-1.690 =dev-perl/Authen-Libwrap-0.220.0-r1 =dev-perl/Getopt-GUI-Long-0.930.0-r1
#dispatch-conf u
#emerge webmin
clear
exit


Quote:

To use Gentoo Install script.

Please note that this will destroy all information on that hard drive!!!!!! Make sure you don’t want or have it backed up before you start.

I made a USB* stick with either ext2 or ext4 format. I use the CD-ROM since I could not get a USB to install and have the scripts on the same USB, if someone gets this to work please post here of others.

Make CD-ROM of Gentoo minimum, as instructed by Gentoo.
Now startup computer and use CD-ROM
When you get:
livecd ~ #
type in command passwd & fill in password you want for root.
Then type in command /etc/init.d/sshd start to start SSH server.

Then I type in command ifconfig to get the IP address of that machine.

Then optionally you can at this point use another machine and remotely login at this point.

I go to my windows machine with PuTTY and login, with root and the password I set earlier.

Now I mount the above USB using command mount /dev/sdb1 /mnt/key.

On the windows machine I use note and open up the script (Continue) and use “select all“ then “copy”. Got to PuTTY and open my favorite editor in my case nano /mnt/key/Continue and right click, so that the info is pasted in the file, and then save.
Then do same way with Gentoo_Install.

The make executable with command chmod +x /mnt/key/*

Then run script /mnt/key/./Gentoo_Install and fill in questions as they appear. This allows you the choice of Manually building the kernel or Automatically. If you want to skip this step & run Automatic build of the kernel you may run /mnt/key/./ Gentoo_Install a.

If you want desktop or other services you can add them later.

Estimated time to completion is a little over 2 hours. My best using genkenel all is 1 hr 55 min.

If you don’t want to reboot you can when it says that it will reboot in 15 seconds hit Control C (Ctrl C), or remove the reboot line in Gentoo_Install by placing # in front of reboot at the end of the file.

*To make a USB stick this will destroy all information on the stick!!!!
After you have the:
livecd ~ #

type in fdisk /dev/sdb
command p @ Command (m for help):

This will list partitions

You can then type in d for delete (return key) it will ask for number you can take the default, the hit d until all partitions are removed

Then type in n for new partition it will ask for start and end you can hit the return to take defaults for one partition.

Then type w to write and save.

mkfs.ext2 -F /dev/sdb1 to make a ext2 format or
mkfs.ext4 -F /dev/sdb1 to make a ext4 format

Note: this assumes that your USB is /dev/sdb if yours is different male adjustments.




If you have any suggestions for improvements (i.e. other languages) please make the changes and post your file(s) here. It is in bash so should be easy to change. If you were making language changes I would recommend renaming files with language at end (i.e. ISO 639-2 Code Gentoo_Install_ger and Continue_ger for German) so that those who want more than one language can have them all on same stick.

This should be good for anyone that uses US keyboard.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5855

PostPosted: Sat Jan 03, 2015 9:54 pm    Post subject: Reply with quote

Why do you fake a /usr/bin/passwd prompt, storing the user input plaintext in exported variables, when you could achieve the same thing securely using `passwd -R`?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43383
Location: 56N 3W

PostPosted: Sat Jan 03, 2015 10:40 pm    Post subject: Reply with quote

MC_Gen,

American users only?
My timezone is Europe/London.

Your install will not boot on many BIOS systems. They tend to check that the MSDOS partition table has the boot flag set somewhere.

When you make a GPT disklabel, you also get a free MSDOS disklabel with a single partition, that describes as much of the disk as it can.
It has not got the bootable flag set, so BIOS systems may refuse to load the boot loader.

You need an fdisk -t msdos /dev/sda ... and set the bootable flag.

Code:
#Make sure that you remove all data
parted -s /dev/sda -- mkpart primary 1 -1
parted -s /dev/sda mklabel msdos
mkfs.vfat /dev/sda1
parted -s /dev/sda rm 1

Does not remove all the data. mkfs.vfat creates the FAT data structures and root directory at the start of the disk, overwriting what used to occupy that space. Everything else is still intact, including the backup GPT, if the disk was GPT.
As you are going with GPT for the new install, there is no need to trash the existing MSDOS disk label, if there is one.
To trash the data, you need shred or DBAN, neither are fast. You could make it a user option.

Quote:
I made a USB* stick with either ext2 or ext4 format. I use the CD-ROM since I could not get a USB to install and have the scripts on the same USB, if someone gets this to work please post here of others.

Put System Rescue CD on a USB stick. Add scripts.
You will need to mount the USB stick in see the scripts as root is a looback mounted file on the USB, so your scripts are outsite the rootfs.
You can also modify the System Rescue CD looback mounted file.

There is another way, used by the liveDVD when its on a USB stick. It uses an overlay filesystem to make a read only filesystem appear to be writable.
It has a 'persistant' option.
Code:
if [ `uname -m` == 'x86_64' ]; then
  # 64-bit stuff
...
else
  # 32-bit stuff
is a bit simplistic.
Code:
$ uname -m
armv6l
gets me an i686 stage 3 to install on my Raspberry Pi.
I'm teasing a little just now. Scripts like this can be a good thing for users that know what they are doing but they deprive novices of the learning experience of installing Gentoo that they will need to maintain it, once its full of their valuable data.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
MC_Gen
n00b
n00b


Joined: 03 Jan 2015
Posts: 3
Location: WI

PostPosted: Sun Jan 04, 2015 12:22 am    Post subject: Reply with quote

Ant P.
Quote:
Why do you fake a /usr/bin/passwd prompt, storing the user input plaintext in exported variables, when you could achieve the same thing securely using `passwd -R`?


My Bad!!

MC_Gen

Quote:
American users only?
My timezone is Europe/London.


Too many timezones for every one (13 for US). That is why there should be separate file for each area, and keyboard. etc. I could have stacked case statements, but that was more work than I was up at this time. It may change in the future.

Quote:
You need an fdisk -t msdos /dev/sda ... and set the bootable flag


I was trying to format so that all data was erased, not good practice, but it worked when I was not rebooting.

Grate idea for USB stick!

Quote:
Scripts like this can be a good thing for users that know what they are doing but they deprive novices of the learning experience of installing Gentoo that they will need to maintain it, once its full of their valuable data


Sorry it is meant as a tool so that those who have to repetitively install can reduce the errors from a lot of typing. Thought those who have to install many units, they can start one let it finish inputting data and let it compile & start a new unit, for example.

Have worked with Ward Mundy on scripts for installing his version FreePBX called Incredible PBX. He is at http://nerdvittles.com/ if anyone wants to look at. I wrote the first script that he modified for use in his Incredible PBX. I was seeing if I could install Asterisk. Not looking good at this point, but keep plugging along.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43383
Location: 56N 3W

PostPosted: Sun Jan 04, 2015 10:50 am    Post subject: Reply with quote

MC_Gen,

Removing the partition table(s) removes pointers to data, not the data itself.
You can access the data without using the partition table, if you know where the filesystems start, testdisk will tell you, if you need to ask.
See the offset= option to mount.

Timezone and keyboard layout choice has been done many times before. Why not build on the work of others?
e.g. How does System Rescue CD do it at boot?
That's what GPL, CC (some of them) and FOSS is all about.

I suspect its easier to parse the content of /usr/share/zoneinfo than to write a huge case statement that you need to maintain as timezones are added and removed.
I don't do bash, so thats a systems engineering solution to the problem, not a working prototype.
Likewise, for keyboards. Then I can have my dvorak-uk.

Given the aim of installing many identical (similar?) units, you soon get tired of visiting them all with a screen, keyboard, display and USB stick.
You PXE boot them for the install and ssh in to make final adjustments. Your script could still be used but it needs to take its input from a file.
I guess that can be arranged with bash redirection.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
MC_Gen
n00b
n00b


Joined: 03 Jan 2015
Posts: 3
Location: WI

PostPosted: Mon Jan 05, 2015 3:52 pm    Post subject: Reply with quote

NeddySeagoon
Quote:

Timezone and keyboard layout choice has been done many times before. Why not build on the work of others?
e.g. How does System Rescue CD do it at boot?
That's what GPL, CC (some of them) and FOSS is all about.

There is also a way to figure time zone by IP address as Ubuntu does it for you. Will take some time

Quote:
Given the aim of installing many identical (similar?) units, you soon get tired of visiting them all with a screen, keyboard, display and USB stick.
You PXE boot them for the install and ssh in to make final adjustments. Your script could still be used but it needs to take its input from a file.
I guess that can be arranged with bash redirection.


If I were going to use PXE I would hard code screen, keyboard and timezone.

It is a first draft. I have tried to document as I went along so that those who want to work on it should be able to follow.

Bash/SH is not that hard, most of it is inputting the commands like you do at the keyboard. It is the easiest of the scripting in my opinion. It has solved a lot of problems for me.

As in Flesh Gordon "Monster's work is never done."

To be continued...
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43383
Location: 56N 3W

PostPosted: Mon Jan 05, 2015 7:23 pm    Post subject: Reply with quote

MC_Gen,

I wasn't trying to detract from your work. Just save you from reinvesting the wheel.
Keep up the good work.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Martin Cmelik
n00b
n00b


Joined: 14 Oct 2010
Posts: 42
Location: Prague

PostPosted: Wed Jan 21, 2015 9:10 pm    Post subject: Reply with quote

not ready yet, but might be considered as useful: https://github.com/martincmelik/Securix-Linux/blob/master/securix-install/install.sh
_________________
Code:
where there is a shell, there is a way
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo 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