Initial commit basierend auf dem wiki template

This commit is contained in:
Mario Fetka 2014-03-14 08:23:25 +01:00
commit c63419adbc
12 changed files with 419 additions and 0 deletions

39
CLIENT_DATA/morgen.bat Normal file
View File

@ -0,0 +1,39 @@
@echo off
setlocal
rem Datum auslesen
set tag=%date:~-10,2%
set monat=%date:~-7,2%
set jahr=%date:~-4%
if %monat% NEQ 2 goto :done
rem Letzter Tag im Februar, Schaltjahr prüfen
set /a mod4=jahr % 4
set /a mod100=jahr % 100
set /a mod400=jahr % 400
set ltag=28
if %mod4% NEQ 0 goto :done
set ltag=29
if %mod100% NEQ 0 goto :done
set ltag=28
if %mod400% NEQ 0 goto :done
set ltag=29
:done
rem Letzter Tag des Monats
if %monat% EQU 1 set ltag=31
if %monat% EQU 3 set ltag=31
if %monat% EQU 4 set ltag=30
if %monat% EQU 5 set ltag=31
if %monat% EQU 6 set ltag=30
if %monat% EQU 7 set ltag=31
if %monat% EQU 8 set ltag=31
if %monat% EQU 9 set ltag=30
if %monat% EQU 10 set ltag=31
if %monat% EQU 11 set ltag=30
if %monat% EQU 12 set ltag=31
set /a tag+=1
if %tag% GTR %ltag% set /a monat+=1 & set tag=1
if %monat% GTR 12 set /a jahr+=1 & set monat=1
echo %tag%.%monat%.%jahr%

143
CLIENT_DATA/setup.ins Normal file
View File

