mirror of
				https://github.com/arkenfox/user.js.git
				synced 2025-11-04 07:45:26 +01:00 
			
		
		
		
	
							
								
								
									
										17
									
								
								updater.sh
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								updater.sh
									
									
									
									
									
								
							@@ -2,9 +2,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## ghacks-user.js updater for macOS and Linux
 | 
					## ghacks-user.js updater for macOS and Linux
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## version: 2.1
 | 
					## version: 2.2
 | 
				
			||||||
## Author: Pat Johnson (@overdodactyl)
 | 
					## Author: Pat Johnson (@overdodactyl)
 | 
				
			||||||
## Additional contributors: @earthlng, @ema-pe
 | 
					## Additional contributors: @earthlng, @ema-pe, @claustromaniac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## DON'T GO HIGHER THAN VERSION x.9 !! ( because of ASCII comparison in update_updater() )
 | 
					## DON'T GO HIGHER THAN VERSION x.9 !! ( because of ASCII comparison in update_updater() )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -236,7 +236,11 @@ update_updater () {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Returns version number of a user.js file
 | 
					# Returns version number of a user.js file
 | 
				
			||||||
get_userjs_version () {
 | 
					get_userjs_version () {
 | 
				
			||||||
  echo "$(sed -n '4p' "$1")"
 | 
					  if [ -e $1 ]; then
 | 
				
			||||||
 | 
					    echo "$(sed -n '4p' "$1")"
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    echo "Not detected."
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_override () {
 | 
					add_override () {
 | 
				
			||||||
@@ -286,7 +290,7 @@ update_userjs () {
 | 
				
			|||||||
  # Copy a version of user.js to diffs folder for later comparison
 | 
					  # Copy a version of user.js to diffs folder for later comparison
 | 
				
			||||||
  if [ "$COMPARE" = true ]; then
 | 
					  if [ "$COMPARE" = true ]; then
 | 
				
			||||||
    mkdir -p userjs_diffs
 | 
					    mkdir -p userjs_diffs
 | 
				
			||||||
    cp user.js userjs_diffs/past_user.js
 | 
					    cp user.js userjs_diffs/past_user.js &>/dev/null
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # backup user.js
 | 
					  # backup user.js
 | 
				
			||||||
@@ -295,7 +299,7 @@ update_userjs () {
 | 
				
			|||||||
  if [ $BACKUP = 'single' ]; then
 | 
					  if [ $BACKUP = 'single' ]; then
 | 
				
			||||||
    bakname='userjs_backups/user.js.backup'
 | 
					    bakname='userjs_backups/user.js.backup'
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
  cp user.js "$bakname"
 | 
					  cp user.js "$bakname" &>/dev/null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  mv "${newfile}" user.js
 | 
					  mv "${newfile}" user.js
 | 
				
			||||||
  echo -e "Status: ${GREEN}user.js has been backed up and replaced with the latest version!${NC}"
 | 
					  echo -e "Status: ${GREEN}user.js has been backed up and replaced with the latest version!${NC}"
 | 
				
			||||||
@@ -324,8 +328,7 @@ update_userjs () {
 | 
				
			|||||||
    else
 | 
					    else
 | 
				
			||||||
      echo -e "Warning: ${ORANGE}Your new user.js file appears to be identical.  No diff file was created.${NC}"
 | 
					      echo -e "Warning: ${ORANGE}Your new user.js file appears to be identical.  No diff file was created.${NC}"
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					    rm $past_nocomments $current_nocomments $pastuserjs &>/dev/null
 | 
				
			||||||
    rm $past_nocomments $current_nocomments $pastuserjs
 | 
					 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if [ "$VIEW" = true ]; then open_file "${PWD}/user.js"; fi
 | 
					  if [ "$VIEW" = true ]; then open_file "${PWD}/user.js"; fi
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user