[PATCH 1/6] Concentrated some cp commands

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/6] Concentrated some cp commands

Christos Kotsis
---
 targets/livecd-stage2/livecd-stage2-controller.sh | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/targets/livecd-stage2/livecd-stage2-controller.sh b/targets/livecd-stage2/livecd-stage2-controller.sh
index 10ee98e..16a9071 100755
--- a/targets/livecd-stage2/livecd-stage2-controller.sh
+++ b/targets/livecd-stage2/livecd-stage2-controller.sh
@@ -42,12 +42,9 @@ case $1 in
  echo "${clst_livecd_type}. You should switch to using"
  echo "generic-livecd instead."
  fi
- cp -pPR ${clst_sharedir}/livecd/files/generic.motd.txt \
- ${clst_sharedir}/livecd/files/universal.motd.txt \
- ${clst_sharedir}/livecd/files/minimal.motd.txt \
- ${clst_sharedir}/livecd/files/livecd.motd.txt \
- ${clst_sharedir}/livecd/files/gamecd.motd.txt \
- ${clst_chroot_path}/etc
+ cp -pPR ${clst_sharedir}/livecd/files/{generic.motd.txt,universal.motd.txt,minimal.motd.txt} ${clst_chroot_path}/etc
+ cp -pPR ${clst_sharedir}/livecd/files/{livecd.motd.txt,gamecd.motd.txt} ${clst_chroot_path}/etc
+
  ;;
  *)
  if [ -n "${clst_livecd_motd}" ]
@@ -147,8 +144,7 @@ case $1 in
  exit 1
  fi
  fi
- cp -f ${clst_snapshot_path} $1/snapshots
- cp -f ${clst_snapshot_path}.DIGESTS $1/snapshots
+ cp -f ${clst_snapshot_path}{,.DIGESTS} $1/snapshots
  ;;
  gentoo-release-livedvd)
  targets="distfiles snapshots stages"
@@ -171,8 +167,7 @@ case $1 in
  continue
  ;;
  snapshots)
- cp -f ${clst_snapshot_path} $1/snapshots
- cp -f ${clst_snapshot_path}.DIGESTS $1/snapshots
+ cp -f ${clst_snapshot_path}{,.DIGESTS} $1/snapshots
  ;;
  stages)
  ### TODO: make this copy stages
--
2.10.2


Reply | Threaded
Open this post in threaded view
|

[PATCH 2/6] updated gitignore with patches directory

Christos Kotsis
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index d52b297..0fdc052 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ dist
 build
 files
 MANIFEST
+patches
--
2.10.2


Reply | Threaded
Open this post in threaded view
|

[PATCH 4/6] Added some loops

Christos Kotsis
In reply to this post by Christos Kotsis
---
 targets/support/bootloader-setup.sh | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh
index d9e2620..97920e7 100755
--- a/targets/support/bootloader-setup.sh
+++ b/targets/support/bootloader-setup.sh
@@ -7,8 +7,7 @@ source ${clst_shdir}/support/filesystem-functions.sh
 
 extract_cdtar $1
 extract_kernels $1/boot
-check_bootargs
-check_filesystem_type
+check_{bootargs,filesystem_type}
 
 default_append_line="root=/dev/ram0 init=/linuxrc ${cmdline_opts} ${custom_kopts} cdroot"
 [ -n "${clst_splash_theme}" ] && default_append_line="${default_append_line} splash=silent,theme:${clst_livecd_splash_theme} CONSOLE=/dev/tty1 quiet"
@@ -274,15 +273,13 @@ case ${clst_hostarch} in
  echo "prompt 1" >> ${icfg}
  echo "display boot.msg" >> ${icfg}
  echo "F1 kernels.msg" >> ${icfg}
- echo "F2 F2.msg" >> ${icfg}
- echo "F3 F3.msg" >> ${icfg}
- echo "F4 F4.msg" >> ${icfg}
- echo "F5 F5.msg" >> ${icfg}
- echo "F6 F6.msg" >> ${icfg}
- echo "F7 F7.msg" >> ${icfg}
+ for k in {2..7}
+ do
+ echo "F${k} F${k}.msg" >> ${icfg}
+ done
 
  echo "Available kernels:" > ${kmsg}
