forked from giuliomoro/checkinstall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkinstall.in
executable file
·2904 lines (2381 loc) · 83.9 KB
/
checkinstall.in
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
##############################################################################
# $Id: checkinstall,v 1.6.3.1 2010/02/10 14:42:32 izto Exp $
# ########################
#
#
# CheckInstall v1.6.3
#
# Installs a compiled program from the program's source directory using
# "make install" or any other command supplied on checkinstall's command
# line. checkinstall will create a Slackware, RPM or Debian compatible package
# named after the source directory's name and install it using your standard
# package administration utilities.
#
# This version of checkinstall needs enough free space on the partition
# holding the temp dir (see BASE_TEMP_DIR below) to write there a temporary
# copy of the package.
#
# Copyright (C) 2010 Felipe Eduardo Sanchez Diaz Duran <[email protected]>
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the version 2 of the GNU General Public License
# as published by the Free Software Foundation
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
############################################################################
# Trap the INT signal (ctrl-c, for example)
trap trapint 2
CHECKINSTALL_VERSION=1.6.3
# locate the file or directory that the parameter corresponds to;
# always prints absolute path
function followlinks () {
local entry="$1"
local symlink
case "$entry" in /*) true ;;
*) entry="`pwd`/$entry";;
esac
if [ -L "$entry" ]; then
symlink=`ls -l "$entry" | sed -e 's/.* -> //'`
case "$symlink" in /*) entry="$symlink";;
*) entry=`dirname "$entry"`/$symlink;;
esac
followlinks "$entry"
else
echo "$entry"
fi
}
INSTALLDIR=MAKEFILE_PREFIX
# gettext variables
export TEXTDOMAINDIR="$INSTALLDIR"/lib/checkinstall/locale
export TEXTDOMAIN=checkinstall
# .spec file path
DIRECTORIO_FUENTE=`pwd`
PKG_BASENAME="`basename "$DIRECTORIO_FUENTE"`"
SPEC_PATH=${PKG_BASENAME}.spec
#############################################################################
# Function definitions #
########################
# Enable alias expansion in command substitution
shopt -s expand_aliases
# Vefify that we have gettext available
gettext "Bye." &> /dev/null
if [ $? -gt 0 ]; then
alias ck_gettext="echo -e"
else
alias ck_gettext="gettext -s --"
fi
## gettext echo with newline at the end
function echog() {
local format="$1"
shift
printf -- "$(ck_gettext "$format")\n" "$@" >&2
}
## gettext echo with NO newline at the end
function echogn() {
local format="$1"
shift
printf -- "$(ck_gettext "$format")" "$@" >&2
}
function ckversion {
echo
echo "checkinstall $CHECKINSTALL_VERSION, Copyright 2010 Felipe Eduardo Sanchez Diaz Duran"
echog " This software is released under the GNU GPL."
}
function usage() {
# If the user has a default pager defined in the PAGER environment variable,
# we'll use that. If not, we'll use "more".
! [ "$PAGER" ] && PAGER=more
echo
echog "Usage: checkinstall [options] [command [command arguments]]"
echog "Options:"
echo
echog "*Package type selection*"
echo
echog "-t,--type=<slackware|rpm|debian> Choose packaging system"
echog "-S Build a Slackware package"
echog "-R Build a RPM package"
echog "-D Build a Debian package"
echo
echog "*Install options*"
echo
echog "--install=<yes|no> Toggle created package installation"
echog "--fstrans=<yes|no> Enable/disable the filesystem translation code"
echo
echog "*Scripting options*"
echo
echog "-y, --default Accept default answers to all questions"
echog "--pkgname=<name> Set name"
echog "--pkgversion=<version> Set version"
echog "-A, --arch, --pkgarch=<arch> Set architecture"
echog "--pkgrelease=<release> Set release"
echog "--pkglicense=<license> Set license"
echog "--pkggroup=<group> Set software group"
echog "--pkgsource=<source> Set source location"
echog "--pkgaltsource=<altsource> Set alternate source location"
echog "--pakdir=<directory> The new package will be saved here"
echog "--maintainer=<email addr> The package maintainer (.deb)"
echog "--provides=<list> Features provided by this package"
echog "--requires=<list> Features required by this package"
echog "--recommends=<list> Features recommended by this package"
echog "--suggests=<list> Features suggested by this package"
echog "--conflicts=<list> Packages that this package cannot be installed with (.deb)"
echog "--replaces=<list> Packages that this package replaces (.deb)"
echog "--rpmflags=<flags> Pass this flags to the rpm installer"
echog "--rpmi Use the -i flag for rpm when installing a .rpm"
echog "--rpmu Use the -U flag for rpm when installing a .rpm"
echog "--dpkgflags=<flags> Pass this flags to the dpkg installer"
echog "--spec=<path> .spec file location"
echog "--nodoc Do not include documentation files"
echo
echog "*Info display options*"
echo
echog "-d<0|1|2> Set debug level"
echog "-si Run an interactive install command"
echog "--showinstall=<yes|no> Toggle interactive install command"
echog "-ss Run an interactive Slackware installation script"
echog "--showslack=<yes|no> Toggle interactive Slackware installation script"
echo
echog "*Package tuning options*"
echo
echog "--autodoinst=<yes|no> Toggle the creation of a doinst.sh script"
echog "--strip=<yes|no> Strip any ELF binaries found inside the package"
echog "--stripso=<yes|no> Strip any ELF binary libraries (.so files)"
echog "--addso=<yes|no> Search for any shared libs and add"
echog " them to /etc/ld.so.conf"
echog "--reset-uids=<yes|no> Reset perms for all files/dirs to 755 and"
echog " the owner/group for all dirs to root.root"
echog "--gzman=<yes|no> Compress any man pages found inside the package"
echog "--docdir=<path> Where to put documentation files"
echog " The package name+version gets automatically appended."
echog " To avoid that prefix the path with a colon (:)."
echog "--umask=<mask> Set the umask value"
echog "--exclude=<file|dir[,...]> Exclude these files/directories from the package"
echog "--include=<listfile> Force the inclusion in the package of the"
echog " files/dirs listed in \"listfile\""
echog "--inspect Inspect the package's file list"
echog "--review-spec Review the spec file before creating a .rpm"
echog "--review-control Review the control file before creating a .deb"
echog "--newslack Use the new (8.1+) Slackware description format"
echog " (\"--newslack\" implies \"-S\")"
echog "--with-tar=/path/to/tar Manually set the path to the tar binary"
echog " in this system"
echo
echog "*Cleanup options*"
echo
echog "--deldoc=<yes|no> Delete doc-pak upon termination"
echog "--deldesc=<yes|no> Delete description-pak upon termination"
echog "--delspec=<yes|no> Delete spec file upon termination"
echog "--bk Backup any overwritten files"
echog "--backup=<yes|no> Toggle backup"
echo
echog "*About CheckInstall*"
echo
echog "--help, -h Show this message"
echog "--copyright Show Copyright information"
echog "--version Show version information"
echo
exit 1
}
function help_notice() {
echo
echog "Use --help or -h to get more information"
echo
exit 1
}
function boolean_usage() {
echo
echog "%s is an invalid value for %s" "$2" "$1"
help_notice
exit 1
}
# 001117-BaP: Define a function or two
function yorn {
if [ "$1" ]; then # If there is no default value specified
DEFAULTYN="$1" # then the default is "y"
else
DEFAULTYN="y"
fi
DEFAULTYN=`echo $DEFAULTYN | tr 'A-Z' 'a-z'`
if [ "$DEFAULTYN" = "y" ]; then
echo -n " [y]: " # Print the default option
else
echo -n " [n]: "
fi
if [ $ACCEPT_DEFAULT -eq 0 ]; then # Should we accept all the defaults?
read YN
YN=`echo $YN | tr 'A-Z' 'a-z'`
! [ "$YN" ] && YN=$DEFAULTYN # If the user pressed ENTER then
else
YN=$DEFAULTYN
echo $YN
fi
if [ "$YN" = "y" ] ;then # We return something useful for a
return 0 # simpler sintax ahead (12/dic/2000-Izto)
else
return 1
fi
}
# dec/10/2000-Izto
# Prints OK or FAILED! depending on previous command return value
function okfail () {
if [ $? -gt 0 ]; then
echog ' FAILED!'
return 1
else
echog 'OK'
return 0
fi
}
function restore_backup {
# If we have translation turned on then we didn't do a backup
if [ "${TRANSLATE}" = "1" ]; then return 0; fi
# Else, restore the backup if it exists
rm -rf ${TMP_DIR}/BACKUP/no-backup &> /dev/null
ls ${TMP_DIR}/BACKUP/* &> /dev/null
if [ $? -eq 0 ]; then
echogn "Restoring overwritten files from backup..."
cd ${TMP_DIR}/BACKUP
files=$(ls -A)
$TAR -cpf - $files | $TAR -f - -xvpC / &> /dev/null
okfail
echo
fi
}
function trapint {
echo
echo
echog "*** SIGINT received ***"
cleanup
}
function cleanup {
echo
restore_backup
echogn "Cleaning up..."
cd "$DIRECTORIO_FUENTE"
[ -n "${BUILDROOT}" ] && [ -d ${BUILDROOT} ] && rm -rf "${BUILDROOT}"
if [ "$DEBUG" -eq 0 ]; then
[ -n "${TMP_DIR}" ] && [ -d ${TMP_DIR} ] && rm -rf ${TMP_DIR}
rm -f checkinstall-debug*
else
echogn "(Debugging mode on, KEEPING temp dir $TMP_DIR)..."
fi
[ -n "${RPMSOURCEDIR}" ] &&
[ -f "${RPMSOURCEDIR}/SOURCES/${PKG_BASENAME}.tgz" ] &&
rm -f "${RPMSOURCEDIR}/SOURCES/${PKG_BASENAME}.tgz"
# If we had a pre-existing postinstall-pak, we keep it as it was.
if [ -f "${DIRECTORIO_FUENTE}/postinstall-pak.tmp" ]; then
mv "${DIRECTORIO_FUENTE}/postinstall-pak.tmp" "${DIRECTORIO_FUENTE}/postinstall-pak"
fi
true; okfail
echo
echog "Bye."
echo
exit 1
}
# Function to copy a directory with permissions, honours setuid, setgid,
# sticky bits, owner, group etc.
#
# A bit lengthy and slow but very few directories in the largest of
# packages have to be copied like this.
function dircopy() {
src_dir="$1" dest_dir="$2"
getflags() {
col=$1 dir="$2"
permissions="`ls -ld "$dir" | awk '{print $1}'`"
mask="."
bit=2
while [ $bit -lt $col ]; do mask="$mask."; bit=`expr $bit + 1`; done
mask="$mask\(.\)"
bit=$col
while [ $bit -lt 10 ]; do mask="$mask."; bit=`expr $bit + 1`; done
permission="`echo $permissions | sed "s/$mask/\1/" | grep -v -- '-'`"
case "$permission" in
s) echo "xs";; S) echo "s";; t) echo "xt";; T) echo "t";;
*) echo $permission;;
esac
}
col=2 chmod_args=""
set=u flags=""
while [ $col -le 4 ]; do
flags="$flags`getflags $col "$src_dir"`"; col=`expr $col + 1`
done
[ -n "$flags" ] && {
chmod_args="$set+$flags"
}
set=g flags=""
while [ $col -le 7 ]; do
flags="$flags`getflags $col "$src_dir"`"; col=`expr $col + 1`
done
[ -n "$flags" ] && {
[ -n "$chmod_args" ] && chmod_args="$chmod_args,"
chmod_args="$chmod_args$set+$flags"
}
set=o flags=""
while [ $col -le 10 ]; do
flags="$flags`getflags $col "$src_dir"`"; col=`expr $col + 1`
done
[ -n "$flags" ] && {
[ -n "$chmod_args" ] && chmod_args="$chmod_args,"
chmod_args="$chmod_args$set+$flags"
}
[ -d "$dest_dir" ] || {
mkdir -p "$dest_dir"
chmod 700 "$dest_dir"
}
[ -n "$chmod_args" ] && chmod $chmod_args "$dest_dir"
chown "`ls -ld "$src_dir" | awk '{print $3}'`" "$dest_dir"
chgrp "`ls -ld "$src_dir" | awk '{print $4}'`" "$dest_dir"
}
#
# Read spec file if it exists or (pre)set variables if they don't exist
#
function getparameter () {
RES=`egrep "$1" < ${SPEC_PATH} \
| cut -f2 -d: | sed 's/^ *//g' | sed 's/ *$//g' `
shift
while echo "$RES" | egrep -q '(^|[^%])%[a-zA-Z0-9]'; do
VAR=`echo "$RES" | sed 's/\(^\|^.*[^%]\)%\([a-zA-Z0-9]*\).*$/\2/'`
egrep -q "^%define\s+$VAR\s" < ${SPEC_PATH} || break
VAL=`egrep "^%define\s+$VAR\s" < ${SPEC_PATH} \
| awk '{ print $3 }'`
RES=`echo "$RES" | sed 's/\(^\|[^%]\)%'"$VAR/"'\1'"$VAL/g"`
done
echo "$RES" | sed 's/^ *//g' | sed 's/ *$//g'
}
# This function is used to properly escape shell commands, so
# we don't interpret the install command twice. This is useful
# for making commands like 'make CC="gcc -some -options" install'
# work as expected.
function shell_escape() {
for str in "$@" ; do
echo -n "\"$str\" "
done;
echo
}
# Output all the parents of the files given as arguments to stdout. Remove
# duplicates.
function list_parents {
src="$*"
files=`for f in $src; do
echo "$f" | awk '
BEGIN{
FS = "/"
}
{
for (i=1;i<NF;i++){
for (j=1;j<=i;j++){
printf "%s",$(j)
if (j != i){
printf "/"
}
}
printf " "
}
}'
done`
echo "${files}" | tr ' ' '\n' | uniq | tr '\n' ' '
return $?
}
# Copy some file ($1) whose path is given relatively to some root ($2) to a
# destination ($3). If --deref-parents appear as first argument, then symlink
# parents will not be copied as symlinks but as ordinary directories. All
# permissions are preserved. The directories the source file was in are
# preserved up to the root. The files that were copied are displayed on stdout
function copy_dir_hierarchy {
deref_parents=0
if [ `echo "${1}" | egrep '^--deref-parents'` ]; then
deref_parents=1
shift
fi
src="${1}"
root="${2}"
dest="${3}"
# All directories the file is in, e.g if src is
# ./usr/local/lib/installwatch.so, then files will be . ./usr ./usr/local
# ./usr/local/lib
files=`list_parents ${src}`
# Only use tar if there are parents
echo "${files}" | egrep '[^[:space:]]' >/dev/null
if [ $? -eq 0 ]; then
if [ $deref_parents -eq 1 ]; then
# Add the -h option to the tar command for dereferencing
$TAR --no-recursion -C "${root}" -cphf - $files | $TAR -f - -xvpC \
"${dest}"
else
$TAR --no-recursion -C "${root}" -cpf - $files | $TAR -f - -xvpC \
"${dest}"
fi
fi
$TAR -C "${root}" -cpf - $src | $TAR -f - -xvpC \
"${dest}"
return $?
}
#################################
# Function definition ends here #
#############################################################################
# Show the version information
ckversion
echo
CHECKINSTALLRC=${CHECKINSTALLRC:-${INSTALLDIR}/lib/checkinstall/checkinstallrc}
if ! [ -f $CHECKINSTALLRC ]; then
echog "The checkinstallrc file was not found at:\n$CHECKINSTALLRC"
echo
echog "Assuming default values."
else
# Get our default settings from the rc file
source $CHECKINSTALLRC
fi
# Arguments parsing
CKNAME=`basename "$0"`
PARAMS=`getopt -a -n $CKNAME -o +d:DA:t:RShHy -l arch:,type:,si,showinstall::,ss,showslack::,deldoc::,delspec::,deldesc::,strip::,addso::,install::,stripso::,gzman::,bk,backup::,autodoinst::,reset-uids::,fstrans::,spec:,exclude:,include:,pkgname:,pkgversion:,pkgrelease:,pkglicense:,pkggroup:,pkgsource:,pkgaltsource:,pakdir:,docdir:,requires:,recommends:,suggests:,provides:,conflicts:,replaces:,maintainer:,dpkgflags:,rpmflags:,pkgarch:,umask:,with-tar:,summary:,inspect,review-spec,review-control,newslack,help,nodoc,rpmi,rpmu,version,copyright,default -- "$@"`
[ $? -gt 0 ] && help_notice
eval set -- $PARAMS
while [ "$1" != "--" ]; do
case "$1" in
-h|-H|--help)
usage;;
-d)
shift
case `eval echo $1` in
0) DEBUG=0;;
1|'') DEBUG=1;;
2) DEBUG=2;;
3) DEBUG=3;;
4) DEBUG=4;;
*)
boolean_usage "-D" $1
esac
;;
-A|--arch|--pkgarch)
shift
ARCHITECTURE=`eval echo $1`
;;
--umask)
shift
CKUMASK=`eval echo $1`
;;
--pkgname)
shift
NAME=`eval echo $1`
;;
--pkgversion)
shift
VERSION=`eval echo $1`
;;
--pkgrelease)
shift
RELEASE=`eval echo $1`
;;
--pkglicense)
shift
LICENSE=`eval echo $1`
;;
--pkggroup)
shift
# note: we use PKG_GROUP instead of GROUP since (t)csh sets GROUP.
PKG_GROUP=`eval echo $1`
;;
--pkgsource)
shift
SOURCE=`eval echo $1`
;;
--pkgaltsource)
shift
ALTSOURCE=`eval echo $1`
;;
--pakdir)
shift
PAK_DIR=`eval echo $1`
;;
--with-tar)
shift
TAR=`eval echo $1`
;;
--summary)
shift
SUMMARY=`eval echo $1`
;;
--docdir)
shift
DOC_DIR=`eval echo $1`
;;
--provides)
shift
PROVIDES=`eval echo $1`
;;
--conflicts)
shift
CONFLICTS=`eval echo $1`
;;
--replaces)
shift
REPLACES=`eval echo $1`
;;
--requires)
shift
REQUIRES=`eval echo $1`
;;
--recommends)
shift
RECOMMENDS=`eval echo $1`
;;
--suggests)
shift
SUGGESTS=`eval echo $1`
;;
--maintainer)
shift
MAINTAINER=`eval echo $1`
;;
--dpkgflags)
shift
DPKG_FLAGS=`eval echo $1`
;;
--rpmflags)
shift
RPM_FLAGS=`eval echo $1`
;;
-t|--type)
shift
INSTYPE=`echo $1 | tr 'a-z' 'A-Z'`
case `eval echo $INSTYPE` in
RPM|R)
INSTYPE=R;;
SLACKWARE|S)
INSTYPE=S;;
DEBIAN|D)
INSTYPE=D;;
*)
echo
echo "$1 is not a valid packaging system. Please use \'rpm\', \'slackware\' or \'debian\'"
echo
echo
exit 1
esac
;;
-R)
INSTYPE=R
CK_REDHAT=1
;;
-S)
INSTYPE=S
CK_SLACKWARE=1
;;
-D)
INSTYPE=D
CK_DEBIAN=1
;;
--install)
shift
case `eval echo $1` in
1|yes|'')
INSTALL=1;;
0|no)
INSTALL=0;;
*)
boolean_usage "--install" $1
esac
;;
--si)
SHOW_INSTALL=1;;
--showinstall)
shift
case `eval echo $1` in
1|yes|'')
SHOW_INSTALL=1;;
0|no)
SHOW_INSTALL=0;;
*)
boolean_usage "--showinstall" $1
esac
;;
--ss)
SHOW_SLACK_INSTALL=1;;
--showslack)
shift
case `eval echo $1` in
1|yes|'')
SHOW_SLACK_INSTALL=1;;
0|no)
SHOW_SLACK_INSTALL=0;;
*)
boolean_usage "--showslack" $1
esac
;;
--deldoc)
shift
case `eval echo $1` in
1|yes|'')
DEL_DOCPAK=1;;
0|no)
DEL_DOCPAK=0;;
*)
boolean_usage "--deldoc" $1
esac
;;
--delspec)
shift
case `eval echo $1` in
1|yes|'')
DEL_SPEC=1;;
0|no)
DEL_SPEC=0;;
*)
boolean_usage "--delspec" $1
esac
;;
--deldesc)
shift
case `eval echo $1` in
1|yes|'')
DEL_DESC=1;;
0|no)
DEL_DESC=0;;
*)
boolean_usage "--deldesc" $1
esac
;;
--strip)
shift
case `eval echo $1` in
1|yes|'')
STRIP_ELF=1;;
0|no)
STRIP_ELF=0;;
*)
boolean_usage "--strip" $1
esac
;;
--addso)
shift
case `eval echo $1` in
1|yes|'')
ADD_SO=1;;
0|no)
ADD_SO=0;;
*)
boolean_usage "--strip" $1
esac
;;
--stripso)
shift
case `eval echo $1` in
1|yes|'')
STRIP_SO_ELF=1
;;
0|no)
STRIP_SO_ELF=0;;
*)
boolean_usage "--stripso" $1
esac
;;
--gzman)
shift
case `eval echo $1` in
1|yes|'')
COMPRESS_MAN=1;;
0|no)
COMPRESS_MAN=0;;
*)
boolean_usage "--gzman" $1
esac
;;
--bk)
BACKUP=1;;
--backup)
shift
case `eval echo $1` in
1|yes|'')
BACKUP=1;;
0|no)
BACKUP=0;;
*)
boolean_usage "--backup" $1
esac
;;
--default)
ACCEPT_DEFAULT=1;;
-y)
ACCEPT_DEFAULT=1;;
--nodoc)
NODOC=1;;
--rpmi)
RPM_IU=i;;
--rpmu)
RPM_IU=U;;
--newslack)
NEW_SLACK=1;;
--inspect)
CK_INSPECT=1;;
--review-spec)
REVIEW_SPEC=1;;
--review-control)
REVIEW_CONTROL=1;;
--spec)
shift
SPEC_PATH=`eval echo $1`
if ! [ -f "$SPEC_PATH" ]; then
echog "Warning: .spec file path \"%s\" not found.\nWarning: Defaulting to \"%s\"." "$SPEC_PATH" "${PKG_BASENAME}.spec"
fi
;;
--copyright|--version)
cat << EOF
Copyright (c) 2010 Felipe Eduardo Sanchez Diaz Duran <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the version 2 of the GNU General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
EOF
exit 0;;
--autodoinst)
shift
case `eval echo $1` in
1|yes|'')
AUTODOINST=1;;
0|no)
AUTODOINST=0;;
*)
boolean_usage "--autodoinst" $1
esac
;;
--reset-uids)
shift
case `eval echo $1` in
1|yes|'')
RESET_UIDS=1;;
0|no)
RESET_UIDS=0;;
*)
boolean_usage "--reset-uids" $1
esac
;;
--fstrans)
shift
case `eval echo $1` in
1|yes|'')
TRANSLATE=1;;
0|no)
TRANSLATE=0;;
*)
boolean_usage "--fstrans" $1
esac
;;
--exclude)
shift
EXCLUDE=`eval echo $1`
;;
--include)
shift
CK_INCLUDE_FILE=`eval echo $1`
;;
esac
shift
done
# See if we have and install command
shift
[ "$1" = "" ] && set -- make install
# End of argument parsing
#############################################################################
# We initialize some useful variables #
#######################################
################################################################
# User-configurable variables were moved to the checkinstallrc #
# file which is probably found at /usr/local/lib/checkinstall #
# #
# DO NOT modify them here!! #
################################################################
# Debug level
! [ "$DEBUG" ] && DEBUG=0
! [ "$INSTALLWATCH_PREFIX" ] && INSTALLWATCH_PREFIX="$INSTALLDIR"
! [ "$INSTALLWATCH" ] && INSTALLWATCH=${INSTALLWATCH_PREFIX}/bin/installwatch
# Which makepkg to use
! [ "$MAKEPKG" ] && MAKEPKG=/sbin/makepkg
# Default MAKEPKG flags
! [ "$MAKEPKG_FLAGS" ] && MAKEPKG_FLAGS="-l y -c n"
# Default architecture type
! [ "$ARCHITECTURE" ] && ARCHITECTURE=""
# Default package type
! [ "$INSTYPE" ] && INSTYPE=""
# Interactively show the results of the install command
# This is useful for interactive installation commands
! [ "$SHOW_INSTALL" ] && SHOW_INSTALL=1
# Show Slackware package installation script while it runs? Again, useful if
# it's an interactive script
! [ "$SHOW_SLACK_INSTALL" ] && SHOW_SLACK_INSTALL=0
# Automatic deletion of "doc-pak" upon termination
! [ "$DEL_DOCPAK" ] && DEL_DOCPAK=1
# Automatic deletion of the spec file
! [ "$DEL_SPEC" ] && DEL_SPEC=1
# Automatic deletion of "description-pak"
! [ "$DEL_DESC" ] && DEL_DESC=1
# Automatically strip all ELF binaries
! [ "$STRIP_ELF" ] && STRIP_ELF=1
# Don't automatically strip all ELF binaries
! [ "$STRIP_SO_ELF" ] && STRIP_SO_ELF=0
# Don't automatically search shared libraries
# nor add them to /etc/ld.so.conf
! [ "$ADD_SO" ] && ADD_SO=0
# Automatically compress all man pages
! [ "$COMPRESS_MAN" ] && COMPRESS_MAN=1
# Backup all files modified by the install command supplied by the user
! [ "$BACKUP" ] && BACKUP=1
# Write description installing code to doinst.sh
! [ "$AUTODOINST" ] && AUTODOINST=1
# Are we going to use filesystem translation?
! [ "$TRANSLATE" ] && TRANSLATE=1
# Reset the owner/group of all files to root.root?
! [ "$RESET_UIDS" ] && RESET_UIDS=0
# We won't include anything under this directories
! [ "$EXCLUDE" ] && EXCLUDE=""
# We will include anything listed in this file
! [ "$CK_INCLUDE_FILE" ] && CK_INCLUDE_FILE=""
# Accept the default answer for all the questions
! [ "$ACCEPT_DEFAULT" ] && ACCEPT_DEFAULT=0
# Use the default doc directory of /usr/doc
! [ "$DOC_DIR" ] && DOC_DIR=/usr/doc
# Do not include common documentation
! [ "$NODOC" ] && NODOC=0
# Use "-U" flag in rpm by default when installing a rpm package
# This tells rpm to (U)pdate the package instead of (i)nstalling it.
! [ "$RPM_IU" ] && RPM_IU=U
# Use the new (8.1+) Slackware description format
! [ "$NEW_SLACK" ] && NEW_SLACK=1
# Inspect the file list before creating the package
! [ "$CK_INSPECT" ] && CK_INSPECT=0
# Review the .spec file before creating a .rpm
! [ "$REVIEW_SPEC" ] && REVIEW_SPEC=0
# Review the control file before creating a .deb
! [ "$REVIEW_CONTROL" ] && REVIEW_CONTROL=0
# Set the umask
! [ "$CKUMASK" ] && CKUMASK=0022
# No real installation if not explicitly asked
! [ "$INSTALL" ] && INSTALL=0
# The place where we will be storing the temp files
! [ "$BASE_TMP_DIR" ] && BASE_TMP_DIR=/var/tmp
# Default RPM FLAGS
! [ "$RPM_FLAGS" ] && RPM_FLAGS=" --force --nodeps --replacepkgs "