Browse Source

lastest changes from fullstory

tags/debian/0.11.3
Alf Gaida 6 years ago
parent
commit
b789ab4e1d

+ 1
- 1
data/exclusion_list View File

@@ -1,4 +1,5 @@
/proc/*
/disks/*
/etc/network/run/*
/home/*/.DCOPserver_*
/home/*/.gvfs*
@@ -18,4 +19,3 @@
/tmp/*
/var/cache/gdm/*
/var/tmp/*


+ 6
- 0
debian/changelog View File

@@ -1,3 +1,9 @@
fll-installer (2014.09.06) unstable; urgency=medium

* merging upstream

-- Alf Gaida <agaida@siduction.org> Sat, 06 Sep 2014 23:22:16 +0200

fll-installer (2014.09.04) unstable; urgency=medium

[ Angelescu Ovidiu ]

+ 2
- 20
debian/control View File

@@ -9,7 +9,6 @@ Build-Depends: debhelper (>= 9)
Standards-Version: 3.9.5
Vcs-Git: git://git.siduction.org/code/fll-installer
Vcs-Browser: http://git.siduction.org/?p=code/fll-installer.git
Homepage: http://svn.berlios.de/wsvn/fullstory/fll-installer/trunk/

Package: fll-installer
Architecture: all
@@ -18,7 +17,7 @@ Depends:
adduser,
base-files (>= 6.4),
initramfs-tools,
grub-pc | grub-efi-amd64 | grub-efi-i386,
grub-pc | grub-efi,
hwinfo,
lsof,
procps,
@@ -27,6 +26,7 @@ Depends:
os-prober,
rsync,
fll-live-initscripts (>= 2014.01.10)
Breaks: initscripts (<< 2.88dsf-16~)
Recommends:
sidu-installer
Suggests:
@@ -38,21 +38,3 @@ Description: backend scripts to install siduction to hdd
.
This is a siduction live-only package and should not be installed to an
ordinary system.

Package: fll-iso2usb
Architecture: all
Depends:
${misc:Depends},
grub-pc | grub-efi-amd64 | grub-efi-i386,
distro-defaults,
parted,
pv,
Recommends:
install-usb-gui
Suggests:
fuseiso
Description: backend scripts to install siduction to an usb hdd
fll-iso2usb provides the backend for installing siduction Live Linux
to removable storage, usb disk drives.
.
This preserves a hardware agnostic live system on removable storage.

+ 2
- 2
debian/copyright View File

@@ -8,7 +8,7 @@ Copyright: 2012-2013 Alf Gaida <agaida@siduction.org>
2007-2011 Joaquim Boura <x-un-i@berlios.de>
2006-2008 Red Hat, Inc.
2008-2010 Niall Walsh <niallwalsh@users.berlios.de>
2004-2011 Stefan Lippers-Hollmann <s.l-h@gmx.de>.
2004-2014 Stefan Lippers-Hollmann <s.l-h@gmx.de>.
License: GPL-2.0+

Files: modules/backend/fix_boot_on_HD.bm
@@ -16,7 +16,7 @@ Copyright: 2012 J. Hamatoma <hama@siduction.net>
License: GPL-2.0+

Files: debian/*
Copyright: 2011-2013 Alf Gaida <agaida@siduction.org>
Copyright: 2011-2014 Alf Gaida <agaida@siduction.org>
2007-2011 Joaquim Boura <x-un-i@berlios.de>
2008-2010 Niall Walsh <niallwalsh@users.berlios.de>
2004-2011 Stefan Lippers-Hollmann <s.l-h@gmx.de>.

+ 0
- 4
debian/fll-installer.lintian-overrides View File

@@ -1,4 +0,0 @@
# stop lintian complaining about a missing manpage. This
# manpage never will be written
fll-installer: binary-without-manpage usr/sbin/fll-installer


+ 0
- 2
debian/fll-iso2usb.install View File

@@ -1,2 +0,0 @@
fll-iso2usb usr/sbin/
fll-iso-strip usr/bin/

+ 0
- 4
debian/fll-iso2usb.lintian-overrides View File

@@ -1,4 +0,0 @@
# stop lintian complaining about a missing manpage. This
# manpage never will be written
fll-iso2usb: binary-without-manpage usr/bin/fll-iso-strip


+ 0
- 1
debian/fll-iso2usb.manpages View File

@@ -1 +0,0 @@
fll-iso2usb.8

+ 6
- 8
fll-installer View File

@@ -15,9 +15,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this package; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA.
# along with this package; if not, see <http://www.gnu.org/licenses>
#
# On Debian GNU/Linux systems, the text of the GPL license can be
# found in /usr/share/common-licenses/GPL.
@@ -57,7 +55,7 @@ error () {
# say
#--------------------------------------------------------------
say () {
printf "O: ${1}\n"
printf "O: ${1}\n"
}
#--------------------------------------------------------------
# usage
@@ -70,12 +68,12 @@ usage () {
# preparation, process cli arguments with getopt
#--------------------------------------------------------------
TEMP=$(getopt -o di:h \
--long debug,inotify:,help \
-n "$(basename ${0})" -- "${@}")
--long debug,inotify:,help \
-n "$(basename ${0})" -- "${@}")

if [ "${?}" -ne 0 ]; then
error 255 "getopt terminated abnormally"
# exit 255
error 255 "getopt terminated abnormally"
# exit 255
fi

# Note the quotes around `$TEMP': they are essential!

+ 0
- 203
fll-iso-strip View File

@@ -1,203 +0,0 @@
#!/bin/sh
# fll-iso-strip
# Usage: fll-iso-strip iso (amd64) (noi18n) (debug)
# Takes a (dual arch) fll iso as input
# Extracts the single desired arch (default 686)
# Strips sources
# Strips i18n if noi18n given
# Rewrites grub and md5sums
# Builds new iso alongside given iso
# does all staging work in current dir so double size of target iso needed free
#
# Copyright 2008 Niall Walsh (niallwalsh@users.berlios.de)
#
# 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 2
# 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 package; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
# On Debian GNU/Linux systems, the text of the GPL license can be
# found in /usr/share/common-licenses/GPL.

iso=$1
shift

if [ -z "${iso}" ]; then
echo "No iso supplied"
exit
fi

if [ ! -f "${iso}" ]; then
echo "Cannot read supplied iso ${iso}"
exit
fi

if [ "$(id -u)" -ne 0 ]; then
if ! which fuseiso >/dev/null; then
echo "fuseiso is required to run $0 unless run by root"
exit
else
isomount="fuseiso"
isoumount="fusermount -u"
fi
else
isomount="mount -t iso9660 -o loop,ro"
isoumount="umount"
fi

while [ -n "$1" ]; do
if [ "$1" = "amd64" ]; then
msg="${msg}amd64 Selected\n"
arch="amd64"
elif [ "$1" = "noi18n" ]; then
msg="${msg}i18n will be removed\n"
noi18n='-noi18n'
elif [ "$1" = "debug" ]; then
msg="${msg}enabling debugging\n"
debug=1
fi
shift
done

debug() {
if [ -n "${debug}" ]; then
echo $@
fi
}

stage=$(mktemp -d stage.XXXXXX)
fusemnt=$(mktemp -d fusemnt.XXXXXX)

debug "stripping $iso"
debug ${msg}
debug "arch: ${arch} noi18n: ${noi18n}"
debug "stage: ${stage} fusemnt: ${fusemnt}"

cancel_strip() {
rmdir ${fusemnt}
chmod -R u+w ${stage}
rm -rf ${stage}
}

if ! ${isomount} ${iso} ${fusemnt}; then
echo "Failed to mount ${iso}"
cancel_strip
exit
fi

rsyncopts=${rsyncopts}"--exclude='sources'"
if [ -n "${noi18n}" ]; then
rsyncopts=${rsyncopts}" --exclude='i18n'"
fi

if [ "${arch}" = 'amd64' ]; then
rsyncopts="${rsyncopts} --exclude='"'*i386*'"' --exclude='"'*686*'"'";
squashfs=$(find ${fusemnt} -name '*.amd64' | grep -v boot | sed 's|^'${fusemnt}'\/||')
noarchmenu="686"
noarchname="i386"
else
rsyncopts="${rsyncopts} --exclude='"'*amd64*'"'";
squashfs=$(find ${fusemnt} -name '*.686' | grep -v boot | sed 's|^'${fusemnt}'\/||')
noarchmenu="amd64"
noarchname="amd64"
fi

# get FLL_DISTRO_NAME and NEW_ISO
distro=$(echo $iso | sed 's|^.*/||;s|-.*||')
newiso=$(echo $iso | sed 's|-'${noarchname}'|'${noi18n}'|')

