[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Fwd: apt-get install in hooks



2014/1/6 Richard Nelson <unixabg@gmail.com>:
> Greetings,
>
>
> On Mon, Jan 6, 2014 at 6:11 AM, Kamil Czekirda <kczekirda@gmail.com> wrote:
>>
>> 2014/1/6 Richard Nelson <unixabg@gmail.com>:
>> > Greetings,
>> >
>> >
>> > On Sun, Jan 5, 2014 at 3:28 PM, Kamil Czekirda <kczekirda@gmail.com>
>> > wrote:
>> >>
>> >> Thank you for response, but I choosed another way to have configured
>> >> system:
>> >>
>> >> I want to use clean image from official mirrors and configure it.
>> >>
>> >> I can configure ldap by hooks, but the main problem is installing
>> >> packages from hooks.
>> >
>> >
>> > I do not use hooks in that manner, but I think it would then be worth
>> > your
>> > time to examine live-medium-install :
>> >
>> >
>> > http://live-systems.org/gitweb/?p=live-tools.git;a=blob;f=bin/live-medium-install;h=d5a4230042665ee0e569dff5c36003d0140ee9a0;hb=8429ebd7a67d9f5e0b2e817f092fb7af120a25ee
>> >
>> > This is what I am using for "firmware" installs and the really nice part
>> > is
>> > thanks to live-boot3x you can stack in partial_squashfs images with
>> > filesystem.squashfs to get where you want.
>> >
>> > I just got started setting up documentation and some other helper things
>> > (means under construction) at http://install.live-systems.org/
>> >
>>
>> Thank you for link to usefull script, I've added type of debian and
>> nonfree selection:
>>
>>
>> --- /media/debian/live-medium-install-orig 2014-01-06 12:56:55.000000000
>> +0100
>> +++ /media/debian/live-medium-install 2014-01-06 12:57:05.000000000 +0100
>> @@ -16,7 +16,11 @@
>>
>>
>> _URL="http://live.debian.net/files/stable/images/${_VERSION}/amd64/webboot/";
>>
>> -_FILES="debian-live-${_VERSION}-amd64-gnome-desktop.vmlinuz
>> debian-live-${_VERSION}-amd64-gnome-desktop.initrd.img
>> debian-live-${_VERSION}-amd64-gnome-desktop.squashfs"
>> +_TYPE="gnome-desktop"
>> +
>> +_FILES="debian-live-${_VERSION}-amd64-${_TYPE}.vmlinuz
>> debian-live-${_VERSION}-amd64-${_TYPE}.initrd.img
>> debian-live-${_VERSION}-amd64-${_TYPE}.squashfs"
>> +
>> +_NONFREE="no"
>>
>>  _TARGET="/dev/sda"
>>
>> @@ -81,7 +85,48 @@
>>  WARNING: This will erase all data on the target device
>>  ######################################################
>>
>> -Please enter URL to download the ${_IMAGE_FILE} image from
>> +Please enter the type of debian to download
>> +(default: ${_TYPE})
>> +
>> +gnome-desktop
>> +kde-desktop
>> +lxde-desktop
>> +xfce-desktop
>> +standard
>> +rescue
>> +EOF
>> +
>> +# Ask for type
>> +echo -n ": "
>> +read _READ
>> +
>> +_TYPE=${_READ:-${_TYPE}}
>> +
>> +
>> +cat << EOF
>> +Do you want to install nonfree version? Type 'yes' or press ENTER.
>> +(default: ${_NONFREE})
>> +EOF
>> +
>> +# Ask for nonfree
>> +echo -n ": "
>> +read _READ
>> +
>> +case "${_READ}" in
>> + 'yes')
>> + echo "nonfree selected"
>> + _NONFREE="+nonfree"
>> +
>> _URL="http://live.debian.net/files/stable/images/${_VERSION}${_NONFREE}/amd64/webboot/";
>> + _FILES="debian-live-${_VERSION}-amd64-${_TYPE}${_NONFREE}.vmlinuz
>> debian-live-${_VERSION}-amd64-${_TYPE}${_NONFREE}.initrd.img
>> debian-live-${_VERSION}-amd64-${_TYPE}${_NONFREE}.squashfs"
>> + ;;
>> + *)
>> + _FILES="debian-live-${_VERSION}-amd64-${_TYPE}.vmlinuz
>> debian-live-${_VERSION}-amd64-${_TYPE}.initrd.img
>> debian-live-${_VERSION}-amd64-${_TYPE}.squashfs"
>> + ;;
>> +esac
>> +
>> +cat << EOF
>> +
>> +Please enter URL to download the ${_FILES} image from
>>  (default: ${_URL})
>>  EOF
>>
>
> Thanks for the patches. I reworked the ideas here a bit and made two commits
> at:
>
>
> http://live.debian.net/gitweb/?p=live-tools.git;a=shortlog;h=refs/heads/debian-next
>
>
I've added new functionality - persistence, so you have new work to rework ;)

