summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2016-11-03 17:22:18 (GMT)
committerWaldemar Brodkorb <wbx@openadk.org>2018-06-08 18:11:17 (GMT)
commit72355950a683de4bc70f83ca2cd843216d6556f6 (patch)
tree70d00c20bd4a7f68cab365d629116fc25a0e2b80 /package
parent20863d6664c4ea59f7f51b3044b97db6af9d2241 (diff)
add sample for lenovo x200, fix gentooinstaller
Diffstat (limited to 'package')
-rw-r--r--package/gentooinstall/Makefile5
-rw-r--r--package/gentooinstall/src/gentooinstall66
2 files changed, 38 insertions, 33 deletions
diff --git a/package/gentooinstall/Makefile b/package/gentooinstall/Makefile
index 251e38a..0af6a19 100644
--- a/package/gentooinstall/Makefile
+++ b/package/gentooinstall/Makefile
@@ -9,7 +9,6 @@ PKG_RELEASE:= 1
PKG_DESCR:= gentoo disk installer
PKG_SECTION:= base/adk
PKG_DEPENDS:= mke2fs parted sfdisk dosfstools mksh
-PKG_DEPENDS+= grub grub-tools
PKG_KDEPENDS:= ext4-fs
NO_DISTFILES:= 1
@@ -22,8 +21,8 @@ CONFIG_STYLE:= manual
BUILD_STYLE:= manual
INSTALL_STYLE:= manual
-fwinstall-install:
+gentooinstall-install:
$(INSTALL_DIR) $(IDIR_GENTOOINSTALL)/usr/sbin
- $(INSTALL_BIN) $(WRKBUILD)/fwinstall $(IDIR_GENTOOINSTALL)/usr/sbin
+ $(INSTALL_BIN) $(WRKBUILD)/gentooinstall $(IDIR_GENTOOINSTALL)/usr/sbin
include ${ADK_TOPDIR}/mk/pkg-bottom.mk
diff --git a/package/gentooinstall/src/gentooinstall b/package/gentooinstall/src/gentooinstall
index 1989b2a..0199df3 100644
--- a/package/gentooinstall/src/gentooinstall
+++ b/package/gentooinstall/src/gentooinstall
@@ -66,17 +66,10 @@ function create_label {
fi
}
-# get max size of disk in sectors
-function get_max_size {
- maxsize=$(env LC_ALL=C parted $1 -s unit s print |awk '/^Disk/ { print $3 }'|sed -e 's/s//')
- rootsize=$(($maxsize-$cfgfssize))
- print device has $maxsize sectors. using $rootsize for root.
-}
-
# create partition, with fstype start and end in sectors
function create_partition {
- print creating partition on $1
- parted -s $1 unit s mkpart primary $2 $3 $4 > /dev/null 2>&1
+ print creating partition on $1 with $2
+ parted -s $1 -- unit MiB mkpart primary $2 $3 $4 > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "creating primary partition failed!"
exit 1
@@ -130,55 +123,68 @@ function extract_archive {
function create_chroot_installer {
(
- emerge-websync
- emerge rsyslog
- rc-update add sshd default
- emerge grub:2
- print grub-mkconfig > /boot/grub/grub.cfg
- print Installing Grub into /dev/sda
- print grub-install /dev/sda
+ print emerge-webrsync
+ print emerge dhcpcd
+ print rc-update add sshd default
+ print emerge grub:2
) >/mnt/install
chmod 755 /mnt/install
}
+function create_chroot_grubinstaller {
+(
+ print 'grub-mkconfig > /boot/grub/grub.cfg'
+ print grub-install /dev/sda
+) >/mnt/installgrub
+ chmod 755 /mnt/installgrub
+}
+
function chroot_install {
print Installing Gentoo
+ cat /etc/resolv.conf > /mnt/etc/resolv.conf
mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
mount -o bind /dev /mnt/dev
- mkdir /mnt/dev/shm
mount -t tmpfs tmpfs /mnt/dev/shm
chroot /mnt /install
if [ $? -ne 0 ]; then
echo "Gentoo installation failed!"
+ umount /mnt/dev/shm
+ umount /mnt/{proc,dev,sys}
+ umount /mnt
+ exit 1
+ fi
+ printf "Now manually install a kernel"
+ chroot /mnt /bin/bash
+ printf "Now installang bootloader"
+ chroot /mnt /installgrub
+ if [ $? -ne 0 ]; then
+ echo "Gentoo installation failed!"
+ umount /mnt/dev/shm
+ umount /mnt/{proc,dev,sys}
+ umount /mnt
exit 1
fi
}
-function fix_perm {
- print fixing permissions
- chmod 1777 ${1}/tmp
-}
-
case $arch {
(x86|x86_64)
- get_max_size $device
create_label $device
- create_partition $device swap 0 $swapsize
- create_partition $device ext2 $(($swapsize+1)) $(($maxsize-1))
- set_boot_flag $device 1
- change_part_type $device 1 82
+ create_partition $device sw 2 2048
+ create_partition $device ext2 2049 -1
+ set_boot_flag $device 2
partprobe $device
sync
- create_filesystem $device $fs 1
+ create_filesystem $device $fs 2
[[ -x /sbin/mdev ]] && mdev -s
- mount_fs $device 1 $fs /mnt
+ mount_fs $device 2 $fs /mnt
extract_archive $archive /mnt
create_chroot_installer
chroot_install /mnt
print "/dev/sda2 / ext4 defaults 0 1" > /mnt/etc/fstab
print hostname=\"$hostname\" > /mnt/etc/conf.d/hostname
- fix_perm /mnt
+ chmod 1777 /mnt/tmp
+ sync
umount /mnt/dev/shm
umount /mnt/{proc,dev,sys}
umount /mnt