if [ -f ${newiso} ]; then
echo "Would overwrite existing ${newiso}"
${isoumount} ${fusemnt}
cancel_strip
exit
fi

debug "distro: ${distro} newiso: ${newiso}"

debug "rsyncopts: ${rsyncopts}"

if ! echo rsync -a ${rsyncopts} ${fusemnt}/* ${stage} | sh ; then
echo "failed to copy from ${fusemnt} to ${stage}"
${isoumount} ${fusemnt}
cancel_strip
exit
fi

$isoumount ${fusemnt}
rmdir ${fusemnt}

debug "rsync done ${fusemnt} unmounted"

chmod -R u+w ${stage}

menu="${stage}/boot/grub/menu.lst"
perl -e '$noarch='${noarchmenu}';
while(<>)
{
if ($stage==0)
{
if ((/^title/)&&(/$noarch/))
{
$stage=1;
$_="";
}
}
else
{
if ((/^title/)&&(!/$noarch/))
{
$stage=0;
}
else
{
$_="";
}
}
print "$_";
}' ${menu} > ${menu}.new && mv ${menu}.new ${menu}
debug "menu updated"

perl -e '$stage="'${stage}'";
open(IN,$stage."/md5sums")||die "failed to open $stage/md5sums : $!";
while(<IN>)
{
@f=split(/\s+/);
$f[1]=~s/^*//;
if (-f $stage."/".$f[1])
{
if ($f[1]!="boot/grub/menu.lst")
{
print;
}
}
}' > ${stage}/md5sums.new && mv ${stage}/md5sums.new ${stage}/md5sums

