--- /dev/null
+WinActivator
--- /dev/null
+Copyright (c) 2017 Peter Varkoly and Helmuth Varkoly Nürnberg. All rights reserverd.
\ No newline at end of file
--- /dev/null
+PACKAGE = $(shell basename `pwd` )
+DESTDIR = /
+REPO = /srv/www/repo/salt-packages/
+VERSION = $(shell cat VERSION )
+RELEASE = $(shell cat RELEASE )
+NRELEASE = $(shell echo $(RELEASE) + 1 | bc )
+YEAR = $(shell date +%Y )
+
+package:
+ sed s/VERSION/$(VERSION)/g oss-pkg-$(PACKAGE).spec.in > oss-pkg-$(PACKAGE).spec
+ sed -i s/RELEASE/$(NRELEASE)/g oss-pkg-$(PACKAGE).spec
+ sed -i s/PACKAGE/$(PACKAGE)/g oss-pkg-$(PACKAGE).spec
+ sed -i s/YEAR/$(YEAR)/g oss-pkg-$(PACKAGE).spec
+ ../oss-pkg-tools/create_hash.sh $(PACKAGE)
+ rm -rf oss-pkg-$(PACKAGE)
+ rm -rf repo-ng/repo-ng
+ mkdir -p oss-pkg-$(PACKAGE)
+ sed s/PACKAGE/$(PACKAGE)/g $(PACKAGE).sls > oss-pkg-$(PACKAGE)/$(PACKAGE).sls
+ if [ -d repo-ng ]; then ln -s ../repo-ng/ oss-pkg-$(PACKAGE)/repo-ng; fi
+ tar hjcvpf oss-pkg-$(PACKAGE).tar.bz2 oss-pkg-$(PACKAGE)
+ rm -rf oss-pkg-$(PACKAGE)
+ mv oss-pkg-$(PACKAGE).tar.bz2 /usr/src/packages/SOURCES/
+ rpmbuild -bb oss-pkg-$(PACKAGE).spec
+ find $(REPO)/noarch -name oss-pkg-$(PACKAGE)-$(VERSION)-*.rpm* -exec rm {} \;
+ mv /usr/src/packages/RPMS/noarch/oss-pkg-$(PACKAGE)-$(VERSION)-$(NRELEASE).noarch.rpm $(REPO)/noarch
+ echo $(NRELEASE) > RELEASE
+ git commit -a -m "New release"
+ git push
+ createrepo $(REPO)
+
+
--- /dev/null
+###############################################################################
+# SLS: PACKAGE
+# Copyright (c) 2017 Helmuth Varkoly, Nuermberg, Germany.
+# All rights reserved.
+#
+# Author: Helmuth Varkoly
+#
+# Description: SLS to use with OSS's softwaremanagement
+###############################################################################
+PACKAGE:
+ pkg:
+ - installed
+
+
--- /dev/null
+#
+# Spec file for PACKAGE
+# Copyright (c) YEAR Helmuth Varkoly and Peter Varkoly Nuremberg, Germany. All rights reserved.
+#
+
+Name: oss-pkg-PACKAGE
+Summary: Package to install PACKAGE on OSS-Clients
+Version: VERSION
+Release: RELEASE
+License: GPL-2.0
+Vendor: Peter Varkoly and Helmuth Varkoly
+Packager: peter@varkoly.de
+Group: Productivity/
+Source: %{name}.tar.bz2
+BuildArch: noarch
+BuildRequires:unzip
+#Requires:
+Requires: filesystem
+PreReq: salt-master
+PreReq: %fillup_prereq
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
+%description
+Package to install PACKAGE on OSS-Clients
+
+Authors:
+--------
+ helmuth@varkoly.de
+ peter@varkoly.de
+
+
+%prep
+%setup -n %{name}
+
+%build
+
+%install
+
+mkdir -p %{buildroot}/srv/salt/win/repo-ng/PACKAGE
+mkdir -p %{buildroot}/srv/salt/packages/
+cp PACKAGE.sls %{buildroot}/srv/salt/packages/
+cp -a repo-ng/* %{buildroot}/srv/salt/win/repo-ng/PACKAGE
+
+%clean
+rm -rf %{buildroot}
+
+%pre
+
+%post
+
+/usr/sbin/oss_api_post_file.sh 'softwares/add' /srv/salt/win/repo-ng/PACKAGE/HASH.json
+
+%files
+%defattr(644,root,root)
+/srv/salt/win/repo-ng/PACKAGE
+/srv/salt/packages/PACKAGE.sls
+
+
--- /dev/null
+param(\r
+[String]$key,\r
+[String]$action\r
+)\r
+\r
+#Check current status \r
+\r
+$status = cscript //nologo C:\windows\System32\slmgr.vbs /dli\r
+\r
+function addReg($man){\r
+\r
+ $regpath = "HKLM:/SOFTWARE/MIcrosoft/Windows/Currentversion/uninstall/WinActivator" \r
+\r
+ New-Item -Path $regpath -Force\r
+ New-ItemProperty -Path $regpath -Name "DisplayName" -PropertyType String -value "WinActivator"\r
+ New-ItemProperty -Path $regpath -Name "DisplayVersion" -PropertyType String -value "1.1"\r
+ New-ItemProperty -Path $regpath -Name "Publisher" -PropertyType String -Value "Helmuth Varkoly"\r
+ New-ItemProperty -Path $regpath -Name "URL" -PropertyType String -Value "https://cranix-solutions.de"\r
+ New-ItemProperty -Path $regpath -Name "UninstallString" -PropertyType String -Value "SomeValue"\r
+ New-ItemProperty -Path $regpath -Name "InstallType" -PropertyType String -Value $man\r
+\r
+}\r
+\r
+if ($action -eq "install"){\r
+if($status[4] -like "*Lizenziert*"){\r
+\r
+ write-host $status[4]\r
+ addReg("manually")\r
+\r
+}else {\r
+\r
+\r
+ cscript //nologo C:\windows\system32\slmgr.vbs /ipk $key\r
+\r
+ cscript //nologo C:\windows\system32\slmgr.vbs /ato\r
+\r
+ $after = cscript //nologo C:\windows\System32\slmgr.vbs /dli\r
+ if($after[4] -like "*Lizenziert*"){\r
+ addReg("salt")\r
+ }\r
+\r
+ }\r
+}else {\r
+\r
+#Delete Key \r
+\r
+ cscript //nologo C:\windows\system32\slmgr.vbs /upk\r
+ cscript //nologo C:\windows\system32\slmgr.vbs /ato\r
+ remove-item -path "HKLM:/SOFTWARE/MIcrosoft/Windows/Currentversion/uninstall/WinActivator" -force\r
+}\r
--- /dev/null
+###############################################################################
+# SLS: WinActivator
+# Copyright (c) 2017 Helmuth Varkoly, Nuermberg, Germany.
+# All rights reserved.
+#
+# Authors: Helmuth Varkoly
+#
+# Description: Package SLS
+###############################################################################
+
+{% set LOG_PATH = 'C:\\salt\\var\\log' %}
+{% set LIC = salt['grains.get']('LIC_WinActivator') %}
+
+
+WinActivator:
+ '1.0':
+ full_name: 'WinActivator'
+ installer: salt://win/repo-ng/WinActivator/install.bat
+ install_flags: "{{ LIC }}"
+ uninstaller: salt://win/repo-ng/WinActivator/remove.bat
+ uninstall_flags: "{{ LIC }}"
+ msiexec: False
+ locale: de_DE
+ reboot: False
+ cache_dir: True
--- /dev/null
+@echo off
+
+
+powershell.exe -executionpolicy bypass -File C:\\salt\\var\\cache\\salt\\minion\\files\\base\\win\\repo-ng\\WinActivator\\Activate.ps1 -key %1 -action install
--- /dev/null
+@echo off
+
+
+powershell.exe -executionpolicy bypass -File C:\\salt\\var\\cache\\salt\\minion\\files\\base\\win\\repo-ng\\WinActivator\\Activate.ps1 -key %1 -action remove