General TC > Programming & Scripting - Unofficial

extension audit script

<< < (17/21) > >>

dentonlt:

--- Quote from: Misalf on March 16, 2016, 05:03:04 PM ---dentonlt, first of, thanks for contributing and maintaining submitqc.
I find text coloring in the output of scripts is very useful, however, I noticed there is none in the in the current submitqc, contrary to former versions. While there are lots of warnings which might be considered redundant, depending an what extensions are checked (not of your concern), it can be quite cumbersome to check the hole output by reading every line, compared to 'viewing' (f.e. red=error, yellow=warning, green=success etc.).

Any plans for fancy colors for those read-impaired people like me?

--- End quote ---
Hey, misalf:

Damn, so sorry that I missed your post - thought I had the tapatalk notifications on!

In short, use --color or -c. Hoping you already discovered that. Cheers ~

Misalf:
Ah, K then. Will make an alias or something.
Thanks!

polikuo:
Happy New Year people !  :D

submitqc is a great script, a very useful tool that saves us lots of trouble.

I've been making extensions by following the instructions on wiki.
http://wiki.tinycorelinux.net/wiki:creating_extensions


--- Quote ---sudo chown -R root:staff /tmp/package/usr/local/tce.installed
sudo chmod -R 775 /tmp/package/usr/local/tce.installed

--- End quote ---

However, every time I make an extension, I get the "wrongstartscriptperms" message.

I never take much heed since the script "fixes" the permission automatically.

Today, however, I got curious and checked the script.


--- Code: ---tc@box:~$ head -n 619 /usr/local/bin/submitqc | tail -n 71
# if ext has a startup file, check startup name, permissions, location, etc.
checkstartup() {
 
  echo -n "${BLUE}${SCRIPT}: ${F} startup files ok? ${NORMAL}"

  if [ ! -d usr/local/tce.installed/ ]; then
    echo "${GREEN}None present. Ok, I think.${NORMAL}"
    return # no startup script
  fi

  # count files in startup script dir; get name of startup script
  SSDIR="usr/local/tce.installed/"
  SS="$(ls -A $SSDIR)"
  COUNT="$(echo "$SS" | wc -l)"

  # is there only 1 startup file, named same as extension?
  case $COUNT in
    0)  echo -e "${RED}Has startup folder but no script. Repair manually.${NORMAL}"
  echo -e "${F}: startup folder without script. Repair manually." \
>> /tmp/submitqc/startupscript
        ;;
    1)  if [ "${SS}" != "${BASENAME}" ]; then
          echo -ne "\n${YELLOW}script name ($SS) is incorrect. Renaming ${BASENAME}. ${NORMAL}"
          echo "$F startup named $SS renamed $BASENAME" >> /tmp/submitqc/wrongstartscriptname
          SS="$(find $SSDIR -not -type d | tail -n 1)"
          mv "${SS}" "${SSDIR}${BASENAME}"
          echo "${YELLOW}Done.${NORMAL}"
          CHANGES=1
        fi
        ;;
    *)  echo -e "${RED}Multiple startup files, none named $F. Repair manually.${NORMAL}"
  echo -e "${F}: multiple startup files, none named $F. Repair manually." \
>> /tmp/submitqc/startupscript
        ;;
  esac

  DIRERROR=
 
  if [ ! "$(stat -c%a ${SSDIR})" = 775 ]; then
    sudo chmod 775 "usr/local/tce.installed"
    echo -ne "\n\t${YELLOW}Startup directory permissions were corrected.${NORMAL}"
    DIRERROR=1
  fi

  if [ "$(stat -c'%U %G' ${SSDIR})" != "root staff" ]; then
    sudo chown root:staff "${SSDIR}"
    echo -ne "\n\t${YELLOW}Startup directory ownership was corrected.${NORMAL}"
    DIRERROR=1
  fi
 
  if [ ! "$(stat -c%a ${SSDIR}/$BASENAME)" = 755 ]; then
    sudo chmod 755 "${SSDIR}/$BASENAME"
    echo -ne "\n\t${YELLOW}Startup script permissions were corrected.${NORMAL}"
    DIRERROR=1
  fi

  if [ ! "$(stat -c'%U %G' ${SSDIR}/$BASENAME)" = "tc staff" ]; then
    sudo chown tc:staff "${SSDIR}/$BASENAME"
    echo -ne "\n\t${YELLOW}Startup script ownership was corrected.${NORMAL}"
    DIRERROR=1
  fi

  if [ $DIRERROR ]; then
    echo "$F" >> /tmp/submitqc/wrongstartscriptperms
    CHANGES=1
    echo
  else
    echo "${GREEN}Ok.${NORMAL}"
  fi

} # end checkstartup()

--- End code ---

"tce.installed" --> "drwxrwxr-x root:staff"
"start-up-script" --> "-rwxr-xr-x tc:staff"

 :o

I thought their owner should both be "root:staff"
with permission "775"
while every thing else as "root:root"

I'm confused.  :-\

P.S.
I'm on x86_64 and the submitqc.tcz.md5.txt look like this:
7b157080f71142c84a5faf2cc66b3308  submitqc.tcz

Most extensions on repo have this problem

Juanito:
Only the /usr/local/tce.installed folder needs to be root:staff - the files in the folder can be tc:staff

Misalf:
The  tce.installed  directory is used for two things: To indicate which extensions are loaded and to run an extension's startup script if present.

staff  needs write permission for the  tce.installed  directory so that there can be created (empty) files for extensions that don't come with a startup script.
The startup scripts are ran as root though. So I guess the startup scripts could be  root:root  but it's not that important?

Is this actually a problem or just a discontinuity?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version