- for i in 2 3 4 5 6 7
+ for i in {2..7}
  do
  cp ${clst_sharedir}/livecd/files/x86-F$i.msg \
  $1/isolinux/F$i.msg
@@ -303,7 +300,6 @@ case ${clst_hostarch} in
  echo "label ${x}-${y}" >> ${icfg}
  echo "  kernel ${x}" >> ${icfg}
  echo "  append ${default_append_line} softlevel=${y} initrd=${x}.igz vga=791" >> ${icfg}
-
  echo >> ${icfg}
  echo "   ${x}" >> ${kmsg}
  echo "label ${x}-${y}-nofb" >> ${icfg}
@@ -475,11 +471,9 @@ case ${clst_hostarch} in
  # Next, figure out what kernels were specified in the
  # spec file, and generate the appropriate arcload conf
  # blocks specific to each system
- ip22="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip22" | tr "\n" " ")"
- ip27="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip27" | tr "\n" " ")"
- ip28="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip28" | tr "\n" " ")"
- ip30="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip30" | tr "\n" " ")"
- ip32="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip32" | tr "\n" " ")"
+ for l in 22 27 28 30 32; do
+ ip${l}="$(echo ${clst_boot_kernel} | tr " " "\n" | grep "ip${l}" | tr "\n" " ")"
+ done
 
  if [ -n "${ip22}" ]; then
  echo -e "${ip22base}" >> ${scratch}/arc.cf
--
2.10.2


Reply | Threaded
Open this post in threaded view
|

[PATCH 5/6] ln,echo and cp commands concentration

Christos Kotsis
In reply to this post by Christos Kotsis
---
 targets/support/livecdfs-update.sh | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/targets/support/livecdfs-update.sh b/targets/support/livecdfs-update.sh
index 31cdf04..ee0d813 100755
--- a/targets/support/livecdfs-update.sh
+++ b/targets/support/livecdfs-update.sh
@@ -78,10 +78,9 @@ fi
 
 # Setup links for ethernet devices
 cd /etc/init.d
-ln -sf net.lo net.eth1
-ln -sf net.lo net.eth2
-ln -sf net.lo net.eth3
-ln -sf net.lo net.eth4
+for i in {1..4}; do
+ln -sf net.lo net.eth${i}
+done
 
 # Add this for hwsetup/mkx86config
 mkdir -p /etc/sysconfig
@@ -105,13 +104,10 @@ fi
 
 # Tweak the livecd make.conf so that users know not to edit it
 # https://bugs.gentoo.org/144647
-mv ${clst_make_conf} ${clst_make_conf}.old
-echo "####################################################" >> ${clst_make_conf}
-echo "## ATTENTION: THIS IS THE MAKE.CONF ON THE LIVECD ##" >> ${clst_make_conf}
-echo "## PLEASE EDIT /mnt/gentoo${clst_make_conf} INSTEAD  ##" >> ${clst_make_conf}
-echo "####################################################" >> ${clst_make_conf}
-cat ${clst_make_conf}.old >> ${clst_make_conf}
-
+echo -e "####################################################\n$(cat ${clst_make_conf})" > ${clst_make_conf}
+echo -e "## PLEASE EDIT /mnt/gentoo${clst_make_conf} INSTEAD  ##\n$(cat ${clst_make_conf})" > ${clst_make_conf}
+echo -e "## ATTENTION: THIS IS THE MAKE.CONF ON THE LIVECD ##\n$(cat ${clst_make_conf})" > ${clst_make_conf}
+echo -e "####################################################\n$(cat ${clst_make_conf})" > ${clst_make_conf}
 # devfs tweaks
 [ -e /etc/devfsd.conf ] && sed -i '/dev-state/ s:^:#:' /etc/devfsd.conf
 
@@ -299,8 +295,7 @@ case ${clst_livecd_type} in
  USE="-* $(cat /var/db/pkg/sys-libs/glibc*/USE)" emerge -eqp @system | grep -e '^\[ebuild' | sed -e 's:^\[ebuild .\+\] ::' -e 's: .\+$::' > /usr/livecd/systempkgs.txt
 
  # This is my hack to reduce tmpfs usage
