Browse Source

maketgz: delete .bak files, fix indentation

Ref: https://github.com/curl/curl/pull/2660

Closes https://github.com/curl/curl/pull/2662
Viktor Szakats 5 years ago
parent
commit
676f4b742d
1 changed files with 27 additions and 25 deletions
  1. 27 25
      maketgz

+ 27 - 25
maketgz

@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 # Script to build release-archives with. Note that this requires a checkout
 # from git and you should first run ./buildconf and build curl once.
 #
@@ -9,7 +9,7 @@
 #                            | (__| |_| |  _ <| |___
 #                             \___|\___/|_| \_\_____|
 #
-# Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
 #
 # This software is licensed as described in the file COPYING, which
 # you should have received as part of this distribution. The terms
@@ -32,8 +32,8 @@ if [ -z "$version" ]; then
 fi
 
 if [ "xonly" = "x$2" ]; then
-    echo "Setup version number only!"
-    only=1
+  echo "Setup version number only!"
+  only=1
 fi
 
 libversion="$version"
@@ -41,13 +41,13 @@ libversion="$version"
 # we make curl the same version as libcurl
 curlversion=$libversion
 
-major=`echo $libversion |cut -d. -f1 | sed -e "s/[^0-9]//g"`
-minor=`echo $libversion |cut -d. -f2 | sed -e "s/[^0-9]//g"`
-patch=`echo $libversion |cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g"`
+major=`echo $libversion | cut -d. -f1 | sed -e "s/[^0-9]//g"`
+minor=`echo $libversion | cut -d. -f2 | sed -e "s/[^0-9]//g"`
+patch=`echo $libversion | cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g"`
 
 if test -z "$patch"; then
-    echo "invalid version number? needs to be z.y.z"
-    exit
+  echo "invalid version number? needs to be z.y.z"
+  exit
 fi
 
 #
@@ -64,37 +64,41 @@ CHEADER=src/tool_version.h
 PLIST=lib/libcurl.plist
 
 if test -z "$only"; then
-    ext=".dist"
-    # when not setting up version numbers locally
-    for a in $HEADER $CHEADER $PLIST; do
-        cp $a "$a$ext"
-    done
-    HEADER="$HEADER$ext"
-    CHEADER="$CHEADER$ext"
-    PLIST="$PLIST$ext"
+  ext=".dist"
+  # when not setting up version numbers locally
+  for a in $HEADER $CHEADER $PLIST; do
+    cp $a "$a$ext"
+  done
+  HEADER="$HEADER$ext"
+  CHEADER="$CHEADER$ext"
+  PLIST="$PLIST$ext"
 fi
 
 # requires a date command that knows + for format
 datestamp=`date +"%F"`
 
 # Replace version number in header file:
-sed -i.bak -e 's/^#define LIBCURL_VERSION .*/#define LIBCURL_VERSION "'$libversion'"/g' \
+sed -i.bak \
+    -e 's/^#define LIBCURL_VERSION .*/#define LIBCURL_VERSION "'$libversion'"/g' \
     -e 's/^#define LIBCURL_VERSION_NUM .*/#define LIBCURL_VERSION_NUM 0x'$numeric'/g' \
     -e 's/^#define LIBCURL_VERSION_MAJOR .*/#define LIBCURL_VERSION_MAJOR '$major'/g' \
     -e 's/^#define LIBCURL_VERSION_MINOR .*/#define LIBCURL_VERSION_MINOR '$minor'/g' \
     -e 's/^#define LIBCURL_VERSION_PATCH .*/#define LIBCURL_VERSION_PATCH '$patch'/g' \
     -e "s/^#define LIBCURL_TIMESTAMP .*/#define LIBCURL_TIMESTAMP \"$datestamp\"/g" \
- $HEADER
+    $HEADER
+rm -f "$HEADER.bak"
 
 # Replace version number in header file:
 sed -i.bak 's/#define CURL_VERSION .*/#define CURL_VERSION "'$curlversion'"/g' $CHEADER
+rm -f "$CHEADER.bak"
 
 # Replace version number in plist file:
 sed -i.bak "s/7\.12\.3/$libversion/g" $PLIST
+rm -f "$PLIST.bak"
 
 if test -n "$only"; then
-    # done!
-    exit;
+  # done!
+  exit;
 fi
 
 echo "curl version $curlversion"
@@ -102,8 +106,7 @@ echo "libcurl version $libversion"
 echo "libcurl numerical $numeric"
 echo "datestamp $datestamp"
 
-findprog()
-{
+findprog() {
   file="$1"
   for part in `echo $PATH| tr ':' ' '`; do
     path="$part/$file"
@@ -189,8 +192,7 @@ gzip -dc $targz | xz -6e - > $xz
 #
 # Now make a zip archive from the tar.gz original
 #
-makezip ()
-{
+makezip() {
   rm -rf $tempdir
   mkdir $tempdir
   cd $tempdir