--- live-medium-install 2014-01-06 23:48:11.000000000 +0100
+++ live-medium-install.ch 2014-01-07 23:52:31.825147351 +0100
@@ -23,6 +23,10 @@

 _TARGET="/dev/sda"

+_PERSISTENCE="Yes, I want persistence."
+
+_SIZE="100MB"
+
 # Dependencies
 if [ ! -e /sbin/parted ]
 then
@@ -144,6 +148,40 @@
  ;;
 esac

+cat << EOF
+
+######################################################
+Do you want to use persistence option?
+Please enter: 'Yes, I want persistence.'
+(default: ${_PERSISTENCE})
+
+EOF
+
+# Ask for _PERSISTENCE
+
+echo -n ": "
+read _READ
+
+_PERSISTENCE=${_READ:-${_PERSISTENCE}}
+
+case "${_PERSISTENCE}" in
+ 'Yes, I want persistence.')
+ echo "What size? (default: ${_SIZE})"
+ # Ask for _SIZE
+
+ echo -n ": "
+ read _READ
+ _SIZE=${_READ:-${_SIZE}}
+
+ ;;
+
+ 'No I do not make persistence.')
+ ;;
+ *)
+ echo "Invalid persistance selection of ${_PERSISTANCE} , abort."
+ exit 1
+ ;;
+esac

 # Display warning
 cat << EOF
@@ -212,11 +250,16 @@
 dd if=/dev/zero of=${_TARGET} bs=1024 count=1024

 # Make a single partition
-echo "Starting parted command to make lablel and partition..."
+echo "Starting parted command to make label and partition..."
 #parted -s -a optimal ${_TARGET} mklabel gpt -- mkpart primary ext4 1 -1
 #parted -s -a optimal ${_TARGET} mklabel msdos -- mkpart primary ext4 1 3000
 #parted -s -a optimal ${_TARGET} -- mkpart primary ext4 3000 -1
-parted -s -a optimal ${_TARGET} mklabel msdos -- mkpart primary ext4 1 -1
+if [ "${_PERSISTENCE}" = "Yes, I want persistence." ]
+then
+    parted -s -a optimal ${_TARGET} mklabel msdos -- mkpart primary
ext4 ${_SIZE}+1 -1
+else
+    parted -s -a optimal ${_TARGET} mklabel msdos -- mkpart primary ext4 1 -1
+fi

 # Set the block device to boot.
 echo "Starting parted command to enable boot..."
@@ -225,7 +268,18 @@
 # Make new filesystem on the new partitions.
 echo "Making filesystem..."
 mkfs.ext4 -L Firmware ${_TARGET}1
-#mkfs.ext4 -L persistence ${_TARGET}2
+
+if [ "${_PERSISTENCE}" = "Yes, I want persistence." ]
+then
+   echo "adding partition for persistence"
+   parted -s -a optimal ${_TARGET} -- mkpart primary ext4 1 ${_SIZE}
+   mkfs.ext4 -L persistence ${_TARGET}2
+   mkdir /mnt2
+   mount ${_TARGET}2 /mnt2
+   echo "/ union" >> /mnt2/persistence.conf
+   umount /mnt2
+   rmdir /mnt2
+fi

 # Mount the target filesystem
 echo "Mounting file system to allow saving of webboot files..."
