-
-
Save IMMarkXLII/99d58d309a5a04211c8d254f284546a6 to your computer and use it in GitHub Desktop.
Revisions
-
Ashish Adhikari revised this gist
Mar 20, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,6 +20,7 @@ if [ -f "${USERPIC}" ] ; then # Check to see if the username is correct and import picture if ${ID_CMD} "${USERNAME}" &>/dev/null ; then # No credentials passed as we are running as root # removing the current image from user Pictures using dscl dscl . -delete /Users/${USERNAME} JPEGPhoto && dscl . delete /Users/${USERNAME} Picture && ${DSIMPORT_CMD} "${PICIMPORT}" /Local/Default M && -
Ashish Adhikari renamed this gist
Mar 20, 2020 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,8 +20,10 @@ if [ -f "${USERPIC}" ] ; then # Check to see if the username is correct and import picture if ${ID_CMD} "${USERNAME}" &>/dev/null ; then # No credentials passed as we are running as root dscl . -delete /Users/${USERNAME} JPEGPhoto && dscl . delete /Users/${USERNAME} Picture && ${DSIMPORT_CMD} "${PICIMPORT}" /Local/Default M && echo "Successfully imported users picture." fi fi fi -
palmerc revised this gist
Aug 27, 2019 . 1 changed file with 22 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,27 @@ #!/bin/bash declare -xr AWK_CMD="/usr/bin/awk" declare -xr SW_VERS_CMD="/usr/bin/sw_vers" declare -xr DSIMPORT_CMD="/usr/bin/dsimport" declare -xr ID_CMD="/usr/bin/id" USERNAME="$1"; export USERNAME USERPIC="$2"; export USERPIC OSVERSION=$(${SW_VERS_CMD} -productVersion | ${AWK_CMD} -F"." '{print $2;exit}'); export OSVERSION # Add the LDAP picture to the user record if dsimport is avaiable 10.6+ if [ -f "${USERPIC}" ] ; then # On 10.6 and higher this works if [ "${OSVERSION}" -ge "6" ] ; then declare -x MAPPINGS='0x0A 0x5C 0x3A 0x2C' declare -x ATTRS='dsRecTypeStandard:Users 2 dsAttrTypeStandard:RecordName externalbinary:dsAttrTypeStandard:JPEGPhoto' declare -x PICIMPORT="/Library/Caches/${USERNAME}.picture.dsimport" printf "%s %s \n%s:%s" "${MAPPINGS}" "${ATTRS}" "${USERNAME}" "${USERPIC}" >"${PICIMPORT}" # Check to see if the username is correct and import picture if ${ID_CMD} "${USERNAME}" &>/dev/null ; then # No credentials passed as we are running as root ${DSIMPORT_CMD} "${PICIMPORT}" /Local/Default M && echo "Successfully imported users picture." fi fi fi -
acidprime revised this gist
Mar 21, 2012 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,8 +5,9 @@ declare -xr dsimport="/usr/bin/dsimport" declare -xr id="/usr/bin/id" export UserName="$1" export UserPicture="/path/to/$UserName.jpg" export OsVersion=`$sw_vers -productVersion | $awk -F"." '{print $2;exit}'` # Add the LDAP picture to the user record if dsimport is avaiable 10.6+ if [ -f "$UserPicture" ] ; then # On 10.6 and higher this works -
acidprime revised this gist
Mar 21, 2012 . 1 changed file with 9 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,11 @@ #!/bin/bash declare -xr awk="/usr/bin/awk" declare -xr sw_vers="/usr/bin/sw_vers" declare -xr dsimport="/usr/bin/dsimport" declare -xr id="/usr/bin/id" export UserName="$1" export OsVersion=`$sw_vers -productVersion | $awk -F"." '{print $2;exit}'` declare -x UserPicture="/path/to/$UserName.jpg" # Add the LDAP picture to the user record if dsimport is avaiable 10.6+ if [ -f "$UserPicture" ] ; then @@ -10,9 +16,9 @@ export OsVersion=`sw_vers -productVersion | awk -F"." '{print $2;exit}'` declare -x PictureImport="/Library/Caches/$UserName.picture.dsimport" printf "%s %s \n%s:%s" "$Mappings" "$Attributes" "$UserName" "$UserPicture" >"$PictureImport" # Check to see if the username is correct and import picture if $id "$UserName" &>/dev/null ; then # No credentials passed as we are running as root $dsimport -g "$PictureImport" /Local/Default M && echo "Successfully imported users picture." fi fi -
acidprime revised this gist
Mar 21, 2012 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ export UserName="$1" export OsVersion=`sw_vers -productVersion | awk -F"." '{print $2;exit}'` declare -x UserPicture="/path/to/$UserName.jpg" # Add the LDAP picture to the user record if dsimport is avaiable 10.6+ -
acidprime revised this gist
Mar 20, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ export OsVersion=`sw_vers -productVersion | awk -F"." '{print $2;exit}'` declare -x UserPicture="/path/to/$UserName.jpg" # Add the LDAP picture to the user record if dsimport is avaiable 10.6+ if [ -f "$UserPicture" ] ; then -
acidprime created this gist
Mar 20, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ export OsVersion=`$sw_vers -productVersion | $awk -F"." '{print $2;exit}'` declare -x UserPicture="/path/to/$UserName.jpg" # Add the LDAP picture to the user record if dsimport is avaiable 10.6+ if [ -f "$UserPicture" ] ; then # On 10.6 and higher this works if [ "$OsVersion" -ge "6" ] ; then declare -x Mappings='0x0A 0x5C 0x3A 0x2C' declare -x Attributes='dsRecTypeStandard:Users 2 dsAttrTypeStandard:RecordName externalbinary:dsAttrTypeStandard:JPEGPhoto' declare -x PictureImport="/Library/Caches/$UserName.picture.dsimport" printf "%s %s \n%s:%s" "$Mappings" "$Attributes" "$UserName" "$UserPicture" >"$PictureImport" # Check to see if the username is correct and import picture if id "$UserName" &>/dev/null ; then # No credentials passed as we are running as root dsimport -g "$PictureImport" /Local/Default M && echo "Successfully imported users picture." fi fi fi