Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:jnweiger
rembrand
check-all.sh
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File check-all.sh of Package rembrand
#!/bin/bash # Copyright 2007 David Bolt #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License #as published by the Free Software Foundation; either version 2 #of the License, or (at your option) any later version. # #This program is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #GNU General Public License for more details. # set the defaults. some can be modified by options passed on the command line # well, they will be when/if I actually add command line parsing :-) # The following are all based upon my system. If you're going to use this # to do a similar job, you will most likely need to alter some of the # paths. # # as with my previous scripts, this has virtually no error checking so use at # your own risk # # where (almost) everything is based # BASEPATH="/local" # default file containing the list of every image file already checked # CHECKED="${BASEPATH}/checked.images.txt" # list of images that need to be reported # REPORT="${BASEPATH}/images.to.report.txt" # list of already known images, and ones ready to be reported # KNOWN="${BASEPATH}/known.suse-images.txt" # list of already known images, and ones ready to be reported # CHECKED_RPMS="${BASEPATH}/checked.rpms.txt" # list of already known images, and ones ready to be reported # RPMS_LIST="${BASEPATH}/rpms.to.check.txt" # where to find the RPM files # RPM_SRC="/suse" # where to store the tiled images # IMAGES="${BASEPATH}/montage" # where to store the file list fragments # FILELISTS="${BASEPATH}/image.lists" # temporary filename # TEMPFILE="${BASEPATH}/suse.image.$$" # temporary directory # EXTRACTED="${BASEPATH}/extracted.$$" # no need to edit these # REMAIN="done. %6u files remain.\n" FOUND="done. %6u files found.\n" AKNOWN="done. %6u files known.\n" OPTIONAL="o:%s:%s\n" NONOPTIONAL=":%s:%s\n" ROTATOR='-/|\' COUNTER="0" ################################################################################ ################################################################################ # # now we start the script # ################################################################################ ################################################################################ # function used to perform a clean up. expects a value passed as the exit code # EXIT() { cd "${BASEPATH}" rm -f "${TEMPFILE}."?".txt" rm -rf "${EXTRACTED}."?".txt" rm -rf "${IMAGES}"/* rm -rf "${FILELISTS}"/* rm -rf "${RPMS_LIST}" exit "$1" } # make a temporary directory. abort on failure # mkdir -p "${EXTRACTED}" || exit 1 # change CWD to the temporary directory # cd "${EXTRACTED}" clear printf "Started working at: %-30s\n" "$(date -R)" # get the list of RPMS to check # find "${RPM_SRC}/suse" -type f -name "*.rpm" | sort -u >"${RPMS_LIST}~" touch "${CHECKED_RPMS}" cat "${CHECKED_RPMS}" "${CHECKED_RPMS}" "${RPMS_LIST}~" | sort | uniq -u >"${RPMS_LIST}" rm "${RPMS_LIST}~" # go through each individual RPM. no distinction made for any source RPMs on the media # for RPM_NAME in $(cat "${RPMS_LIST}") do # clear out the old montage images and file lists # find "${IMAGES}" -type f -print0 | xargs -0 rm 2>/dev/null find "${FILELISTS}" -type f -print0 | xargs -0 rm 2>/dev/null # get the base filename # FNAME=$(basename "${RPM_NAME}" | awk -F"-[[:digit:]]*\\\." '{print $1}') # and just to provide some feedback # printf "\r%-60s" $(basename "${RPM_NAME}") # unpack RPM # rpm2cpio "${RPM_NAME}" | cpio -i --make-directories >/dev/null 2>&1 # check to see if there are any images # COUNT=$(find -type f | wc -l | awk '{print $1}') if [ "${COUNT}" -gt 0 ] then find -type f -print0 | xargs -0 file | sort | grep " image data" >"${TEMPFILE}.2.txt" find -type f -print0 | xargs -0 file | sort | grep " X pixmap image" >>"${TEMPFILE}.2.txt" # if there are... # if [ -s "${TEMPFILE}.2.txt" ] then # extract the file names # awk -F": " '{print $1}' <"${TEMPFILE}.2.txt" >"${TEMPFILE}.1.txt" # exit 0 # remove the known SUSE file names # for filename in $(cat ${KNOWN}) do egrep -v -e "${filename}" "${TEMPFILE}.1.txt" >"${TEMPFILE}.2.txt" mv "${TEMPFILE}".{2,1}.txt done # and then remove those we've already checked # cat "${CHECKED}" "${CHECKED}" "${TEMPFILE}.1.txt" 2>/dev/null | \ sort | \ uniq -u >"${TEMPFILE}.2.txt" # if there are unchecked files # if [ -s "${TEMPFILE}.2.txt" ] then # generate the smaller lists # COUNTER="0" FILECOUNTER="0" FILECOUNT="" while read imagename do printf "${imagename}\n" >> $(printf "${FILELISTS}/images.%04u.txt" "${COUNTER}") FILECOUNT=$(printf "${IMAGES}/images.%04u.jpg" "${COUNTER}") montage "${imagename}" \ -tile 1x \ -geometry 480x480+20+20 \ "${FILECOUNT}" COUNTER=$((${COUNTER}+1)) done <"${TEMPFILE}.2.txt" # now we sit and wait until the images have been scanned # printf "%4u images found. Press return to continue" "${COUNTER}" read -s COUNTER printf "\n" COUNT=$(find "${FILELISTS}" -type f -name "*.present"|wc -l|awk '{print $1}') if [ "${COUNT}" -gt 0 ] then cat "${FILELISTS}"/*.present >"${TEMPFILE}.2.txt" for COUNT in $(cat "${TEMPFILE}.2.txt") do # krita "${COUNT}" >/dev/null 2>&1 xview -fullscreen "${COUNT}" >/dev/null 2>&1 printf "SUSE branded? [Optional/non-oPtional/No] " while : do read -s -n 1 key if [ -z "${key}" ] then printf "Yes. Non-optional\n" printf "${NONOPTIONAL}" "${FNAME}" "${COUNT:1}" >>"${REPORT}" else case "${key}" in P|p) printf "Yes. Non-optional\n" printf "${NONOPTIONAL}" "${FNAME}" "${COUNT:1}" >>"${REPORT}" break ;; O|o) printf "Yes. Optional\n" printf "${OPTIONAL}" "${FNAME}" "${COUNT:1}" >>"${REPORT}" break ;; N|n) printf "No.\n" echo "${FILENAME}" >>"${CHECKED}" break ;; A|a) # hidden option. allows me to stop everything. printf "Aborting\n" EXIT 0 ;; *) ;; esac fi done done fi # check to see if there's any file lists not renamed # cat "${TEMPFILE}.2.txt" >>"${CHECKED}" find "${FILELISTS}" -type f -name "*.txt" -exec rm '{}' \; clear sort -u < "${CHECKED}" >"${CHECKED}~" mv "${CHECKED}~" "${CHECKED}" printf "Checked images...\t\t\t${REMAIN}" "$(wc -l ${CHECKED} | awk '{print $1}')" sort -u < "${REPORT}" >"${REPORT}~" mv "${REPORT}~" "${REPORT}" printf "New to report...\t\t\t${FOUND}" "$(wc -l "${REPORT}" | awk '{print $1}')" sort -u < "${KNOWN}" >"${KNOWN}~" mv "${KNOWN}~" "${KNOWN}" printf "Known SUSE images...\t\t\t${AKNOWN}\n" "$(wc -l "${KNOWN}" | awk '{print $1}')" fi fi # clean up ready for next package # rm -rf * "${TEMPFILE}."?".txt" fi # # echo "${RPM_NAME}" >>"${CHECKED_RPMS}" done # finished. Now strip off any initial '.' # for FILENAME in $(cat "${CHECKED}") do [ "${FILENAME::1}" == "." ] && echo "${FILENAME:1}" done | sort -u >"${CHECKED}~" mv "${CHECKED}~" "${CHECKED}" EXIT 0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor