DFbuild.sh 1.94 KB
Newer Older
arpinux's avatar
arpinux committed
1 2 3 4 5
#!/bin/bash
# DFLinux live-build script
# https://framagit.org/dflinux/DFiso

# cfg ------------------------------------------------------------------
6
VERSION="stretch-rev2"
arpinux's avatar
arpinux committed
7 8

if [ `whoami` != root ]; then
arpinux's avatar
arpinux committed
9 10
    echo "erreur : lancer DFbuild en tant qu'administrateur"
    exit 1
arpinux's avatar
arpinux committed
11 12
fi
# args -----------------------------------------------------------------
arpinux's avatar
arpinux committed
13 14 15
if [ "$1" == "32" ]; then ARCH="i386"
elif [ "$1" == "64" ]; then ARCH="amd64"
elif [ "$1" == "clean" ]; then lb clean && rm -R -f cache && exit 0
arpinux's avatar
arpinux committed
16
else
arpinux's avatar
arpinux committed
17 18 19 20 21 22 23
    # no args or wrong args > help
    echo "Utilisation : en mode administrateur"
    echo "./DFbuild.sh 32    > construire DFLinux i386"
    echo "./DFbuild.sh 64    > construire DFLinux amd64"
    echo "./DFbuild.sh clean > nettoyer le dossier de construction et le cache"
    echo "---"
    echo "prenez soin de nettoyer le cache avant de construire sous une nouvelle architecture."
arpinux's avatar
arpinux committed
24 25 26 27
    exit 1
fi

## build ISO -----------------------------------------------------------
28 29

## place nette
arpinux's avatar
arpinux committed
30 31 32 33 34
lb clean

## mise en place
echo "INFO: building DFLinux-${VERSION}-${ARCH}"

35 36 37 38 39 40
# dossier des paquets externes
mkdir -p config/packages

# import des paquets externes
cp ext/*.deb config/packages/

41
# architecture
42 43
if [ "$ARCH" == "i386" ]; then lb config -a ${ARCH} -k "686"; lb build; fi
if [ "$ARCH" == "amd64" ]; then lb config -a ${ARCH}; lb build; fi
arpinux's avatar
arpinux committed
44

45 46 47
# nettoyage
rm -Rf config/packages config/includes config/includes.bootstrap config/includes.source

arpinux's avatar
arpinux committed
48 49 50
## renommage
echo "INFO: renommer"
if test -f live-image-${ARCH}.hybrid.iso; then
arpinux's avatar
arpinux committed
51 52 53 54 55
    mkdir -p dfl-${ARCH}
    mv live-image-${ARCH}.hybrid.iso dfl-${ARCH}/dflinux-${VERSION}-${ARCH}.iso
    mv chroot.packages.install dfl-${ARCH}/dflinux-${VERSION}-${ARCH}.pkgs
    mv dflinux.log dfl-${ARCH}/dflinux-${VERSION}-${ARCH}.log
    cd dfl-${ARCH} && md5sum dflinux-${VERSION}-${ARCH}.iso > dflinux-${VERSION}-${ARCH}.md5 && cd ../
56
    lb clean
arpinux's avatar
arpinux committed
57
else
arpinux's avatar
arpinux committed
58 59
    echo "ISO non construite : erreur, voir le fichier dflinux.log"
    exit 1
arpinux's avatar
arpinux committed
60 61 62
fi

exit 0