lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GUB: add architecture compatibility check. (issue3235042)


From: v . villenave
Subject: GUB: add architecture compatibility check. (issue3235042)
Date: Sun, 21 Nov 2010 18:04:09 +0000

Reviewers: jan.nieuwenhuizen,

Message:
Greetings Jan, hi everybody,

These days, GNU/Linux has become so affordable for non-tech-savvy users
that most of them haven't the faintest idea whether they're running an
x86 or x86_64 OS. Ubuntu, for example, in their most user-friendly
installer Wubi, choose the architecture without even telling (let alone
asking) you about it.

This patch aims to make it harder for new users to install an
inappropriate build on their systems.

Description:
GUB: add architecture compatibility check.

Please review this at http://codereview.appspot.com/3235042/

Affected files:
  M gub/commands.py
  sourcefiles/lilypond-sharhead.sh


Index: gub/commands.py
diff --git a/gub/commands.py b/gub/commands.py
index ade6f47332c31191c45535929946896a4a908506..adc0e5bc9cea67e2479c78dc61f294b5453cfcc4 100644
--- a/gub/commands.py
+++ b/gub/commands.py
@@ -456,7 +456,7 @@ class CreateShar (SerializedCommand):
         header_length = 0
         _z = misc.compression_flag (tarball)
         header_length = len (script % locals ()) + 1
- used_in_sharhead = '%(base_file)s %(name)s %(pretty_name)s %(version)s %(release)s %(header_length)s %(_z)s' + used_in_sharhead = '%(base_file)s %(name)s %(pretty_name)s %(version)s %(release)s %(header_length)s %(target_cpu)s %(_z)s'
         used_in_sharhead % locals ()
         loggedos.dump_file (logger, script % locals (), shar_file)
loggedos.system (logger, 'cat %(tarball)s >> %(shar_file)s' % locals ())
Index: sourcefiles/lilypond-sharhead.sh
diff --git a/sourcefiles/lilypond-sharhead.sh b/sourcefiles/lilypond-sharhead.sh index d7945d7c4f362c651d3eb61a9f1fc53f0cf1d4c3..09e18ae71a5bb57c3d32633b03a40d87e199bc77 100644
--- a/sourcefiles/lilypond-sharhead.sh
+++ b/sourcefiles/lilypond-sharhead.sh
@@ -5,6 +5,8 @@ root="$HOME"
 doc=no
 extract=no
 interactive=yes
+arch=$(uname -m)
+shopt -s nocasematch

 if test `id -u` = "0"; then
     root=/usr/local
@@ -60,18 +62,44 @@ done

 cat <<EOF

-%(name)s installer for version %(version)s release %(release)s.
+%(name)s installer for version %(version)s release %(release)s,
+%(target_cpu)s build.
 For a list of options, abort (^C) then do:
 sh $me --help

 EOF

+if test "$arch" != "%(target_cpu)s"; then
+    cat <<EOF
+
+Warning: this build is not optimized for your architecture;
+please install a ${arch} build instead.
+
+Press C to install the program anyway (not recommended),
+E to only extract the program files, or any other key to exit.
+EOF
+    read -sn1 input
+    case "$input" in
+       C)
+         echo "Ignoring architecture incompatibility."
+       ;;
+       E)
+         extract=yes;
+       ;;
+       *)
+         exit 1
+       ;;
+    esac
+fi
+
+
 if test "$extract" = "yes"; then
     echo "extracting %(base_file)s"
     tail -c+%(header_length)012d $0 > %(base_file)s
     exit 0
 fi

+
 if test "$interactive" = "yes"; then
     cat <<EOF






reply via email to

[Prev in Thread] Current Thread [Next in Thread]