source: llx-pool-tools/trunk/fuentes/install-files/usr/share/llx-pool/actions/xenial/package-list-update-frozen.sh @ 2286

Last change on this file since 2286 was 2286, checked in by hectorgh, 4 years ago

new changes

  • Property svn:executable set to *
File size: 4.5 KB
Line 
1#!/bin/bash
2
3# LLIUREX-POOL INFO
4
5SECTION="lists"
6WEIGHT=1
7COMMENT="Update package list using our frozen Ubuntu mirror"
8
9
10# COMMON VALUES
11#
12
13DISTRO="xenial"
14
15# Config base dir
16CONFIG_PATH="/etc/llx-pool/basic-pkg-lists/${DISTRO}/"
17
18# Package lists
19SUPPORTED_FILE="${CONFIG_PATH}/extra-pkg-list"
20METAS_FILE="${CONFIG_PATH}/llx-metas-list"
21UDEBS_FILE="${CONFIG_PATH}/udeb-list"
22UDEBS_EXTRA_FILE="${CONFIG_PATH}/udeb-extra"
23
24# Frozen lliurex pacakges list
25FROZEN_FILE="${CONFIG_PATH}/frozen-list"
26
27#PATHS
28CHROOT_BASE="/srv/nfs/lliurex1609/bootstraps"
29LLX_XENIAL_MIRROR="/srv/nfs/lliurex1609/xenial"
30LLX_PREXENIAL_MIRROR="/srv/nfs/lliurex1609/pre-xenial"
31UBUNTU_XENIAL_MIRROR="/srv/nfs/lliurex1609/ubuntu/"
32
33AMD64_CHROOT="${CHROOT_BASE}/amd64"
34I386_CHROOT="${CHROOT_BASE}/i386"
35
36PACKAGE_LIST="PackageList.txt"
37
38EXTRA_SUPPORTED_LIST="$(cat ${SUPPORTED_FILE} | tr "\n" " ")"
39
40
41META_LIST=$(cat ${METAS_FILE} | tr "\n" " ")
42UDEB_LIST=$(cat ${UDEBS_FILE} | tr "\n" " ")
43
44
45
46
47
48# Copy sources-list files
49
50cp $CHROOT_BASE/sources.list.frozen $AMD64_CHROOT/etc/apt/sources.list
51cp $CHROOT_BASE/sources.list.frozen $I386_CHROOT/etc/apt/sources.list
52
53cp $CHROOT_BASE/debian-installer.frozen $AMD64_CHROOT/etc/apt/sources.list.d/debian-installer.list
54cp $CHROOT_BASE/debian-installer.frozen $I386_CHROOT/etc/apt/sources.list.d/debian-installer.list
55
56# Mount ubuntu-mirror
57
58mount --bind $UBUNTU_XENIAL_MIRROR $AMD64_CHROOT/srv
59mount --bind $UBUNTU_XENIAL_MIRROR $I386_CHROOT/srv
60
61mount --bind /srv/nfs/lliurex1609/xenial-included $AMD64_CHROOT/mnt
62mount --bind /srv/nfs/lliurex1609/xenial-included $I386_CHROOT/mnt
63
64for ch in $AMD64_CHROOT $I386_CHROOT; do
65
66        echo "[${ch}] Updating apt..."
67        chroot ${ch} apt-get update 2>/dev/null 1>/dev/null
68        #echo "[${ch}] Installing pool data..."
69        #chroot ${ch} apt-get install lliurex-pool-data -y --force-yes
70        #CDD_SUPPORTED_LIST="$(cat ${ch}/usr/share/lliurex-pool-data/lists/supported/cdd-supported | tr "\n" " ")"
71        #ARCH=$(echo ${ch} | cut -d / -f6)
72        #less ${UDEBS_EXTRA_FILE}.${ARCH}
73        chroot ${ch} lliurex-resolver -i ${UDEB_LIST} ${META_LIST} ${EXTRA_SUPPORTED_LIST} -b unity-greeter -o ${PACKAGE_LIST} -d
74        echo "The path of list is: "
75        echo "${ch}"/"${PACKAGE_LIST}"
76
77done
78
79# Umount ubuntu-mirror
80
81umount $AMD64_CHROOT/srv
82umount $I386_CHROOT/srv
83
84umount $I386_CHROOT/mnt
85umount $I386_CHROOT/mnt
86
87# Order and unique packages
88cat $AMD64_CHROOT/$PACKAGE_LIST | sort -u > /tmp/$PACKAGE_LIST
89cp /tmp/$PACKAGE_LIST $AMD64_CHROOT/$PACKAGE_LIST
90
91cat $I386_CHROOT/$PACKAGE_LIST | sort -u > /tmp/$PACKAGE_LIST
92cp /tmp/$PACKAGE_LIST $I386_CHROOT/$PACKAGE_LIST
93
94
95
96#Remove frozen apps from list from Ubuntu repos
97echo "# Frozen apps!"
98cp $AMD64_CHROOT/$PACKAGE_LIST $AMD64_CHROOT/$PACKAGE_LIST.frozen
99cp $I386_CHROOT/$PACKAGE_LIST $I386_CHROOT/$PACKAGE_LIST.frozen
100
101# Removing frozen packages
102while read line
103do
104    pkg=$line
105   echo " [ LliureX Mega Resolver ]  * Frozen :  $pkg"
106    sed -i "/^$pkg[[:blank:]]\+/d" $AMD64_CHROOT/$PACKAGE_LIST.frozen
107   sed -i "/^$pkg[[:blank:]]\+/d" $I386_CHROOT/$PACKAGE_LIST.frozen
108done < ${FROZEN_FILE}
109
110echo ""
111echo ""
112echo ""
113
114echo "****  SHOWING DIFFERENCIES (If empty, there are no changes)"
115echo "[AMD64]"
116diff -Nuar ${LLX_PREXENIAL_MIRROR}/conf/amd64.txt ${AMD64_CHROOT}/${PACKAGE_LIST}
117
118echo "[FROZEN AMD64]"
119diff -Nuar ${LLX_PREXENIAL_MIRROR}/conf/amd64-frozen.txt ${AMD64_CHROOT}/${PACKAGE_LIST}.frozen
120
121echo ""
122echo -n " * Press any key to continue... "
123read
124
125echo "[i386]"
126diff -Nuar ${LLX_PREXENIAL_MIRROR}/conf/i386.txt ${I386_CHROOT}/${PACKAGE_LIST}
127
128echo "[FROZEN i386]"
129diff -Nuar ${LLX_PREXENIAL_MIRROR}/conf/i386-frozen.txt ${I386_CHROOT}/${PACKAGE_LIST}.frozen
130
131echo ""
132echo -n " * Press any key to continue... "
133read
134echo ""
135
136echo ""
137
138echo -n "# Copy new packages list to pre-xenial? [y/n]: "
139read x
140if [ "$x" = "y" ]; then
141    cp ${I386_CHROOT}/${PACKAGE_LIST} ${LLX_PREXENIAL_MIRROR}/conf/i386.txt
142    cp ${AMD64_CHROOT}/${PACKAGE_LIST} ${LLX_PREXENIAL_MIRROR}/conf/amd64.txt
143   
144    cp ${I386_CHROOT}/${PACKAGE_LIST}.frozen ${LLX_PREXENIAL_MIRROR}/conf/i386-frozen.txt
145    cp ${AMD64_CHROOT}/${PACKAGE_LIST}.frozen ${LLX_PREXENIAL_MIRROR}/conf/amd64-frozen.txt
146   
147   
148else
149    echo "Nothing to do."
150fi
151
152echo -n "# Copy new packages list to xenial? [y/n]: "
153read x
154if [ "$x" = "y" ]; then
155   
156    cp ${I386_CHROOT}/${PACKAGE_LIST} ${LLX_XENIAL_MIRROR}/conf/i386.txt
157    cp ${AMD64_CHROOT}/${PACKAGE_LIST} ${LLX_XENIAL_MIRROR}/conf/amd64.txt
158   
159    cp ${I386_CHROOT}/${PACKAGE_LIST}.frozen ${LLX_XENIAL_MIRROR}/conf/i386-frozen.txt
160    cp ${AMD64_CHROOT}/${PACKAGE_LIST}.frozen ${LLX_XENIAL_MIRROR}/conf/amd64-frozen.txt
161   
162else
163    echo "Nothing to do."
164fi
165
166
Note: See TracBrowser for help on using the repository browser.