- cp -r ${clst_repo_basedir}/${clst_repo_name}/profiles /usr/livecd
- cp -r ${clst_repo_basedir}/${clst_repo_name}/eclass /usr/livecd
+ cp -r ${clst_repo_basedir}/${clst_repo_name}/{profiles,eclass} /usr/livecd
  rm -rf /usr/livecd/profiles/{co*,default-{1*,a*,b*,d*,h*,i*,m*,p*,s*,x*},g*,hardened-*,n*,x*}
  mv -f /etc/gconf /usr/livecd
  ln -sf /usr/livecd/gconf /etc/gconf
@@ -327,10 +322,7 @@ case ${clst_livecd_type} in
  # Copy our installer icons
  if [ -e /usr/share/applications/installer-gtk.desktop ]
  then
- cp -f /usr/share/applications/installer-gtk.desktop \
- /home/${username}/Desktop
- cp -f /usr/share/applications/installer-dialog.desktop \
- /home/${username}/Desktop
+ cp -f /usr/share/applications/{installer-gtk.desktop,installer-dialog.desktop} /home/${username}/Desktop
  sed -i -e \
  's:Exec=installer-dialog:Exec=sudo installer-dialog:' \
  /home/${username}/Desktop/installer-dialog.desktop
--
2.10.2


Reply | Threaded
Open this post in threaded view
|

[PATCH 6/6] changed mkdir line for kernels/misc

Christos Kotsis
In reply to this post by Christos Kotsis
---
 targets/support/netboot2-final.sh | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/targets/support/netboot2-final.sh b/targets/support/netboot2-final.sh
index ebd5187..e6566a1 100755
--- a/targets/support/netboot2-final.sh
+++ b/targets/support/netboot2-final.sh
@@ -3,13 +3,11 @@
 source ${clst_shdir}/support/functions.sh
 source ${clst_shdir}/support/filesystem-functions.sh
 
-
 extract_kernels ${clst_target_path}/boot
 
 # Move kernel binaries to ${clst_target_path}/kernels, and
 # move everything else to ${clst_target_path}/kernels/misc
-mkdir ${clst_target_path}/kernels
-mkdir ${clst_target_path}/kernels/misc
+mkdir -p ${clst_target_path}/kernels/misc
 
 for x in ${clst_boot_kernel}; do
  mv ${clst_target_path}/boot/${x} ${clst_target_path}/kernels
--
2.10.2


Reply | Threaded
Open this post in threaded view
|

[PATCH 3/6] Concentrated export&delete_from_root lines

Christos Kotsis
In reply to this post by Christos Kotsis
---
 targets/grp/grp-chroot.sh               | 3 +--
 targets/netboot2/netboot2-controller.sh | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/targets/grp/grp-chroot.sh b/targets/grp/grp-chroot.sh
index 6690c91..5b56fff 100755
--- a/targets/grp/grp-chroot.sh
+++ b/targets/grp/grp-chroot.sh
@@ -5,8 +5,7 @@ source /tmp/chroot-functions.sh
 ## START BUILD
 setup_pkgmgr
 
-export DISTDIR="/tmp/grp/${clst_grp_target}"
-export PKGDIR="/tmp/grp/${clst_grp_target}"
+export {DISTDIR,PKGDIR}="/tmp/grp/${clst_grp_target}"
 
 if [ "${clst_grp_type}" = "pkgset" ]
 then
diff --git a/targets/netboot2/netboot2-controller.sh b/targets/netboot2/netboot2-controller.sh
index 322d9a8..3bf4982 100755
--- a/targets/netboot2/netboot2-controller.sh
+++ b/targets/netboot2/netboot2-controller.sh
@@ -39,8 +39,7 @@ case ${1} in
 
  exec_in_chroot ${clst_shdir}/support/kmerge.sh
 
