From 4d702e80ed72845ea59ef80eb38990530ee0f7e5 Mon Sep 17 00:00:00 2001 From: Fabian Arrotin Date: Nov 07 2019 14:19:44 +0000 Subject: Imported sources for cpaste into git Signed-off-by: Fabian Arrotin --- diff --git a/.cpaste.metadata b/.cpaste.metadata new file mode 100644 index 0000000..5ac0cfb --- /dev/null +++ b/.cpaste.metadata @@ -0,0 +1 @@ +3556c0a9f741e1b04f9380e89ab1cec14135f64e SOURCES/cpaste-1.0.0.tar.gz diff --git a/SOURCES/README.CentOS b/SOURCES/README.CentOS new file mode 100644 index 0000000..e759d1b --- /dev/null +++ b/SOURCES/README.CentOS @@ -0,0 +1,10 @@ +This package is configured to use the CentOS Project's pastebin service as a +pre-configured system wide default. If you wish to change this please update +/etc/cpaste/url and /etc/cpaste/apikey. Users may override this at run-time +by specifying the -b parameter or my setting up their cpaste environment +in ~/.cpaste/ where is: + +apikey - API key for the default pastebin service if required +author - name to use on submissions; use OS-determined name if not specified +expiry - minutes for submissions to live +url - base URL for default pastebin service diff --git a/SOURCES/cpaste-lastargasfilename.patch b/SOURCES/cpaste-lastargasfilename.patch new file mode 100644 index 0000000..c459cda --- /dev/null +++ b/SOURCES/cpaste-lastargasfilename.patch @@ -0,0 +1,20 @@ +diff -aurp a/terminalparser.cpp b/terminalparser.cpp +--- a/terminalparser.cpp 2018-09-13 01:41:40.000000000 -0300 ++++ b/terminalparser.cpp 2018-09-13 19:28:13.705009686 -0300 +@@ -129,8 +129,14 @@ bool TerminalParser::Parse() + } + if (!valid) + { +- cerr << "This parameter isn't valid: " << text << endl; +- return true; ++ if (this->argc == x + 1) ++ { ++ Configuration::Input = this->argv[x]; ++ } else ++ { ++ cerr << "This parameter isn't valid: " << text << endl; ++ return true; ++ } + } + x++; + } diff --git a/SOURCES/cpaste-support-private.patch b/SOURCES/cpaste-support-private.patch new file mode 100644 index 0000000..fb30677 --- /dev/null +++ b/SOURCES/cpaste-support-private.patch @@ -0,0 +1,19 @@ +diff -aurp a/configuration.cpp b/configuration.cpp +--- a/configuration.cpp 2018-09-13 04:38:20.000000000 +0000 ++++ b/configuration.cpp 2018-09-13 22:58:52.577802948 +0000 +@@ -125,6 +125,15 @@ void Configuration::Init() + Configuration::Author = lineauth; + } + fauth.close(); ++ ++ //private ++ ifstream fpriv; ++ fpriv.open(string(homedir + "/.cpaste/private").c_str()); ++ if(fpriv.good()) ++ { ++ Configuration::Private = true; ++ } ++ fpriv.close(); + } + if (Configuration::Author.length() < 1) + { diff --git a/SOURCES/cpaste-useragent.patch b/SOURCES/cpaste-useragent.patch new file mode 100644 index 0000000..2c72697 --- /dev/null +++ b/SOURCES/cpaste-useragent.patch @@ -0,0 +1,20 @@ +diff -aurp a/main.cpp b/main.cpp +--- a/main.cpp 2018-09-13 04:19:21.000000000 +0000 ++++ b/main.cpp 2018-09-13 23:04:17.214701846 +0000 +@@ -129,12 +129,14 @@ int main(int argc, char *argv[]) + post += "&private=1"; + if (Stikkit::Configuration::Expiry != "0") + post += "&expire=" + Stikkit::Configuration::Expiry; ++ string useragent; ++ useragent = "cpaste " + Stikkit::Configuration::Version + " (https://paste.centos.org/)"; + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); + curl_easy_setopt(curl, CURLOPT_URL, Stikkit::Configuration::URL.c_str()); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post.c_str()); +- curl_easy_setopt(curl, CURLOPT_USERAGENT, "stikkit"); ++ curl_easy_setopt(curl, CURLOPT_USERAGENT, useragent.c_str()); + +- /* Perform the request, res will get the return code */ ++ /* Perform the request, res will get the return HTTP code */ + res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) diff --git a/SOURCES/default_apikey b/SOURCES/default_apikey new file mode 100644 index 0000000..5947293 --- /dev/null +++ b/SOURCES/default_apikey @@ -0,0 +1 @@ +5uZ30dTZE1a5V0WYhNwcMddBRDpk6UzuzMu-APKM38iMHacxdA0n4vCqA34avNyt diff --git a/SOURCES/default_expiry b/SOURCES/default_expiry new file mode 100644 index 0000000..72058b9 --- /dev/null +++ b/SOURCES/default_expiry @@ -0,0 +1 @@ +10080 diff --git a/SOURCES/default_url b/SOURCES/default_url new file mode 100644 index 0000000..5c9c001 --- /dev/null +++ b/SOURCES/default_url @@ -0,0 +1 @@ +https://paste.centos.org diff --git a/SPECS/cpaste.spec b/SPECS/cpaste.spec new file mode 100644 index 0000000..c912fac --- /dev/null +++ b/SPECS/cpaste.spec @@ -0,0 +1,75 @@ +Name: cpaste +Version: 1.0.0 +Release: 2%{?dist} +Summary: Command line tool to upload things to pastebin.centos.org + +License: GPL +URL: http://github.com/benapetr/stikkit +Source0: http://paste.scratchbook.ch/download/%{name}-%{version}.tar.gz +Source1: default_apikey +Source2: default_url +Source3: default_expiry +Source4: README.CentOS + + +Patch1: cpaste-support-private.patch +Patch2: cpaste-useragent.patch +Patch3: cpaste-lastargasfilename.patch + +BuildRequires: libcurl-devel cmake + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +%description +Command line tool to upload things to the CentOS Project's pastebin service +located at https://pastebin.centos.org. Will accept input from a named file +piped in via standard input. Permits the user to specify title; authors name; +expiry time; language/format and mark the paste as private. May also be used +for any other stikked-based pastebin service. + +%prep +%setup -q + +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 + +%build +cmake . +make %{?_smp_mflags} + +%install +make install DESTDIR=%{buildroot} INSTALL="install -p" +mkdir -p %{buildroot}%{_bindir} +mv %{buildroot}/usr/local/bin/cpaste %{buildroot}%{_bindir}/cpaste +mkdir -p %{buildroot}%{_sysconfdir}/cpaste +cp %{SOURCE1} %{buildroot}%{_sysconfdir}/cpaste/apikey +cp %{SOURCE2} %{buildroot}%{_sysconfdir}/cpaste/url +cp %{SOURCE3} %{buildroot}%{_sysconfdir}/cpaste/expiry + +install -m 0644 %{SOURCE4} $RPM_BUILD_DIR/%{name}-%{version}/ + +%post + +%preun + +%files +%doc README.md License.txt README.CentOS +%{_bindir}/%{name} +%dir %{_sysconfdir}/%{name} +%config %{_sysconfdir}/%{name}/apikey +%config %{_sysconfdir}/%{name}/url +%config %{_sysconfdir}/%{name}/expiry + +%changelog +* Thu Sep 13 2018 Pablo Greco - 1.0.0-2 +- Backport patch from stikkit to support private pastes +- Backport patch from stikkit to change useragent +- Use last invalid arg as filename, no need to use -i to paste a file + +* Thu Sep 13 2018 Psychotic Build System - 1.0.0-1 +- Forked from the Psychotic Ninja 'stikkit-1.0.6-7' package and rebased to 1.0.0 +- Renamed stikkit->cpaste; stikkit.1->cpaste.1; README.Psychotic->README.CentOS +- Updated README.CentOS +- Updated stikkit.1 +- Path references changed from /stikkit/ to /cpaste/