cd ${stage} && md5sum boot/grub/menu.lst | awk '{print $1" *"$2}' >> md5sum
cd - >/dev/null 2>&1

debug "md5sums updated"

echo 'boot/grub/* 10000
boot/* 1000
'${squashfs}' 100' > ${stage}/genisoimage.sort

genisoimage -quiet -pad -l -J -r -hide-rr-moved -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/grub/iso9660_stage1_5 -c boot/grub/boot.cat -V ${distro} -sort ${stage}/genisoimage.sort -x genisoimage.sort -o ${newiso} ${stage} > /dev/null

debug "iso created"

rm -rf ${stage}

debug "${stage} removed"

echo "Created ${newiso}"

+ 1
- 2
fll-iso2disk View File

@@ -16,8 +16,7 @@
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# along with this program; if not, see <http://www.gnu.org/licenses>

# NOTE
# extra args are appended to kernel cmdlines

+ 0
- 1029
fll-iso2usb
File diff suppressed because it is too large
View File


+ 0
- 67
fll-iso2usb.8 View File

@@ -1,67 +0,0 @@
.TH FLL-ISO2USB "8" "1th March 2013" "" ""
.SH NAME
\fBfll-iso2usb\fR \- installs a live-CD iso build with the
fll\-tools as a "fromiso" into a USB pen
.SH SYNOPSIS
\fBfll-iso2usb\fR \fI<options>\fR \fI-- <extra_options_to_grub>\fR
.SH DESCRIPTION
installs a \fBsiduction\fR iso-image on a USB-pen, makes the pen
bootable and writes the needed grub files.
.PP
\fBfll-iso2usb\fR creates a partition or uses the first partition from the USB-device, installs
grub and copies the iso into it. When running from the live CD it copies its
contents into the US device.
.PP
\fBfll-iso2usb\fR is intended to be called by the
\fBinstall-usb-gui\fR program but can also be called directly.
.PP
.SH OPTIONS
.TP
\fB\-h|\-\-help\fR
print help screen
.TP
\fB\-D|\-\-device\fR \fI<device>\fR
name of device where to install the "fromiso"
.TP
\fB\-f|\-\-format\fR \fInone|vfat|ext2|ext3\fR
format the device with the given filesystem. When \fInone\fR is given do not format.
.TP
\fB\-I|\-\-iso\fR \fI<iso_file>\fR
name of the iso image to be installed
.TP
\fB\-L|\-\-label\fR \fI<name>\fR
label name to be used for the created partition
.TP
\fB\-n|\-\-noformat\fR
do not format the device, the first partition is used, VFAT or EXT2/EXT3 are accepted.
If the installer formats the partition it uses the whole disk and formats the partition
with EXT3 filesystem.
.TP
\fB\-p|\-\-persist\fR
Install "fromiso" using the "persist" cheatcode. If the device has EXT2/EXT3 filesysten
or gets it when the installer creates the partition then all free place is used for the persist.
When the partition was formatted with VFAT then for the persist option uses at least 100MB
or at most 2GB (minus one) normally 50% of the free available space.
.TP
\fB\-P|\-\-percent\fR \fI<%>\fR
Adjust percentage of free space dedicated to the persistent overlay file on
vfat formatted usb media. Value given must be no less than 10 and no more than
90.
.TP
\fB\-t|\-\-test\fR
do not copy the iso image
.TP
\fB\-d|\-\-debug\fR
debug sh code execution
.PP
.SH EXAMPLES
.TP
\fBfll-iso2usb \-D /dev/sdb \-\-iso /home/siduction/siduction.iso \-p \\\fR
\fB \-\- toram lang=de tz=Europe/Berlin \fR
.PP
installs the iso image into the USB device sdb. Uses persist and the cheatcodes on the
grub default command line.
.PP
.SH AUTHOR
This manual page was written originally by Joaquim Boura <x-un-i@berlios.de>
and is modified by Alf Gaida <agaida@siduction.org>

+ 2
- 3
modules/backend/add_bootmanager.bm View File

@@ -92,13 +92,12 @@ add_bootmanager()

# determine if root_device is usb
device=$(echo $root_device|cut -d / -f3)
usb_dev=$(echo $(readlink -f /sys/block/${device}/device) | grep "usb")
usb_dev=$(readlink -f /sys/block/${device}/device | grep "usb")

# do efi if grub and have efi system partition and not usb install
if [ "$BOOT_LOADER" = "grub" ] && [ -n "$efisys" ] && [ -z "$usb_dev" ]
then
# No bootloader unless amd64
[ "$(dpkg --print-architecture)" = "amd64" ] && install_grub_efi
install_grub_efi
elif [ "$BOOT_LOADER" = "grub" ]
then
install_grub

+ 0
- 6
modules/backend/convert_live2HD.bm View File

@@ -7,12 +7,8 @@
# logit
# progress
# update_passwd
# copy_etc2HD
# copy_home2HD
# fix_home_on_HD
# fix_etc_on_HD
# fix_boot_on_HD
# system_create_modules
# system_services
#
##-------------------------------------
@@ -34,8 +30,6 @@ convert_live2HD()
fix_etc_on_HD

fix_locales_on_HD
fix_boot_on_HD

progress "Converting live system to Debian..."


+ 1
- 3
modules/backend/copy2HD.bm View File

@@ -33,12 +33,10 @@ copy2HD()
#
# experimental copy2HD loop adapted from fll-live-initramfs
#
# /selinux is not shipped in base-files, make the damn dir now

progress "Copying files. This can take a while. Please be patient."

[ -d "${TARGET_MNT_POINT}/selinux" ] || mkdir "${TARGET_MNT_POINT}/selinux"
for dir in ${DEFAULT_DIR}/*; do
for dir in ${DEFAULT_DIR}/*; do
[ -d "${dir}" ] || continue
if [ -L "${dir}" ]; then

+ 0
- 19
modules/backend/fix_boot_on_HD.bm View File

@@ -1,19 +0,0 @@
##
##-------------------------------------
# Needs:
#
# Calls:
# logit
#
##-------------------------------------
##
fix_boot_on_HD()
{
logit "fix_boot_on_hd"
# at this moment there is nothing to do.
#
# the following is moved to fix_home_on_HD.bm
# rm /home/<user>/.config/chromium/SingletonLock
# rm /home/<user>/.cache/*
return 0
}

+ 20
- 33
modules/backend/fix_etc_on_HD.bm View File

@@ -6,8 +6,6 @@
# HOST_NAME
# FLL_MOUNTPOINT
# USER_NAME
# DEFAULT_USER
# THEME
#
# Calls:
# logit
@@ -53,10 +51,27 @@ fix_etc_on_HD () {
chroot_it deluser "${USER_NAME}" sudo

#
# "normalize" /etc/inittab
# "normalize" gettys
#
sed -i -e 's@/sbin/getty -n -i -l /usr/bin/fll_login@/sbin/getty@' \
"${TARGET_MNT_POINT}/etc/inittab"

# sysvinit
if [ -r "${TARGET_MNT_POINT}/usr/share/sysvinit/inittab" ]; then
cp -f "${TARGET_MNT_POINT}/usr/share/sysvinit/inittab" \
"${TARGET_MNT_POINT}/etc/inittab"

sed -i -e 's/^\([2-6]\):23:respawn/\1:2345:respawn/' \
-e 's/id:[0-6]:initdefault:/id:5:initdefault:/' \
"${TARGET_MNT_POINT}/etc/inittab"
fi

# systemd
if [ -r "${TARGET_MNT_POINT}/etc/systemd/system/getty@.service" ]; then
rm -f "${TARGET_MNT_POINT}/etc/systemd/system/getty@.service" \
"${TARGET_MNT_POINT}/etc/systemd/system/autovt@.service"

ln -fs /lib/systemd/system/autovt@.service \
"${TARGET_MNT_POINT}/etc/systemd/system/getty.target.wants/getty@tty1.service"
fi
#
# normalize /etc/pam.d/login
@@ -65,18 +80,6 @@ fix_etc_on_HD () {
sed -i '/^#.*pam_lastlog\.so/s/^#[ \t]\+//' "${TARGET_MNT_POINT}/etc/pam.d/login"
fi

#
# make sure that /etc/mtab is either:
# - an empty regular file
# - or a symlink pointing to /proc/mounts
#
if [ -f "${TARGET_MNT_POINT}/etc/mtab" ]; then
:> "${TARGET_MNT_POINT}/etc/mtab"
else
rm -f "${TARGET_MNT_POINT}/etc/mtab"
ln -sf /proc/mounts "${TARGET_MNT_POINT}/etc/mtab"
fi

#
# remove confusing live traces from blkid.tab
#
@@ -132,21 +135,5 @@ fix_etc_on_HD () {
"${TARGET_MNT_POINT}/etc/lightdm/lightdm.conf"
fi

#
# prepares grub-theme-siduction-$RELEASE settings
#
DET_RES=$(su ${DEFAULT_USER} -c xrandr | head -n 1 | awk '{print $8.$9.$10}'| cut -d , -f1 )
GRUB_RES=$(hwinfo --framebuffer | grep $DET_RES | head -n 1| awk '{print $3}')
GRUBTHEME="/usr/share/grub/themes/${THEME}/theme-${GRUB_RES}.txt"
if [ -f "${GRUBTHEME}" ] && [ "x$GRUB_RES" != "x" ]; then
sed -i '/GRUB_THEME=.*/d' "${TARGET_MNT_POINT}/etc/default/grub"
sed -i '/GRUB_GFXPAYLOAD_LINUX=.*/d' "${TARGET_MNT_POINT}/etc/default/grub"
sed -i "s#\#GRUB_GFXMODE=.*#GRUB_GFXMODE=${GRUB_RES} \
\nGRUB_GFXPAYLOAD_LINUX=${GRUB_RES} \
\nGRUB_THEME=\"$GRUBTHEME\"#" "${TARGET_MNT_POINT}/etc/default/grub"
fi

