#!/bin/sh set -e _test_and_remove_package() { # Remove package rc=0 chroot /target dpkg -s ${1} >/dev/null 2>/dev/null || rc=1 if [ ${rc} -eq 0 ]; then chroot /target apt-get purge ${1} --force-yes -y else echo "[ LliureX Casper Msg]: Package ${1} not found...nothing to do" fi } # Removing packages from installation for package in lliurex-live-ubiquity ubiquity ubiquity-casper ubiquity-frontend-gtk ubiquity-ubuntu-artwork; do _test_and_remove_package ${package} done # Remove some sources.list.d files rm -rf /target/etc/apt/sources.list.d/* # DEFAULT sources.list is lliurex.net chroot /target/ llx-apt-cmd reset "lliurex.net" # Only in x64 flavours rc=0 uname -m | grep -q "x86_64" || rc=1 if [ ${rc} -eq 0 ]; then # We are on 64 bits system echo "deb file:///cdrom trusty main restricted universe multiverse" > /target/etc/apt/sources.list.d/cdrom.list cat > /target/etc/n4d/one-shot/os.cdrom.sh << EOF #!/bin/sh # # ONE-SHOT Mechanism # for openssh-server # # Powered by N4D # # If openssh-server is installed # must have a dpkg-reconfigure # action. rm -rf /etc/apt/sources.list.d/cdrom.list rm -rf /etc/lliurex-grub-custom/* dpkg-reconfigure lliurex-grub-custom || true exit 0 EOF # Now is the time of permissions chmod +x /target/etc/n4d/one-shot/os.cdrom.sh fi # Getting the current lliurex-version (Flavour and adjustt the sources.list to the # desired configuration. rc=0 lliurex-version -t client || rc=1 if [ $rc -eq 0 ] ; then chroot /target/ llx-apt-cmd reset "Mirror on server" fi # Seems a good idea update the cache chroot /target/ apt-get update exit 0