- delete_from_chroot tmp/linuxrc
- delete_from_chroot tmp/busy-config
+ delete_from_chroot tmp/{linuxrc,busy-config}
 
  extract_modules ${clst_chroot_path} ${clst_kname}
  #16:12 <@solar> kernel_name=foo
--
2.10.2


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 2/6] updated gitignore with patches directory

Mike Frysinger
In reply to this post by Christos Kotsis
On 12 Apr 2017 11:43, Christos Kotsi wrote:
> --- a/.gitignore
> +++ b/.gitignore
> @@ -3,3 +3,4 @@ dist
>  build
>  files
>  MANIFEST
> +patches

this isn't a patches directory, it's any dir or file named "patches" anywhere in
the source tree.  you need to anchor it properly like:
/patches/
-mike

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 5/6] ln,echo and cp commands concentration

Mike Frysinger
In reply to this post by Christos Kotsis
On 12 Apr 2017 11:43, Christos Kotsi wrote:

>  # Tweak the livecd make.conf so that users know not to edit it
>  # https://bugs.gentoo.org/144647
> -mv ${clst_make_conf} ${clst_make_conf}.old
> -echo "####################################################" >> ${clst_make_conf}
> -echo "## ATTENTION: THIS IS THE MAKE.CONF ON THE LIVECD ##" >> ${clst_make_conf}
> -echo "## PLEASE EDIT /mnt/gentoo${clst_make_conf} INSTEAD  ##" >> ${clst_make_conf}
> -echo "####################################################" >> ${clst_make_conf}
> -cat ${clst_make_conf}.old >> ${clst_make_conf}
> -
> +echo -e "####################################################\n$(cat ${clst_make_conf})" > ${clst_make_conf}
> +echo -e "## PLEASE EDIT /mnt/gentoo${clst_make_conf} INSTEAD  ##\n$(cat ${clst_make_conf})" > ${clst_make_conf}
> +echo -e "## ATTENTION: THIS IS THE MAKE.CONF ON THE LIVECD ##\n$(cat ${clst_make_conf})" > ${clst_make_conf}
> +echo -e "####################################################\n$(cat ${clst_make_conf})" > ${clst_make_conf}
this is not an improvement:
- the constant cat at the end is ugly
- use of `echo -e` is discouraged
- you've incorrectly changed some things to tabs

you could write it instead:
old_conf=$(cat "${clst_make_conf}")
(
  echo ...all...
  echo ...the...
  echo ...things...
  echo "${old_conf}"
) > "${clst_make_conf}"
-mike

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 3/6] Concentrated export&delete_from_root lines

Mike Frysinger
In reply to this post by Christos Kotsis
On 12 Apr 2017 11:43, Christos Kotsi wrote:
> -export DISTDIR="/tmp/grp/${clst_grp_target}"
> -export PKGDIR="/tmp/grp/${clst_grp_target}"
> +export {DISTDIR,PKGDIR}="/tmp/grp/${clst_grp_target}"

don't use brace expansion with export.  if you want to avoid duplicating,
set one var to the other var.
-mike

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/6] Concentrated some cp commands

Mike Frysinger
In reply to this post by Christos Kotsis
On 12 Apr 2017 11:43, Christos Kotsi wrote:
> - cp -pPR ${clst_sharedir}/livecd/files/generic.motd.txt \
> - ${clst_sharedir}/livecd/files/universal.motd.txt \
> - ${clst_sharedir}/livecd/files/minimal.motd.txt \
> - ${clst_sharedir}/livecd/files/livecd.motd.txt \
> - ${clst_sharedir}/livecd/files/gamecd.motd.txt \
> - ${clst_chroot_path}/etc
> + cp -pPR ${clst_sharedir}/livecd/files/{generic.motd.txt,universal.motd.txt,minimal.motd.txt} ${clst_chroot_path}/etc
> + cp -pPR ${clst_sharedir}/livecd/files/{livecd.motd.txt,gamecd.motd.txt} ${clst_chroot_path}/etc

if you're moving to braces, you can further combine substrings here:
        {generic,universal,minimal,.....}.motd.txt

alternatively, why don't we just glob *.motd.txt ?
-mike

signature.asc (849 bytes) Download Attachment