return 0
}

+ 0
- 79
modules/backend/fix_usb_install.bm View File

@@ -1,79 +0,0 @@
##
##-------------------------------------
# Needs:
# HD_CHOICE
# TARGET_MNT_POINT
#
# Calls:
# logit
# get_root_device
#
##-------------------------------------
##
fix_usb_install () {
local root_partition
local root_device
local device
local usb_dev
local grub_dir
local menu_lst
local device_map device_map_temp
local old_mbr_device
local old_hdmap_dev
local old_hd_map_dev
local grub_hd drive line

#
# log my call
#
logit "fix system installed on usb device"
#

root_partition=$(echo "${HD_CHOICE}" | cut -d"'" -f2)

root_device=$(get_root_device "$root_partition")

device=$(echo "$root_device" | cut -d / -f3)

usb_dev=$(echo $(readlink -f "/sys/block/${device}/device") | grep "usb")

grub_dir="${TARGET_MNT_POINT}/boot/grub"

device_map="${grub_dir}/device.map"

if [ -n "${usb_dev}" ]; then
menu_lst="${grub_dir}/menu.lst"
old_mbr_device=$(awk '/hd0/{print $2}' "${device_map}")
old_hdmap_dev=$(grep ${root_device} ${device_map}|awk '{print $1}')
# get rid of () on the hd_map
old_hd_map_dev=$(echo ${old_hdmap_dev} |sed -e "s/[\(,\)]//g")
# install grub on MBR of the USB device
grub-install --no-floppy --force "--root-directory=${TARGET_MNT_POINT}" "${root_device}" >&2

# fix the device.map file
sed -i -e "s|(hd0)|(hdX)|" -e "s|${old_hdmap_dev}|(hd0)|" \
-e "s|(hdX)|${old_hdmap_dev}|" "${device_map}"

# fix the menu.lst
sed -i -e "s|hd0|hdX|" -e "s|${old_hd_map_dev}\,|hd0,|" \
-e "s|hdX|${old_hd_map_dev}|" "${menu_lst}"
fi
#
# fix device map stripping out the usb devices not needed
#
device_map_temp="$(mktemp -p /tmp/ .XXXXXXXXXX)"
while read line; do
grub_hd=$(echo $line | cut -d ' ' -f 1)
drive=$(echo $line|cut -d '/' -f 3)
if [ "${grub_hd}" = "(hd0)" ]; then
echo ${line} >> ${device_map_temp}
else
usb_dev=$(echo $(readlink -f "/sys/block/${drive}/device") | grep "usb")
[ -z "${usb_dev}" ] && echo "${line}" >> "${device_map_temp}"
fi
done < "${device_map}"

[ -s "${device_map_temp}" ] && mv -f "${device_map_temp}" "${device_map}"
}
##-------------------------------------

