[lxc-devel] [PATCH] plamo: Improve template

KATOH Yasufumi karma at jazz.email.ne.jp
Tue Jan 21 07:46:46 UTC 2014


Allow to specify additional packages

Signed-off-by: TAMUKI Shoichi <tamuki at linet.gr.jp>
Signed-off-by: KATOH Yasufumi <karma at jazz.email.ne.jp>
---
 templates/lxc-plamo.in | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/templates/lxc-plamo.in b/templates/lxc-plamo.in
index 354cad9..c5a02ee 100644
--- a/templates/lxc-plamo.in
+++ b/templates/lxc-plamo.in
@@ -31,12 +31,13 @@
 [ -r /etc/default/lxc ] && . /etc/default/lxc
 
 DLSCHEME=${DLSCHEME:-"http"}
-MIRRORSRV=${MIRRORSRV:-"ftp.ring.gr.jp"}
+MIRRORSRV=${MIRRORSRV:-"www.ring.gr.jp"}
 MIRRORPATH=${MIRRORPATH:-"/pub/linux/Plamo"}
 CATEGORIES=${CATEGORIES:-"00_base 01_minimum"}
-EXTRACTGRS=${EXTRACTGRS:-"Hamradio"}
+EXTRACTGRS=${EXTRACTGRS:-""}
 IGNOREPKGS=${IGNOREPKGS:-"grub kernel lilo linux_firmware microcode_ctl
-    cpufreqd cpufrequtils gpm cqrlog hamlib fldigi"}
+    cpufreqd cpufrequtils gpm"}
+ADDONPKGS=${ADDONPKGS:-"`echo contrib/Hamradio/{morse,qrq}`"}
 
 download_plamo() {
   # check the mini plamo was not already downloaded
@@ -49,9 +50,11 @@ download_plamo() {
   cd $ptcache
   case $DLSCHEME in http) depth=2 ;; ftp) depth=3 ;; esac
   rej=${IGNOREPKGS%% *} ; [ -n "$rej" ] && rej="$rej-*"
-  for p in ${IGNOREPKGS#* } ; do rej="$rej,$p-*" ; done
+  if [ `echo $IGNOREPKGS | wc -w` -ne 1 ] ; then
+    for p in ${IGNOREPKGS#* } ; do rej="$rej,$p-*" ; done
+  fi
   for i in $CATEGORIES ; do
-    wget -nv -e robots=off -r -l $depth -nd -A .tgz,.txz -R $rej \
+    wget -nv -e robots=off -r -l $depth -nd -A .tgz,.txz -R "$rej" \
         -I $MIRRORPATH/Plamo-$release/$arch/plamo/$i \
         -X $MIRRORPATH/Plamo-$release/$arch/plamo/$i/old \
         $DLSCHEME://$MIRRORSRV$MIRRORPATH/Plamo-$release/$arch/plamo/$i
@@ -61,7 +64,7 @@ download_plamo() {
     fi
   done
   for i in $EXTRACTGRS ; do
-    wget -nv -e robots=off -r -l $depth -nd -A .tgz,.txz -R $rej \
+    wget -nv -e robots=off -r -l $depth -nd -A .tgz,.txz -R "$rej" \
         -I $MIRRORPATH/Plamo-$release/$arch/contrib/$i \
         -X $MIRRORPATH/Plamo-$release/$arch/contrib/$i/old \
         $DLSCHEME://$MIRRORSRV$MIRRORPATH/Plamo-$release/$arch/contrib/$i
@@ -70,6 +73,16 @@ download_plamo() {
       return 1
     fi
   done
+  for p in $ADDONPKGS ; do
+    wget -nv -e robots=off -r -l $depth -nd -A "`basename $p`-*" \
+        -I $MIRRORPATH/Plamo-$release/$arch/`dirname $p` \
+        -X $MIRRORPATH/Plamo-$release/$arch/`dirname $p`/old \
+        $DLSCHEME://$MIRRORSRV$MIRRORPATH/Plamo-$release/$arch/`dirname $p`
+    if [ $? -ne 0 ] ; then
+      echo "Failed to download the rootfs, aborting."
+      return 1
+    fi
+  done
   mv $ptcache $dlcache
   echo "Download complete."
   return 0
-- 
1.8.4.4



More information about the lxc-devel mailing list