summaryrefslogtreecommitdiff
blob: 5726bf55f7da101e94bba541736829af5b1a2cfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
From c9f605cb4a3903985f2c6f816c30c1edf728c1b5 Mon Sep 17 00:00:00 2001
From: Jon Salz <jsalz@google.com>
Date: Mon, 27 Jan 2014 16:04:33 +0800
Subject: [PATCH] Add --help-header option to prepend a string to the archive's
 --help.

---
 makeself-header.sh |  3 ++-
 makeself.sh        | 71 ++++++++++++++++++++++++++++++------------------------
 2 files changed, 41 insertions(+), 33 deletions(-)

diff --git a/makeself-header.sh b/makeself-header.sh
index e3f6c11..f97758c 100755
--- a/makeself-header.sh
+++ b/makeself-header.sh
@@ -13,6 +13,7 @@ label="$LABEL"
 script="$SCRIPT"
 scriptargs="$SCRIPTARGS"
 licensetxt="$LICENSE"
+helpheader='$HELPHEADER'
 targetdir="$archdirname"
 filesizes="$filesizes"
 keep="$KEEP"
@@ -119,7 +120,7 @@ MS_dd_Progress()
 MS_Help()
 {
     cat << EOH >&2
-Makeself version $MS_VERSION
+\${helpheader}Makeself version $MS_VERSION
  1) Getting help or info about \$0 :
   \$0 --help   Print this message
   \$0 --info   Print embedded info : title, default target directory, embedded script ...
diff --git a/makeself.sh b/makeself.sh
index 361d710..cb2d6f2 100755
--- a/makeself.sh
+++ b/makeself.sh
@@ -88,38 +88,39 @@ MS_Usage()
 {
     echo "Usage: $0 [params] archive_dir file_name label startup_script [args]"
     echo "params can be one or more of the following :"
-    echo "    --version | -v  : Print out Makeself version number and exit"
-    echo "    --help | -h     : Print out this help message"
-    echo "    --quiet | -q    : Do not print any messages other than errors."
-    echo "    --gzip          : Compress using gzip (default if detected)"
-    echo "    --bzip2         : Compress using bzip2 instead of gzip"
-    echo "    --pbzip2        : Compress using pbzip2 instead of gzip"
-    echo "    --xz            : Compress using xz instead of gzip"
-    echo "    --compress      : Compress using the UNIX 'compress' command"
-    echo "    --complevel lvl : Compression level for gzip xz bzip2 and pbzip2 (default 9)"
-    echo "    --base64        : Instead of compressing, encode the data using base64"
-    echo "    --nocomp        : Do not compress the data"
-    echo "    --notemp        : The archive will create archive_dir in the"
-    echo "                      current directory and uncompress in ./archive_dir"
-    echo "    --copy          : Upon extraction, the archive will first copy itself to"
-    echo "                      a temporary directory"
-    echo "    --append        : Append more files to an existing Makeself archive"
-    echo "                      The label and startup scripts will then be ignored"
-    echo "    --target dir    : Extract directly to a target directory"
-    echo "                      directory path can be either absolute or relative"
-    echo "    --current       : Files will be extracted to the current directory"
-    echo "                      Both --current and --target imply --notemp"
-    echo "    --tar-extra opt : Append more options to the tar command line"
-    echo "    --nomd5         : Don't calculate an MD5 for archive"
-    echo "    --nocrc         : Don't calculate a CRC for archive"
-    echo "    --header file   : Specify location of the header script"
-    echo "    --follow        : Follow the symlinks in the archive"
-    echo "    --noprogress    : Do not show the progress during the decompression"
-    echo "    --nox11         : Disable automatic spawn of a xterm"
-    echo "    --nowait        : Do not wait for user input after executing embedded"
-    echo "                      program from an xterm"
-    echo "    --lsm file      : LSM file describing the package"
-    echo "    --license file  : Append a license file"
+    echo "    --version | -v     : Print out Makeself version number and exit"
+    echo "    --help | -h        : Print out this help message"
+    echo "    --quiet | -q       : Do not print any messages other than errors."
+    echo "    --gzip             : Compress using gzip (default if detected)"
+    echo "    --bzip2            : Compress using bzip2 instead of gzip"
+    echo "    --pbzip2           : Compress using pbzip2 instead of gzip"
+    echo "    --xz               : Compress using xz instead of gzip"
+    echo "    --compress         : Compress using the UNIX 'compress' command"
+    echo "    --complevel lvl    : Compression level for gzip xz bzip2 and pbzip2 (default 9)"
+    echo "    --base64           : Instead of compressing, encode the data using base64"
+    echo "    --nocomp           : Do not compress the data"
+    echo "    --notemp           : The archive will create archive_dir in the"
+    echo "                         current directory and uncompress in ./archive_dir"
+    echo "    --copy             : Upon extraction, the archive will first copy itself to"
+    echo "                         a temporary directory"
+    echo "    --append           : Append more files to an existing Makeself archive"
+    echo "                         The label and startup scripts will then be ignored"
+    echo "    --target dir       : Extract directly to a target directory"
+    echo "                         directory path can be either absolute or relative"
+    echo "    --current          : Files will be extracted to the current directory"
+    echo "                         Both --current and --target imply --notemp"
+    echo "    --tar-extra opt    : Append more options to the tar command line"
+    echo "    --nomd5            : Don't calculate an MD5 for archive"
+    echo "    --nocrc            : Don't calculate a CRC for archive"
+    echo "    --header file      : Specify location of the header script"
+    echo "    --follow           : Follow the symlinks in the archive"
+    echo "    --noprogress       : Do not show the progress during the decompression"
+    echo "    --nox11            : Disable automatic spawn of a xterm"
+    echo "    --nowait           : Do not wait for user input after executing embedded"
+    echo "                         program from an xterm"
+    echo "    --lsm file         : LSM file describing the package"
+    echo "    --license file     : Append a license file"
+    echo "    --help-header file : Add a header to the archive's --help output"
     echo
     echo "Do not forget to give a fully qualified startup script name"
     echo "(i.e. with a ./ prefix if inside the archive)."
@@ -254,6 +255,12 @@ do
 	LSM_CMD="cat \"$2\" >> \"\$archname\""
     if ! shift 2; then MS_Help; exit 1; fi
 	;;
+    --help-header)
+	HELPHEADER=`sed -e "s/'/'\\\\\''/g" $2`
+    if ! shift 2; then MS_Help; exit 1; fi
+	[ -n "$HELPHEADER" ] && HELPHEADER="$HELPHEADER
+"
+    ;;
     -q | --quiet)
 	QUIET=y
 	shift
-- 
1.8.5.5