+ 53
- 70
modules/backend/install_grub.bm View File

@@ -18,6 +18,8 @@
# translate_linux_to_grub
# get_boot_cmdline
# getbootparam
# get_esp
# get_fat
#
# update_status
# install_grub
@@ -35,6 +37,7 @@ install_grub()
local usb_dev
local point
local bootfrom
local grubdev

#
# log my call
@@ -43,101 +46,81 @@ install_grub()
#

root_partition=$(echo ${HD_CHOICE} |cut -d"'" -f2)
say "debug: root_partition=$root_partition"

root_device=$(get_root_device $root_partition)
say "debug: root_device=$root_device"

device=$(echo $root_device|cut -d / -f3)
say "debug: device=$device"

usb_dev=$(echo $(readlink -f /sys/block/${device}/device) | grep usb)
say "debug: usb_dev=$usb_dev"
usb_dev=$(readlink -f /sys/block/${device}/device | grep "usb")

grubdev=""

# if the user chooses an USB device for the Grub installation we ignore
# that ( at least till further investigation) and set it to "partition"
case $BOOT_WHERE in
mbr)
bootfrom="(hd0)"
bootfrom=$(grub-mkdevicemap -n -m - | awk '/^\(hd0\)/{print $2}')
grubdev="${bootfrom}"
;;
partition)
bootfrom="${root_partition}"
;;
/dev/[hsv]d[a-z])
device=$(echo ${BOOT_WHERE}|cut -d / -f3)
if [ -n "$usb_dev" ]; then
bootfrom="${root_partition}"
else
bootfrom="${BOOT_WHERE}"
fi
;;
"")
bootfrom="(hd0)"
;;
*)
bootfrom="${root_partition}"
esac

if [ -n "${usb_dev}" ]; then
# USB install must have first Grub on partition
bootfrom=${HD_CHOICE}
else
# in case of jfs/xfs force installation to mbr
# but only if HD is not on USB and it's not already MBR
if [ "${BOOT_WHERE}" = "partition" ]; then
case "$HD_FSTYPE" in
jfs|xfs) bootfrom=${root_device};;
esac
fi
fi

if [ $bootfrom="(hd0)" ]; then
if [ -f $TARGET_MNT_POINT/boot/grub/device.map ]; then
say "$TARGET_MNT_POINT/boot/grub/device.map found - ok"
else
say "$TARGET_MNT_POINT/boot/grub/device.map not found - create a new one"
grub-mkdevicemap --device-map="$TARGET_MNT_POINT/boot/grub/device.map"
fi
fi
[ -z "$grubdev" ] && grubdev="$(ls -l /dev/disk/by-id | grep ${bootfrom##*/}$)"