@@ -286,7 +340,16 @@
  menu default
  linux /live/vmlinuz
  initrd /live/initrd.img
- append boot=live config vga=normal video=vesa quiet splash
+EOF
+
+if [ "${_PERSISTENCE}" = "Yes, I want persistence." ]
+then
+    sh -c 'echo "\tappend boot=live config vga=normal video=vesa
quiet splash persistence" >> /mnt/boot/extlinux/extlinux.conf'
+else
+    sh -c 'echo "\tappend boot=live config vga=normal video=vesa
quiet splash" >> /mnt/boot/extlinux/extlinux.conf'
+fi
+
+cat >> /mnt/boot/extlinux/extlinux.conf << EOF

 label live-failsafe
  menu label Live (failsafe)

>
>
>>
>>
>> >>
>> >> Of course I can build images myself, it's not problem, but is the last
>> >> way.
>> >>
>> >
>> > I agree, I would rather reuse official images and the stacking of
>> > partial_squashfs is one way to do that.
>> >
>>
>> Thank you, I'm going to write script which makes personalized images.
>>
>
> Perhaps this:
>
>  http://install.live-systems.org/scripts/partial-squashfs-updates
>
> will be of assistance to you. It is what I am using to make partials and
> then to stack them together after so many partials.
>
> Again thanks for the patches and if the partial-squashfs-updates script is
> useful let me and the mail-list know.

Thank you, I'm working on it.

Regards,
Kamil

>
> Thanks.
>
>>
>> > Hope this information assists.
>> >
>> >
>> >>
>> >>
>> >> 2014/1/5 Richard Nelson <unixabg@gmail.com>:
>> >> > Greetings,
>> >> >
>> >> >
>> >> > On Sun, Jan 5, 2014 at 2:20 PM, Kamil Czekirda <kczekirda@gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> Hello,
>> >> >>
>> >> >> I'm using hooks in my debian-live in wheezy.
>> >> >>
>> >> >> I've tried to install software in very simple script:
>> >> >>
>> >> >> #!/bin/sh
>> >> >> echo "HOOK: install htop"
>> >> >>
>> >> >> apt-get update
>> >> >> apt-get install htop
>> >> >>
>> >> >> But Processing triggers for man-db complitly crashes system. I must
>> >> >> hardly restart machine.
>> >> >>
>> >> >> I can make apt-get update in hooks and manualy install package after
>> >> >> login, but I want to change list of packages automaticly.
>> >> >>
>> >> >> For me it's a good way to configure debian without repacking
>> >> >> squashfs
>> >> >> and making personal configuration, isn't it?
>> >> >>
>> >> >
>> >> > If you are building your own images see the manual (assuming you are
>> >> > using
>> >> > stable live-build 3x):
>> >> >
>> >> > http://live-systems.org/manual/stable/html/live-manual.en.html#430
>> >> >
>> >> > If you are not able to build your own, you can use the cgi builder
>> >> > http://cgi.build.live-systems.org/cgi-bin/live-build  and add the
>> >> > packages
>> >> > you want on the cgipackages.list.chroot: area (note the cgi builder
>> >> > only
>> >> > uses the main archive area).
>> >> >
>> >> > Hope this information assists.
>> >> >
>> >> >
>> >> >>
>> >> >> Thanks for help.
>> >> >>
>> >> >> Kamil Czekirda
>> >> >>
>> >> >>
>> >> >> --
>> >> >> To UNSUBSCRIBE, email to debian-live-request@lists.debian.org
>> >> >> with a subject of "unsubscribe". Trouble? Contact
>> >> >> listmaster@lists.debian.org
>> >> >> Archive:
>> >> >>
>> >> >>
>> >> >> CADSgWNE53jt6vawpzsZYE6c=Uu+w9UH9MA7hRoDEfTwXnBFwMQ@mail.gmail.com">http://lists.debian.org/CADSgWNE53jt6vawpzsZYE6c=Uu+w9UH9MA7hRoDEfTwXnBFwMQ@mail.gmail.com
>> >> >>
>> >> >
>> >
>> >
>
>

Attachment: patch_persistent
Description: Binary data


Reply to: