commit c63419adbc8670ef8c94799ff70d0b6887f82bcb Author: Mario Fetka Date: Fri Mar 14 08:23:25 2014 +0100 Initial commit basierend auf dem wiki template diff --git a/CLIENT_DATA/morgen.bat b/CLIENT_DATA/morgen.bat new file mode 100644 index 0000000..39cd193 --- /dev/null +++ b/CLIENT_DATA/morgen.bat @@ -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% diff --git a/CLIENT_DATA/setup.ins b/CLIENT_DATA/setup.ins new file mode 100644 index 0000000..e80be71 --- /dev/null +++ b/CLIENT_DATA/setup.ins @@ -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$ diff --git a/CLIENT_DATA/uninstall.ins b/CLIENT_DATA/uninstall.ins new file mode 100644 index 0000000..b79d3bb --- /dev/null +++ b/CLIENT_DATA/uninstall.ins @@ -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$" diff --git a/OPSI/changelog.txt b/OPSI/changelog.txt new file mode 100644 index 0000000..bc69317 --- /dev/null +++ b/OPSI/changelog.txt @@ -0,0 +1,2 @@ +Don't add cahngelog entries here! +It get autogenerated by the opsi-builder.sh \ No newline at end of file diff --git a/OPSI/control b/OPSI/control new file mode 100644 index 0000000..5b5a004 --- /dev/null +++ b/OPSI/control @@ -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"] + diff --git a/OPSI/postinst b/OPSI/postinst new file mode 100644 index 0000000..a8e33fc --- /dev/null +++ b/OPSI/postinst @@ -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 +# diff --git a/OPSI/preinst b/OPSI/preinst new file mode 100644 index 0000000..15a5320 --- /dev/null +++ b/OPSI/preinst @@ -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 +# diff --git a/PSTools-2.zip.sha1sum b/PSTools-2.zip.sha1sum new file mode 100644 index 0000000..40fe3cd --- /dev/null +++ b/PSTools-2.zip.sha1sum @@ -0,0 +1 @@ +e681327d51031436e314cc162af0acde67c296d2 /home/mario/.opsi-dist-cache/microsoft.localuser-2/ALL/PSTools-2.zip diff --git a/Testing.txt b/Testing.txt new file mode 100644 index 0000000..d6b5e6c --- /dev/null +++ b/Testing.txt @@ -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: ?? + + diff --git a/builder-product.cfg b/builder-product.cfg new file mode 100644 index 0000000..f03f9b0 --- /dev/null +++ b/builder-product.cfg @@ -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" + diff --git a/builder-targets-cb.sh b/builder-targets-cb.sh new file mode 100644 index 0000000..5b93c3d --- /dev/null +++ b/builder-targets-cb.sh @@ -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_ is possible. +# +# Abstract: +# target order: config, prepare, retrieve, create, package, publish, commit, cleanup +# callbacks: +# +############################################################################## + +function cleanup() { + echo "Cleanup" + builder_cleanup +} + +function create() { + echo "Create" + builder_create + + find $INST_DIR/CLIENT_DATA/ALL/ -type f ! -name 'PsGet*' -delete +} \ No newline at end of file diff --git a/user-account.jpg.sha1sum b/user-account.jpg.sha1sum new file mode 100644 index 0000000..3219abd --- /dev/null +++ b/user-account.jpg.sha1sum @@ -0,0 +1 @@ +34e1f10c2105bf1214813179f6689cc359f12e7d /home/mario/.opsi-dist-cache/microsoft.localuser-2//user-account.jpg