Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
chpassroot / usr / bin / chpassroot
Size: Mime:
#!/bin/bash
#------------------------------------------#
#     Change root password                 #
# Simple gui dialog root password changer  #
#------------------------------------------#

ICON="/usr/share/chpassroot/icons/chpassroot.png"
MICON="/usr/share/chpassroot/icons/chpassroot16.png"
EICON="/usr/share/chpassroot/icons/warning.png"
ESICON="/usr/share/chpassroot/icons/warning16.png"
OK="/usr/share/chpassroot/icons/ok.svg"
CANCEL="/usr/share/chpassroot/icons/cancel.svg"

pass_dialog="root"
clean_log() {
	
	# clear the log of plain-text passwords
	if [ -n "$newpass" ]; then
		sed -i "s|$newpass|\*\*\*\*|"g $error_log
	fi
	
	if [ -n "$confirm_newpass" ]; then
		sed -i "s|$confirm_newpass|\*\*\*\*|"g $error_log
	fi
	newpass=""
	confirm_newpass=""
}

pass_error() {
	clean_log
	use_existing=""
	yad --window-icon="$ESICON" --title=$"Password Error" --center --borders=10 \
	--image="$EICON" --width=400 --height=100 --fixed --button="Close!$CANCEL":0 \
	--text=$"\nPasswords do not match!  Restart the dialog again."
exit 0	
}
pass_entry=$(yad --window-icon="$MICON" --form --title=$"Configure $pass_dialog password" \
--width=450 --height=125 --center --borders=10 --button="Ok!$OK":0 \
--text=$"Resetting the <span color=\"#e07b39\">$pass_dialog</span> password:            Use TAB to change fields." \
--field=$"Enter new <span color=\"#e07b39\">$pass_dialog</span> password::H" \
--field=$"Confirm new <span color=\"#e07b39\">$pass_dialog</span> password::H")  
newpass=$(echo $pass_entry|awk -F "|" '{print $1}')
confirm_newpass=$(echo $pass_entry|awk -F "|" '{print $2}')
use_existing=$(echo $pass_entry|awk -F "|" '{print $3}')

	if [ -n "$newpass" ] && [ "$use_existing" = "TRUE" ]; then
	pass_error

	fi

	if [ -z "$newpass" ] || [ "$newpass" != "$confirm_newpass" ]; then
	pass_error
	fi

	pass_dialog=root

	if [ -n "$newpass" ]; then
	/bin/bash -c "echo -e \"$newpass\n$newpass\n\" | passwd root"
	fi
	
$(yad --window-icon="$MICON" --image="$ICON" --title=$"Root Password" \
--width=400 --height=100 --fixed --center --borders=10 --on-top --button="Ok!$OK":0 \
--text=$"\nRoot password have been updated successfully!" )		
exit 0			
	fi