say "debug: BOOT_WHERE=$BOOT_WHERE"
say "debug: bootfrom=$bootfrom"

# installing on MBR
# for debugging purposes we redirect the output of stdout and stderr to /root/fll-backup-mbr
if [ "$bootfrom" = "$(get_root_device ${bootfrom})" ]
then
# Make a backup of the old mbr
dd if=${bootfrom} of=$TARGET_MNT_POINT/boot/${FLL_DISTRO_NAME}-old-mbr.$(date -I) \
bs=446 count=1 > /root/fll-install-grub 2>&1
# in case of jfs/xfs force installation to mbr
# but only if it's not already MBR
if [ "${BOOT_WHERE}" = "partition" ]; then
case "$HD_FSTYPE" in
jfs|xfs) bootfrom=${root_device};;
esac
fi

#
# install grub
#
say "grub --root-directory=$TARGET_MNT_POINT "
# sometimes the first attempt to write grub fails, in this case the second attemt don't fail
# AG 2013-03-16
# we want to know, why the first attempt fail, so we redirect stdout and stderr to /root/fll-install-grub
# it's nothing really new in this code, but we have the chance to debug this ill behavior
# AG 2013-03-20
# Don't know, if the double writing of boot will make any sense with the new structure - but it does no harm
# so i decided to leave this like it is
if [ "${bootfrom}" = "$(get_root_device ${bootfrom})" ]
then # install on a disk
if [ "${bootfrom}" = "(hd0)" ]; then
say "Choice: Install on ${bootfrom}"
grub-install --force --root-directory=$TARGET_MNT_POINT "${bootfrom}" >> /root/fll-install-grub 2>&1
grub-install --force --root-directory=$TARGET_MNT_POINT "${bootfrom}" >> /root/fll-install-grub 2>&1
else
grub-install --recheck --force --root-directory=$TARGET_MNT_POINT "${bootfrom}" >> /root/fll-install-grub 2>&1
grub-install --recheck --force --root-directory=$TARGET_MNT_POINT "${bootfrom}" >> /root/fll-install-grub 2>&1
fi
else # install on partition
say "Choice: Install on partition $bootfrom"
grub-install --recheck --force --root-directory=$TARGET_MNT_POINT "${bootfrom}" >> /root/fll-install-grub 2>&1
grub-install --recheck --force --root-directory=$TARGET_MNT_POINT "${bootfrom}" >> /root/fll-install-grub 2>&1
fi
# is twice because sometimes the first one fails in that cases the second
# don't fail !!!
grub-install --recheck --no-floppy --force --root-directory=$TARGET_MNT_POINT "${bootfrom}" >&2 || \
grub-install --recheck --no-floppy --force --root-directory=$TARGET_MNT_POINT "${bootfrom}" >&2
chroot_it sh -c "echo \"grub-pc grub-pc/install_devices multiselect ${grubdev}\" | debconf-set-selections "

#
# portable efi
#
# when the install is on usb and that usb has a fat partition
# we put portable efi bootloaders in the ESP on the device
# or the first fat partition
if [ -n "${usb_dev}" ]; then
get_usbefi "${root_device}"
if [ -n "${usbefi}" ]; then
HD_MAP="$usbefi:/boot/efi ${HD_MAP}"

# Mount it now
mkdir $TARGET_MNT_POINT/boot/efi
mount ${usbefi} $TARGET_MNT_POINT/boot/efi

# Install grub-fll-portable-efi in the chroot
EFIAPTSOURCES=$(mktemp -d --tmpdir=${TARGET_MNT_POINT}/tmp/ liveapt.XXXXXX)
APTGETBASE="apt-get -o Dir::Etc=${EFIAPTSOURCES##${TARGET_MNT_POINT}}"
. /lib/init/fll
mount -o bind $(fll_get_mnt) ${TARGET_MNT_POINT}/mnt
echo 'deb file:///mnt/extras sid main' > ${EFIAPTSOURCES}/sources.list
mkdir ${EFIAPTSOURCES}/preferences.d
chroot_it ${APTGETBASE} update > /dev/null
chroot_it ${APTGETBASE} --allow-unauthenticated --assume-yes install grub2-fll-portable-efi > /dev/null
chroot_it ${APTGETBASE} --allow-unauthenticated --assume-yes remove --purge os-prober > /dev/null || :
umount ${TARGET_MNT_POINT}/mnt
echo '' > ${EFIAPTSOURCES}/sources.list
chroot_it ${APTGETBASE} update > /dev/null
chroot_it ${APTGETBASE} clean > /dev/null
rm -rf ${EFIAPTSOURCES}
fi
fi

#
# Create initital grub configuration (grub2 ignores -y)

+ 13
- 3
modules/backend/install_grub_efi.bm View File

