From 0519bdd0a649146f419aaf50abfef0cfda946a6633c01e7db11876273f2072ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Fri, 3 May 2024 13:44:28 +0200 Subject: [PATCH] Sync from SUSE:SLFO:Main inst-source-utils revision 9c301926dbc3bbe669c617a8344a132a --- .gitattributes | 23 ++ _service | 17 + inst-source-utils-2023.11.08.obscpio | 3 + inst-source-utils.changes | 444 +++++++++++++++++++++++++++ inst-source-utils.obsinfo | 4 + inst-source-utils.spec | 59 ++++ pre_checkin.sh | 68 ++++ split.pl | 106 +++++++ 8 files changed, 724 insertions(+) create mode 100644 .gitattributes create mode 100644 _service create mode 100644 inst-source-utils-2023.11.08.obscpio create mode 100644 inst-source-utils.changes create mode 100644 inst-source-utils.obsinfo create mode 100644 inst-source-utils.spec create mode 100644 pre_checkin.sh create mode 100644 split.pl diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/_service b/_service new file mode 100644 index 0000000..50d0869 --- /dev/null +++ b/_service @@ -0,0 +1,17 @@ + + + https://github.com/openSUSE/inst-source-utils.git + git + 2023.11.08 + 2023.11.08 + inst-source-utils.changes + inst-source-utils.spec + + + + + + *.tar + xz + + diff --git a/inst-source-utils-2023.11.08.obscpio b/inst-source-utils-2023.11.08.obscpio new file mode 100644 index 0000000..33b5706 --- /dev/null +++ b/inst-source-utils-2023.11.08.obscpio @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:301e16918ec51c68ec37c29f4c02e02dd6ad9f3fce71c6663cb39ccc609352c2 +size 207371 diff --git a/inst-source-utils.changes b/inst-source-utils.changes new file mode 100644 index 0000000..a173217 --- /dev/null +++ b/inst-source-utils.changes @@ -0,0 +1,444 @@ +------------------------------------------------------------------- +Wed Nov 8 16:06:01 UTC 2023 - Dirk Müller + +- update to 2023.11.08: + - Handle zstd repos in rezip_repo_rsyncable + +------------------------------------------------------------------- +Tue Aug 1 17:55:46 CET 2023 - meissner@suse.de + +- added a small perl helper to create updateinfos on your own +- added some help + +------------------------------------------------------------------- +Wed Apr 27 10:19:51 UTC 2022 - Dirk Müller + +- fix URL +- use %%license tag + +------------------------------------------------------------------- +Thu Sep 9 16:49:31 UTC 2021 - Marcus Rueckert + +- update to 2021.09.09 (boo#1178224) + - This should fix generating changelogs for trees with multiple + images. + +------------------------------------------------------------------- +Mon Dec 10 16:33:02 CET 2018 - ro@suse.de + +- add pattern-category also to susedata, not just susedata_i18n + +------------------------------------------------------------------- +Wed Dec 5 14:55:50 UTC 2018 - Adrian Schröter + +- Add pattern-category (fate#323785) + +------------------------------------------------------------------- +Fri Apr 6 10:02:20 UTC 2018 - adrian@suse.de + +- add support for transalted EULA + +------------------------------------------------------------------- +Tue Mar 13 12:27:40 UTC 2018 - adrian@suse.de + +- new susedata i18n structure +- move source to git + +------------------------------------------------------------------- +Tue Feb 27 15:17:48 CET 2018 - ro@suse.de + +- mk_changelog: do not use localtime call for min_date + (bnc#1081766) + +------------------------------------------------------------------- +Fri Jul 28 13:26:40 CEST 2017 - ro@suse.de + +- drop requires for recode + +------------------------------------------------------------------- +Tue Jul 26 12:07:52 CEST 2016 - ro@suse.de + +- ABXML: add diskusage data to susedata xml structure + (fate#320517) + +------------------------------------------------------------------- +Mon May 2 17:46:57 CEST 2016 - ro@suse.de + +- RPMQ: add infrastructure for HEADERSTART and EXTRA +- create_package_descr: use infrastucture to allow running with + only rpm headers instead of full rpms (bnc#978085) + +------------------------------------------------------------------- +Wed Dec 9 16:01:55 CET 2015 - ro@suse.de + +- update rezip_repo_rsyncable again: fix up filenames if they + are checksum prefixed, do not change timestamps of the + files recompressed (bnc#958511) + +------------------------------------------------------------------- +Tue Dec 8 12:10:41 CET 2015 - ro@suse.de + +- rezip_repo_rsyncable: add "-n" option for gzip + +------------------------------------------------------------------- +Tue Oct 27 15:10:49 CET 2015 - ro@suse.de + +- mk_listings: set LC_CTYPE (bnc#910388) +- ABXML.pm: add endoflife in product structure + +------------------------------------------------------------------- +Tue Mar 18 16:40:34 CET 2014 - ro@suse.de + +- update create_package_descr: fix utf8 handling thanks to mls + +------------------------------------------------------------------- +Fri Mar 14 02:38:32 CET 2014 - ro@suse.de + +- create_sha1sums: skip content file actions if content file + does not exist + +------------------------------------------------------------------- +Wed Mar 12 17:56:59 CET 2014 - ro@suse.de + +- fix bogus code in rezip-repo-rsyncable + +------------------------------------------------------------------- +Wed Mar 5 14:34:28 CET 2014 - ro@suse.de + +- bump version number and add automatic to pre_checkin.sh + +------------------------------------------------------------------- +Tue Mar 4 16:47:58 CET 2014 - ro@suse.de + +- add ABXML.pm and ABStructured.pm +- rewrite rezip_repo_rsyncable to keep checksum type +- add requires for perl-XML-Parser + +------------------------------------------------------------------- +Tue Feb 25 15:36:18 CET 2014 - ro@suse.de + +- fix typo in last change + +------------------------------------------------------------------- +Wed Feb 19 17:51:38 CET 2014 - ro@suse.de + +- update create_package_descr: also recognize new rpm tags + for Suggests and Enhances (thanks to mls for the patch) + +------------------------------------------------------------------- +Fri Sep 20 11:57:36 CEST 2013 - ro@suse.de + +- also add Requires(pre) and Requires(post) to Prq sections + +------------------------------------------------------------------- +Wed Apr 3 12:03:43 CEST 2013 - ro@suse.de + +- remove pdb code from create_package_descr +- create_sha1sums: replace "which" by "type -p" +- create_repo_for_patch.sh: same change +- RPMQ: fix for name-version-release > 64 characters + +------------------------------------------------------------------- +Fri Jan 25 01:23:46 CET 2013 - ro@suse.de + +- use "strict" for create_package_descr +- add support for -e (eula_dir) parameter in create_package_descr + +------------------------------------------------------------------- +Wed Dec 5 13:27:11 CET 2012 - ro@suse.de + +- update create_md5sums to get the key files witout a pubring.gpg + +------------------------------------------------------------------- +Thu Sep 13 16:15:54 CEST 2012 - ro@suse.de + +- add recent fixes + +------------------------------------------------------------------- +Wed Feb 29 10:55:46 CET 2012 - ro@suse.de + +- mk_changelog: calculate time (two years ago) differently to + avoid error on leap days. + +------------------------------------------------------------------- +Thu Feb 2 11:10:39 UTC 2012 - adrian@suse.de + +- write SHA256 sums into CHECKSUMS file + +------------------------------------------------------------------- +Sun Oct 16 19:55:51 UTC 2011 - lars@linux-schulserver.de + +- to too much quoting in create_package_descr + +------------------------------------------------------------------- +Fri Oct 14 17:04:57 UTC 2011 - lrupp@suse.de + +- handle spaces in path in create_package_descr (bnc#604730) + +------------------------------------------------------------------- +Wed May 25 08:18:37 UTC 2011 - adrian@suse.de + +- fix header generation for SHA256 mode (no SHA1 tag) + +------------------------------------------------------------------- +Thu May 5 12:20:17 CEST 2011 - ro@suse.de + +- create_sha1sum and create_sha1sums now understand option "-2" + to use/create sha256sum(s) + +------------------------------------------------------------------- +Thu Apr 28 18:25:28 CEST 2011 - ro@suse.de + +- add option -D to use sha256 checksums in create_package_descr + +------------------------------------------------------------------- +Wed Mar 17 11:52:48 CET 2010 - ro@suse.de + +- add requires to recode + +------------------------------------------------------------------- +Mon Feb 22 12:11:17 CET 2010 - ro@suse.de + +- create_package_descr: output a little statistic + +------------------------------------------------------------------- +Wed Jan 27 14:52:59 UTC 2010 - adrian@suse.de + +- add Requires to gpg2 to fix product media signing + +------------------------------------------------------------------- +Mon Nov 2 13:41:07 CET 2009 - ro@suse.de + +- add rezip_repo_rsyncable +- update create_package_descr: + - skip deltarpms + - write comment with cmdline only once + - do not warn for missing pdb data +- update: create_repo_for_patch.sh + - add sources if wanted +- update: create_sha1sums + - clear LANG LANGUAGE +- update: createpatch + - major overhaul +- update: RPMQ.pm + - add PRETRANS,POSTTRANS, ..., FILEDIGESTALGO + +------------------------------------------------------------------- +Mon Oct 12 23:14:14 CEST 2009 - lrupp@suse.de + +- fix bnc#546152: create_sha1sums fails to find custom gpg-key on + non-english systems +- fix create_package_descr to work with delta-rpms in path + +------------------------------------------------------------------- +Fri Aug 7 19:47:34 CEST 2009 - lrupp@suse.de + +- create_package_descr: disable debug output for missing pdb data +- create_repo_for_patch.sh: complete rework (thanks to Ulf Lange) + fixes bnc #506357 +- RPMQ.pm: added the following RPM-tags + PRETRANS, POSTTRANS, PRETRANSPROG, POSTTRANSPROG, DISTTAG, + FILEDIGESTALGOS, FILEDIGESTALGO +- createpatch: first part of the code rewrite is done + New options: -l|--logfile => write output to logfile + -b|--basedir => obsoletes old script behavior + -c|--configfile => use options from configfile + +------------------------------------------------------------------- +Mon Jul 13 12:40:12 CEST 2009 - ug@suse.de + +- remove the "PATTERNS" line from the created add_on + (create_update_source) + +------------------------------------------------------------------- +Fri Mar 6 11:58:45 CET 2009 - ro@suse.de + +- create_package_descr: add -Q option to disable Shr tag + +------------------------------------------------------------------- +Wed Feb 25 11:10:27 CET 2009 - lrupp@suse.de + +- create_package_descr: more help text for the -T XTAGS_FILE +- create_sha1sum, create_md5sums - fix bnc#460894: handle multiple + arguments + +------------------------------------------------------------------- +Fri Jan 23 12:33:54 CET 2009 - jcborn@suse.de + +- added gen-s390-cd-kernel.pl because it is required to create + bootable S/390 media with kiwi-isntsource + +------------------------------------------------------------------- +Mon Nov 24 15:12:14 CET 2008 - ro@suse.de + +- update create_package_descr + +------------------------------------------------------------------- +Mon Nov 24 13:53:46 CET 2008 - lrupp@suse.de + +- fix pathnames + +------------------------------------------------------------------- +Thu Nov 20 12:42:40 CET 2008 - ro@suse.de + +- create_package_descr: add -T option for xtags file + format: "packagename: literal text" so that "literal text" + will be directly included for the package data + +------------------------------------------------------------------- +Thu Nov 13 00:14:01 CET 2008 - ro@suse.de + +- mk_listings: exclude .cr-cache and .snapshot + +------------------------------------------------------------------- +Thu Oct 16 17:54:47 CEST 2008 - lrupp@suse.de + +- create_sha1sums: + + also put the GPG key in each slideshow directory + +------------------------------------------------------------------- +Thu Oct 16 15:00:19 CEST 2008 - ro@suse.de + +- create_package_descr: + + add "-V" option to also put the vendor for each rpm in + the generated metadata + +------------------------------------------------------------------- +Thu Oct 9 17:46:48 CEST 2008 - lrupp@suse.de + +- quick fix for bnc#409927: + - create_sha1sums: + + create SHA1SUM files and sign them in the slideshow directory + - added create_sha1sum which is a copy of create_md5sums + (can't use create_sha1sum_s_ as this name is already in use) +- removed NoSource tags + +------------------------------------------------------------------- +Mon Jul 21 19:02:27 CEST 2008 - lrupp@suse.de + +- create_directory_yast: + + add "-f" option to overwrite existing directory.yast files +- create_md5sums: + + small code cleanups only +- create_package_descr: + + added option -F (do file list: packages.FL) + + added option -B (add requires for src packages) + + fix warning message if -x is not specified (typo) + + EXTRA_REQUIRES_FILE option switched from -p to -r +- create_repo_for_patch.sh: + + fix quoting +- create_sha1sums: + + added option "-x" to add additional meta files in content file + + beetter check for repomd.xml + + added "-n" option to skip re-signing +- mk_changelog: + + small code cleanup + +------------------------------------------------------------------- +Fri May 16 16:52:36 CEST 2008 - ro@suse.de + +- patches upstreamed + +------------------------------------------------------------------- +Thu May 15 15:09:25 CEST 2008 - schwab@suse.de + +- Fix syntax and quoting bugs. + +------------------------------------------------------------------- +Fri Feb 1 15:03:24 CET 2008 - lrupp@suse.de + +- fix file permissions (fixes bnc#357313 and bnc#351070) +- handle also boot/*/config boot/*/common (create_sha1sums) +- fix path to REPOFILE (create_sha1sums) + +------------------------------------------------------------------- +Tue Dec 11 14:30:39 CET 2007 - lrupp@suse.de + +- added mk_changelog (for add-on creator) +- add fallback mode for createpatch (see #308684) + +------------------------------------------------------------------- +Wed Sep 26 20:38:37 CEST 2007 - ro@suse.de + +- remove dependency to createrepo for now + +------------------------------------------------------------------- +Wed Sep 26 12:20:24 CEST 2007 - lrupp@suse.de + +- fixes for Bug #308684: + + require createrepo + + be more secure in bash + +------------------------------------------------------------------- +Tue Jul 17 02:08:14 CEST 2007 - lrupp@suse.de + +- createpatch: use CONFIRMATION_FILE as description to make clear, + that this creates a confirmation popup for the user (#205534) + +------------------------------------------------------------------- +Fri Jul 13 11:21:25 CEST 2007 - lrupp@suse.de + +- create_md5sums: + + fix typo in usage +- create_package_descr: + + search data in main package for xxbit packages + + add license notes as confirmlic so YaST can display them + even in plain text mode +- create_sha1sums: added to generate the SHA1SUMs in content file +- createpatch: + + support "license_to_confirm": add an EULA to the patch, read + from the file specified (see #205534 for details) + + beautify usage message + + added @packagelist to condition +- mk_listings: + + handle whitespaces in directory names + + use --rsyncable as gzip option: `rsync' program can take + advantage of similarities during sync over network + + replace standard Names (CD,DVD,inst-source) + + use '--nodigest --nosignature' for rpm queries if supported + + re-create hardlinks from basedir to CD-dir if CD*/*.gz exists + +------------------------------------------------------------------- +Tue May 15 15:55:26 CEST 2007 - ories@suse.de + +- added support for adding supplements tag (#262859, #256038) +- added support for overwriting the default freshens value +- fixed one \" escaping typo +- do not delete product.xml + +------------------------------------------------------------------- +Thu Mar 15 18:20:28 CET 2007 - lrupp@suse.de + +- patched copy-sources.sh + +------------------------------------------------------------------- +Tue Mar 13 12:06:48 CET 2007 - lrupp@suse.de + +- fixed source again - fixed script, too + +------------------------------------------------------------------- +Fri Mar 9 10:39:06 CET 2007 - lrupp@suse.de + +- fixed source tarball + +------------------------------------------------------------------- +Mon Mar 5 15:24:17 CET 2007 - lrupp@suse.de + +- add package to SLE10-SP1 tree (#250860) + +------------------------------------------------------------------- +Mon Feb 26 14:17:43 CET 2007 - lrupp@suse.de + +- fixed #214273 : inst-source-utils perl module in subdir of + /usr/bin is questionable/ugly + +------------------------------------------------------------------- +Thu Oct 19 20:07:28 CEST 2006 - lrupp@suse.de + +- Obsolete only autoyast-utils <= 2.14.6 + +------------------------------------------------------------------- +Fri Oct 13 18:02:18 CEST 2006 - lrupp@suse.de + +- Initial version + diff --git a/inst-source-utils.obsinfo b/inst-source-utils.obsinfo new file mode 100644 index 0000000..5873362 --- /dev/null +++ b/inst-source-utils.obsinfo @@ -0,0 +1,4 @@ +name: inst-source-utils +version: 2023.11.08 +mtime: 1699462649 +commit: 41d8c58c8f2adb28f82c113d38c68ee50fdb9c84 diff --git a/inst-source-utils.spec b/inst-source-utils.spec new file mode 100644 index 0000000..e0e3860 --- /dev/null +++ b/inst-source-utils.spec @@ -0,0 +1,59 @@ +# +# spec file for package inst-source-utils +# +# Copyright (c) 2023 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: inst-source-utils +Summary: Utilities for creating customized installation sources +License: GPL-2.0-or-later +Group: System/YaST +Version: 2023.11.08 +Release: 0 +URL: https://en.opensuse.org/Inst-source-utils +BuildArch: noarch +Requires: gpg2 +Obsoletes: autoyast2-utils <= 2.14.10 +Provides: autoyast2-utils = 2.14.10 +Recommends: create-repo-utils +Requires: perl-XML-Parser +Requires: zstd +Source: %name-%version.tar.xz +Source1: split.pl + +%description +Utilities supporting autoinstallation and creation of customized +installation sources. + +Have a look at http://en.opensuse.org/Inst-source-utils for a detailed +description of each script. + +%prep +%setup -q + +%build + +%install +install -d -m 755 %{buildroot}/%{_prefix} + +cp -a usr %{buildroot}/ + +%files +%license COPYING +%_bindir/* +%defattr(644,root,root,755) +%_datadir/%name + +%changelog diff --git a/pre_checkin.sh b/pre_checkin.sh new file mode 100644 index 0000000..5bcfe9e --- /dev/null +++ b/pre_checkin.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +TMPDIR=$(mktemp -d /tmp/inst-source-utils-XXXXXX) +TOPDIR=$TMPDIR/inst-source-utils +SUSEDIR=/ +BINDIR=${SUSEDIR}usr/bin +MODULEDIR=/usr/share/inst-source-utils +BUILD_ETC=${MODULEDIR}/etc + +BINFILES="/work/cd/bin/tools/mk_listings /work/cd/bin/tools/create_directory.yast + /work/cd/bin/tools/create_md5sums /work/cd/bin/tools/create_package_descr + /work/cd/bin/tools/create_sha1sums /work/cd/lib/m_cd/gen-s390-cd-kernel.pl + /work/cd/bin/tools/create_sha1sum /work/cd/bin/tools/compress_susetags + /work/cd/bin/tools/packages2eula.pl /work/cd/lib/mach_cd/mk_changelog + /work/cd/bin/tools/create_repo_for_patch.sh /work/cd/bin/createpatch + /work/cd/bin/tools/create_update_source.sh + /work/cd/bin/tools/rezip_repo_rsyncable" + +mkdir -p $TOPDIR$BINDIR +mkdir -p $TOPDIR$MODULEDIR/modules + +#copy binaries +for i in $BINFILES ; do + echo "Preparing: $(basename $i)" + sed -e "s|/work/abuild/lib/abuild|$MODULEDIR|g" \ + -e "s|/work/abuild|$SUSEDIR|g" \ + -e "s|/work/cd/bin/tools|$BINDIR|g" \ + -e "s|/work/cd|$SUSEDIR|g" \ + -e "s|/work/src/bin|$SUSEDIR|g" \ + -e "s|/work/built/info|$SUSEDIR/data|g" \ + -e "s|/mounts/you/ftp|/media/dvdrecorder|g" \ + $i > $TOPDIR$BINDIR/$(basename $i) + chmod 755 $TOPDIR$BINDIR/$(basename $i) +done + +# needed perl module +for i in /mounts/work/abuild/lib/abuild/modules/RPMQ.pm \ + /mounts/work/abuild/lib/abuild/modules/ABXML.pm \ + /mounts/work/abuild/lib/abuild/modules/ABStructured.pm ; do + echo "Preparing: $(basename $i)" + sed -e "s|/work/abuild|$BINDIR|g" $i > $TOPDIR$MODULEDIR/modules/`basename $i` +done +chmod 644 $TOPDIR$MODULEDIR/modules/*.pm + +# extra sed for scripts using the perl modules +for i in create_package_descr ; do + echo "Preparing: $(basename $i)" + sed -e "s|$BINDIR/lib/abuild|$MODULEDIR|g" $TOPDIR$BINDIR/$i > $TOPDIR$BINDIR/$i.tmp + mv $TOPDIR$BINDIR/$i.tmp $TOPDIR$BINDIR/$i + chmod 755 $TOPDIR$BINDIR/$i +done + +# don't package lines between and +for i in $TOPDIR$BINDIR/*; do + perl `dirname $0`/split.pl $i $i.new + mv $i.new $i + chmod 755 $i +done + +pushd $TMPDIR >/dev/null +tar cjfp ../inst-source-utils.tar.bz2 inst-source-utils +popd >/dev/null +cp -v $TMPDIR/../inst-source-utils.tar.bz2 . +test "$TMPDIR" != "/" -a -d "$TMPDIR" && rm -rf $TMPDIR + +LASTFILE=`find_newest_file *.tar.bz2` +VERSION=`get_date_version_string $LASTFILE` +sed -i -e "s@^Version:.*@Version: $VERSION@" inst-source-utils.spec diff --git a/split.pl b/split.pl new file mode 100644 index 0000000..ae3e433 --- /dev/null +++ b/split.pl @@ -0,0 +1,106 @@ +#!/usr/bin/perl -w +# +use strict; + +my $file=""; +my $newfile=""; +my $newdata=""; +my $starttag="# "; +my $endtag="# "; +my $loglevel=0; + +sub usage { + print <] [-e ] + + splits out textblocks marked with start and endtag. + Default: + $starttag + $endtag + + -s : define new start-tag + -e : define new end-tag + +EOF +; + exit 1; +} + +sub LOG { + my $message = shift; + my $level = shift || 0; +# my $time = localtime(time); + if ( $level <= $loglevel ) { +# print LOGFILE "[$time] [$$] $message\n"; + print "$message\n"; + } +} + +sub splitInternal { + my $file=shift; + my $data; + open (FILE,"$file") || die ("Can not open $file: $! $?!\n"); + while () { + chomp; + if ( $_ =~ /^$starttag/){ + while () { + chomp; + last if $_ eq "$endtag"; + } + } else { + $data .= "$_\n"; + } + } + return $data; +} + +while (my $param = shift (@ARGV)) { + if (( $param eq "-h" ) || ( $param eq "--help" )){ + usage(); + } + + if (($param eq "-s" ) || ($param eq "--start-tag")){ + $starttag=shift(@ARGV); + next; + } + + if (($param eq "-e" ) || ($param eq "--end-tag")){ + $endtag=shift(@ARGV); + next; + } + + if (($param eq "-v" ) || ($param eq "--verbose")){ + $loglevel=2; + next; + } + + if ($file eq ""){ + $file=$param; + next; + } + + $newfile=$param; +} + +if ($newfile eq ""){ + die("newfile not defined!\n"); + usage(); +} + +if ($file eq ""){ + die("filename not defined!\n"); + usage(); +} + +if (-f $file) { + $newdata=splitInternal($file); + LOG ("File $newfile exists - overwriting!\n",1) if (-f $newfile); + open(NEWFILE, "> $newfile"); + print NEWFILE $newdata; + close(NEWFILE); + LOG("New file $newfile written",2); +} else { + print "File $file not found.\n"; + usage(); +} +