@ -0,0 +1,143 @@
[Actions]
requiredWinstVersion >= "4.11.2.1"
setLogLevel=3
DefVar $ProductName$
DefVar $local_user$
DefVar $Group$
DefVar $SearchResult$
DefVar $flag_active$
DefVar $val_userpasswd$
DefVar $val_username$
DefVar $val_groupmember$
DefVar $val_expires$
DefVar $UserExists$
DefVar $UserGroup$
DefVar $date_tomorrow$
DefStringlist $ResultList$
DefStringlist $ResultList2$
DefStringlist $ResultList3$
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
; from builder-product.cfg : all variables definded by attribute WINST[index]
; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE
; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL
; auto generated winst-variables
; $IconFile$: path to product picture
;
@@BUILDER_VARIABLES@@
sub_get_properties
comment "get the name of the admin group"
comment "using psgetsid from sysinernals pstools"
if $UserGroup$ = "Administratoren"
set $ResultList$ = getOutStreamFromSection("DosInAnIcon_get_admin_group")
endif
if $UserGroup$ = "Benutzer"
set $ResultList$ = getOutStreamFromSection("DosInAnIcon_get_user_group")
endif
if $UserGroup$ = "Gaeste"
set $ResultList$ = getOutStreamFromSection("DosInAnIcon_get_guest_group")
endif
set $Group$ = takeString(6,$ResultList$)
set $Group$ = takeString(1,splitstring($Group$,"\"))
comment "Check if user exists."
comment "If user exists, the password will be altered. Otherwise, the user will be created."
set $ResultList2$ = getOutStreamFromSection("DosInAnIcon_checkuser")
set $UserExists$ = takeString(0,$ResultList2$)
setLogLevel=0
comment "create our local user"
if $UserExists$ = "no"
DosInAnIcon_makeadmin
else
DosInAnIcon_alter_pw
endif
setLogLevel=3
comment "Enables or disables the user."
comment "flag_active is set to 'no' by the product properties for not opening accidently a security risk *g*."
if $flag_active$ = "on"
DosInAnIcon_enable_admin
else
DosInAnIcon_disable_admin
endif
set $ResultList3$ = getOutStreamFromSection("DosInAnIcon_get_date_tomorrow")
set $date_tomorrow$ = takeString(2,$ResultList3$)
;set $date_tomorrow$ = takeString(1,splitstring(" ",$date_tomorrow$))
if $val_expires$ = "never"
DosInAnIcon_expires_never
else
DosInAnIcon_expires_tomorrow
endif
[sub_get_properties]
comment "flag_active"
comment "description: User active"
Set $flag_active$ = GetProductProperty("flag_active", "off")
comment "val_userpasswd"
comment "description: password"
Set $val_userpasswd$ = GetProductProperty("val_userpasswd", "SecurePW!")
comment "val_username"
comment "description: admin username"
set $local_user$= GetProductProperty("val_username", "locsupp")
comment "val_groupmember"
comment "description: Groupemembership"
set $UserGroup$= GetProductProperty("val_groupmember", "Administratoren")
comment "val_expires"
comment "description: expires"
set $val_expires$ = GetProductProperty("val_expires", "tomorrow")
[DosInAnIcon_checkuser]
@echo off
net user $local_user$ >nul 2>&1 && echo yes || echo no
[DosInAnIcon_get_admin_group]
@echo off
"$PsGetSidExe$" /accepteula S-1-5-32-544
[DosInAnIcon_get_user_group]
@echo off
"$PsGetSidExe$" /accepteula S-1-5-32-545
[DosInAnIcon_get_guest_group]
@echo off
"$PsGetSidExe$" /accepteula S-1-5-32-547
[DosInAnIcon_makeadmin]
NET USER $local_user$ $val_userpasswd$ /ADD /comment:"Local User created by opsi-package" /fullname:"Local User by Opsi" /passwordchg:no /passwordreq:yes
NET LOCALGROUP $Group$ /ADD $local_user$
[DosInAnIcon_alter_pw]
NET USER $local_user$ $val_userpasswd$
[DosInAnIcon_enable_admin]
NET USER $local_user$ /active:yes
[DosInAnIcon_disable_admin]
NET USER $local_user$ /active:no
[DosInAnIcon_get_date_tomorrow]
%ScriptPath%\morgen.bat
[DosInAnIcon_expires_never]
NET USER $local_user$ /expires:never
[DosInAnIcon_expires_tomorrow]
NET USER $local_user$ /expires:$date_tomorrow$

56
CLIENT_DATA/uninstall.ins Normal file
View File

@ -0,0 +1,56 @@
[Actions]
requiredWinstVersion >= "4.11.2.1"
setLogLevel=7
DefVar $ProductName$
DefVar $OpsiAdminPass$
DefVar $local_user$
DefVar $AdminGroup$
DefVar $SearchResult$
DefVar $flag_active$
DefVar $val_userpasswd$
DefVar $val_username$
DefVar $UserExists$
DefVar $LocalTempPath$
DefStringlist $ResultList2$
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
; from builder-product.cfg : all variables definded by attribute WINST[index]
; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE
; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL
; auto generated winst-variables
; $IconFile$: path to product picture
;
@@BUILDER_VARIABLES@@
sub_get_properties
comment "Check if user exists."
set $ResultList2$ = getOutStreamFromSection("DosInAnIcon_checkuser")
set $UserExists$ = takeString(0,$ResultList2$)
set $UserExists$ = takeString(0,splitstring($UserExists$," "))
if $UserExists$ = "yes"
DosInAnIcon_deleteuser
else
LogError "User '" + $local_user$ + "' does not exist!"
isFatalError
endif
[sub_get_properties]
comment "val_username"
comment "description: username"
set $local_user$= GetProductProperty("val_username", "locsupp")
[DosInAnIcon_checkuser]
@echo off
net user $local_user$ >nul 2>&1 && echo yes || echo no
[DosInAnIcon_deleteuser]
NET USER $local_user$ /DELETE
[DosInAnIcon_deleteprofile]
rmdir /S /Q "%ProfileDir%\$local_user$"

2
OPSI/changelog.txt Normal file
View File

@ -0,0 +1,2 @@
Don't add cahngelog entries here!
It get autogenerated by the opsi-builder.sh

68
OPSI/control Normal file
View File

@ -0,0 +1,68 @@
[Package]
version: 2
depends:
incremental: False
[Product]
type: localboot
id: local-admin-user
name: Lokaler Adminbenutzer
description: Lokaler Benutzer anlegen
advice:
version: 0.2
priority: 0
licenseRequired: False
productClasses:
setupScript: setup.ins
uninstallScript: uninstall.ins
updateScript:
alwaysScript:
onceScript:
customScript:
userLoginScript:
[ProductProperty]
type: unicode
name: flag_active
multivalue: False
editable: False
description: Benutzer aktiv
values: ["off", "on"]
default: ["off"]
[ProductProperty]
type: unicode
name: val_username
multivalue: False
editable: True
description: Benutzername des lokalen User
values: ["locsupp"]
default: ["locsupp"]
[ProductProperty]
type: unicode
name: val_groupmember
multivalue: False
editable: False
description: Gruppenmitgliedschaft des lokalen Users
values: ["Benutzer", "Administratoren", "Gaeste"]
default: ["Administratoren"]
[ProductProperty]
type: unicode
name: val_userpasswd
multivalue: False
editable: True
description: Passwort des lokalen Users
values: ["SecurePW!"]
default: ["SecurePW!"]
[ProductProperty]
type: unicode
name: val_expires
multivalue: False
editable: True
description: Expires
values: ["never", "tomorrow"]
default: ["tomorrow"]

9
OPSI/postinst Normal file
View File

@ -0,0 +1,9 @@
#! /bin/sh
#
# postinst script for softprod
# This script executes after unpacking files from that archive and registering the product at the server.
#
# The following environment variables can be used to obtain information about the current installation:
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory which contains the installed client data
#

9
OPSI/preinst Normal file
View File

@ -0,0 +1,9 @@
#! /bin/sh
#
# preinst script for softprod
# This script executes before that package will be unpacked from its archive file.
#
# The following environment variables can be used to obtain information about the current installation:
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory where client data will be installed
#

1
PSTools-2.zip.sha1sum Normal file
View File

@ -0,0 +1 @@
e681327d51031436e314cc162af0acde67c296d2 /home/mario/.opsi-dist-cache/microsoft.localuser-2/ALL/PSTools-2.zip

28
Testing.txt Normal file
View File

@ -0,0 +1,28 @@
*** Qualitiymanagement/Testing procedure
- Product:
- Name: productname
- Version: xxx
- Release: yyyy
- Environment
- OS: Native windows XP-32Bit installation
- Preinstalled packages: None (also no aio)
- Files used while testing:
File1: http://domain.de/file.ext
- Testing process:
OPSI-action:
- Installation (without dependencies like AIO/Firefox): ??
Result:
- File extensions related to program: ??
- Start menu entry: ??
- Starting/using program: viewer works, File1 is shown correctly: ??
OPSI-action:
- Uninstall
Result:
- File extensions related to program: unrelated: ??
- Start menu entry: none: ??

31
builder-product.cfg Normal file
View File

@ -0,0 +1,31 @@
############################
# Setup product information
############################
VENDOR="wiki.opsi.org"
PN="microsoft.localuser"
NAME="Create Local User"
DESCRIPTION="Dieses Packet erstellt einen lokalen Benutzer."
VERSION="2"
RELEASE="3"
PRIORITY="0"
ADVICE=""
# TYPE - defines, if the install files are public or restricted.
# Valid value: restricted | public
TYPE="public"
DL_FILE[0]="user-account.jpg"
DL_SOURCE[0]="http://itekblog.com/wp-content/uploads/2012/06/user-account.jpg"
DL_FILE[1]="PSTools-${VERSION}.zip"
DL_SOURCE[1]="http://download.sysinternals.com/files/PSTools.zip"
DL_ARCH[1]="ALL"
DL_DOWNLOADER[1]="wget"
DL_EXTRACT_FORMAT[1]="unzip"
# File array index for the image showing while installing the program
ICON_DL_INDEX=0
WINST_NAME[0]="PsGetSidExe"
WINST_VALUE[0]="@DL_EXTRACT_WINST_PATH[1]@\\PsGetsid.exe"

32
builder-targets-cb.sh Normal file
View File

@ -0,0 +1,32 @@
##############################################################################
# This optional file "builder-targets-cb.sh" will be called by builder.sh
#
# The targets will be called from thde opsi-builder using the following
# order: config, prepare, retrieve, create, package, publish, commit, cleanup
# You can overwrite the target functions in builder-targets-cb.sh
#
# You can define callback functions. The functions are called from
# opsi-builder within processing a target
# cb_package_makeproductfile
#
# You can use every variable defined in any configuration file or by
# the defined builder script itself. Also, calling the predefined
# targets builder_<targetname> is possible.
#
# Abstract:
# target order: config, prepare, retrieve, create, package, publish, commit, cleanup
# callbacks: <none>
#
##############################################################################
function cleanup() {
echo "Cleanup"
builder_cleanup
}
function create() {
echo "Create"
builder_create
find $INST_DIR/CLIENT_DATA/ALL/ -type f ! -name 'PsGet*' -delete
}

1
user-account.jpg.sha1sum Normal file
View File

@ -0,0 +1 @@
34e1f10c2105bf1214813179f6689cc359f12e7d /home/mario/.opsi-dist-cache/microsoft.localuser-2//user-account.jpg