@@ -56,10 +56,20 @@ install_grub_efi()
# Create the target directory for the efi loader on the efisys partition
mkdir $TARGET_MNT_POINT/boot/efi
mount ${efisys} $TARGET_MNT_POINT/boot/efi
sed -i -e 's|GRUB_DISTRIBUTOR=`.*`|GRUB_DISTRIBUTOR="'${FLL_DISTRO_NAME}'"|' $TARGET_MNT_POINT/etc/default/grub
mkdir -p $TARGET_MNT_POINT/boot/efi/EFI/${FLL_DISTRO_NAME}
mkdir -p "${TARGET_MNT_POINT}/boot/efi/EFI/debian"

# Install grub-efi in the chroot
( grep -q ia32-efi /proc/cmdline && bootarch="i386" ) || bootarch="amd64"
instarch=$(dpkg-architecture --print-architecture)
if [ "${bootarch}" = "${instarch}" ]; then
grubdeb="grub-efi"
else
if [ "${bootarch}" = "i386" ]; then
grubdeb="grub-efi-ia32"
else
grubdeb="grub-efi-${bootarch}"
fi
fi
EFIAPTSOURCES=$(mktemp -d --tmpdir=${TARGET_MNT_POINT}/tmp/ liveapt.XXXXXX)
APTGETBASE="apt-get -o Dir::Etc=${EFIAPTSOURCES##${TARGET_MNT_POINT}}"
. /lib/init/fll
@@ -67,7 +77,7 @@ install_grub_efi()
echo 'deb file:///mnt/extras sid main' > ${EFIAPTSOURCES}/sources.list
mkdir ${EFIAPTSOURCES}/preferences.d
chroot_it ${APTGETBASE} update > /dev/null
chroot_it ${APTGETBASE} --allow-unauthenticated --assume-yes install grub-efi > /dev/null
chroot_it ${APTGETBASE} --allow-unauthenticated --assume-yes install ${grubdeb} > /dev/null
umount ${TARGET_MNT_POINT}/mnt
echo '' > ${EFIAPTSOURCES}/sources.list
chroot_it ${APTGETBASE} update > /dev/null

+ 0
- 4
modules/backend/main.bm View File

@@ -4,7 +4,6 @@
# FLL_DISTRO_NAME-installer
# CONFIG_FILE
# TMPDIR
# BOOT_DISK
# HD_MAP
# ACTION (changes)
# LOG
@@ -34,7 +33,6 @@ main()
convert_live2HD \
add_bootmanager \
update_fstab \
fix_usb_install \
purge_live_only_stuff"

#
@@ -48,7 +46,6 @@ main()
# exit 1
fi
# initialize the ACTION variable for progress()
ACTION=0

#
@@ -67,7 +64,6 @@ main()

sync


#
# say the world we have done our work
#

+ 9
- 3
modules/backend/prepareHD.bm View File

@@ -37,7 +37,15 @@ prepareHD()
# sometimes kernel has not yet loaded the partition table
# so ask him to do that
#
/sbin/partprobe
# lines copied from fll_fstab_generator
#
if which udevadm >/dev/null; then
udevadm trigger --subsystem-match=block
udevadm settle --timeout=30
else
udevtrigger --subsystem-match=block
udevsettle --timeout=30
fi

TMP="$(mktemp)"

@@ -78,8 +86,6 @@ prepareHD()
#
mkdir -p "$TARGET_MNT_POINT"
mount_options=""
FOUND=$(mount | grep $HD_CHOICE)
[ -n "$FOUND" ] && umount $HD_CHOICE
[ "$HD_FORMAT" = "yes" ] && mount_options="-t $HD_FSTYPE"
mount $mount_options "$HD_CHOICE" "$TARGET_MNT_POINT" > "${TMP}" 2>&1
if [ $? -ne 0 ]; then

+ 2
- 1
modules/backend/purge_live_only_stuff.bm View File

@@ -3,7 +3,7 @@
# Needs:
# FLL_DISTRO_MODE
# TARGET_MNT_POINT
##
#
# Calls:
# logit
# chroot_it
@@ -27,6 +27,7 @@ purge_live_only_stuff() {

# purge live-specific packages
for i in cli-installer \
desktop-defaults-*\
gfxboot \
fll-* \
nbd-client \

+ 32
- 4
modules/backend/update_fstab.bm View File

@@ -3,7 +3,7 @@
# Needs:
# TARGET_MNT_POINT
# HD_AUTO
# HD_COICE
# HD_CHOICE
# HD_MAP
#
# Calls:
@@ -30,11 +30,39 @@ update_fstab()
root_partition=$(echo ${HD_CHOICE} |cut -d"'" -f2)
root_device=$(get_root_device $root_partition)
wanted="--wanted ${root_device}"
# ignore live iso and wrong loopback device (loop2)
if [ -b /dev/mapper/${FLL_DISTRO_NAME}-live ]; then
ignore_device="--ignore ${FLL_DISTRO_NAME}-live --ignore /dev/loop2"
ignore_device="--ignore ${FLL_DISTRO_NAME}-live"
fi
# if root_device is usb ignore devices not solely on it (like install-gui scripts/disk)
usb_dev=$(readlink -f /sys/block/${root_device#/dev/}/device | grep "usb")
if [ -n "${usb_dev}" ]; then
for d in /sys/block/* ; do
mydisk="/dev/${d#/sys/block/}"
dmd=""
if [ "x$(grub-probe -d "${mydisk}" -t abstraction)" = "xlvm" ]; then
# lvm device so discover pv device(s)
dmd="/dev/mapper/$(cat ${d}/dm/name)"
lvd="$(lvs --noheadings -o devices ${dmd})"
[ -n "${lvd}" ] || continue
# check it is on only one device
set -- $lvd
[ $# -gt 1 ] && continue
# strip the trailing (12345) sector of disk
mydisk="${1%\(*}"
fi
gp="$(grub-probe -d "${mydisk}" -t disk)"
# using set to strip whitespace
if [ -n "${gp}" ] && set -- ${gp} && \
[ "x${1}" != "x${root_device}" ]; then
if [ -n "${dmd}" ]; then
ignore_device="${ignore_device} --ignore ${dmd}"
else
ignore_device="${ignore_device} --ignore ${1}"
fi
fi
done
fi

if [ -n "${HD_MAP}" ]; then
for i in "${HD_MAP}"
do

+ 2
- 0
modules/common/clean_exit.bm View File

@@ -11,6 +11,8 @@
##
clean_exit()
{
DURATION=$(($(date +%s) - STARTTIME))
say "Exiting after $((DURATION / 60)):$((DURATION % 60))."
[ -n "$TMPDIR" ] && rm -rf "$TMPDIR"
if [ "$1" = "0" ]; then
logit "$FLL_DISTRO_NAME-installer terminated"

modules/common/knoppix-utils.bm → modules/common/fll-installer-utils.bm View File


+ 68
- 15
modules/initialization.bm View File

@@ -25,28 +25,81 @@ get_efisys () {
do
# next disk if usb
[ -n "$(echo $(readlink -f /sys/block/${disk##*/}/device) | grep 'usb')" ] && continue
# GPT disks appear in fdisk as a single partition of System GPT
parts=$(fdisk -l $disk | grep -v "Extended" | \
grep '^/dev/' | cut -d " " -f1 | cut -d "/" -f 3)
if [ "/dev/${parts}" = "${disk}1" ] && \
[ -n "$(fdisk -l $disk | awk '/^\/dev\//{if($6 == "GPT"){print "GPT"}}')" ]
then
# use gdisk to check for efi system partition
efis="$(gdisk -l ${disk} | \
awk '/^ +[[:digit:]]/{if ($6=="EF00"){print "'${disk}'"$1}}')"
# stop on the first vfat partition found setting efisys
for efi in $efis ; do
[ "$(blkid -s TYPE -o value ${efi})" = "vfat" ] && \
efisys="${efi}" && break 2
done
fi
get_esp "${disk}"
efisys="${esp}"
done
}

#
###-------------------------------------
#
get_esp () {
disk="${1}"
# GPT disks appear in fdisk as a single partition of System GPT
parts=$(fdisk -l $disk | grep -v "Extended" | \
grep '^/dev/' | cut -d " " -f1 | cut -d "/" -f 3)
if [ "/dev/${parts}" = "${disk}1" ] && \
[ -n "$(fdisk -l $disk | awk '/^\/dev\//{if($6 == "GPT"){print "GPT"}}')" ]
then
# use gdisk to check for efi system partition
efis="$(gdisk -l ${disk} | \
awk '/^ +[[:digit:]]/{if ($6=="EF00"){print "'${disk}'"$1}}')"
# stop on the first vfat partition found setting esp
for efi in $efis ; do
[ "$(blkid -s TYPE -o value ${efi})" = "vfat" ] && \
esp="${efi}" && break
done
fi
}

#
###-------------------------------------
#
get_fat () {
disk="${1}"
# GPT disks appear in fdisk as a single partition of System GPT
parts=$(fdisk -l $disk | grep -v "Extended" | \
grep '^/dev/' | cut -d " " -f1 | cut -d "/" -f 3)
if [ "/dev/${parts}" = "${disk}1" ] && \
[ -n "$(fdisk -l $disk | awk '/^\/dev\//{if($6 == "GPT"){print "GPT"}}')" ]
then
# use gdisk to check for partitions
parts="$(gdisk -l ${disk} | \
awk '/^ +[[:digit:]]/{print "'${disk}'"$1}')"
# stop on the first vfat partition
for part in $parts ; do
[ "$(blkid -s TYPE -o value ${part})" = "vfat" ] && \
fat="${part}" && break
done
else
# use fdisk to check for partitions
parts="$(fdisk -l ${disk} | \
awk '/^\//{print $1}')"
# stop on the first vfat partition
for part in $parts ; do
[ "$(blkid -s TYPE -o value ${part})" = "vfat" ] && \
fat="${part}" && break
done
fi
}

#
###-------------------------------------
#
get_usbefi () {
usbdisk="${1}"
usbefi=""
get_esp "${usbdisk}"
if [ -z "${esp}" ]; then
get_fat "${usbdisk}"
esp="${fat}"
fi
[ -n "${esp}" ] && usbefi="${esp}"
}

#
###-------------------------------------
#
TARGET_MNT_POINT="/fll/hdinstall"
TARGET_MNT_NAME="hdinstall"


Loading…
Cancel
Save