SRCDS Steam group


Poll: Was this Thred/Script helpfull?
Yes
No
I have a better way (please post in thred)
[Show Results]
 
 
Soulved Error "Failed to load $include VMT file ...."
#1
Exclamation 
Hey I was struggling with the error :

Quote:Failed to load $include VMT file (materials/METAL/METALCHROME001.vmt)
Failed to load $include VMT file (materials/METAL/METALCHROME001.vmt)
Failed to load $include VMT file (materials/METAL/METALCHROME001.vmt)
......

This is due to Linux bing case sensitive, meaning that the file "somename.vmt" that we get from the "./steam -command update ..." command is not the same as the file "SOMENAME.vmt" which is what srcds server is looking for.

Now maybe it would be enough to rename the folders in the materials folders to uppercase, this would be manageable. However if all the sub-folders and files would have to be renamed as well this would be a big ass pain to do by hand so I offer my solution a script I wrote.

I chose to have the script make symbolic links to the original files and folders so that it would not use too much space copying the files, and so updating the server would not download new files with the lowercase names in case it would do that, and if the original files were now to updated the new uppercase "files" also will be updated.

I'm sure its poorly coded and could be better in a lot of ways, but it works and thats enough. So here is how to use it:

*Download (or copy/paste into a file) from one of the following sources.
-http://frag.mine.nu/files/SrcDS-linker.sh
Not sure if I will keep this up so upload and redistribute the file as much as you want
and paste links here incase the pastebin version goes down.
-Pastebin: SrcDS-linker.sh
-Attached file.
.zip   SrcDS-linker.zip (Size: 1.54 KB / Downloads: 81)
-I will also post the script at the bottom of this post.

*Put the script in your "<serverdir>\hl2\materials", move to that folder
Code:
cd <serverdir>\hl2\materials
and run it using
Code:
sh SrcDS-linker.sh
or possably
Code:
./SrcDS-linker.sh
and follow the instructions given by the script.

*Put the script in your "<serverdir>\orangebox\cstrike\materials", move to that folder
Code:
cd <serverdir>\orangebox\cstrike\materials
and run it using
Code:
sh SrcDS-linker.sh
or possably
Code:
./SrcDS-linker.sh
and follow the instructions given by the script.

That should do it, no more annoying errors on the missing materials.


Script:
Code:
#!/bin/bash
LOGDIR="${HOME}/SrcDS_Ln_Log";
while getopts "d:" optname
do
    case "$optname" in
        "d")
            LOGDIR="$OPTARG";
        ;;
        "?")
            echo "Unknown option $OPTARG";
        ;;
    esac
done
LOGFILE="${LOGDIR}/SrcDS_Linker_$(date +"%F")-$(date +"%T").log";
args=("$@");
nr=$#-1;
MAKE=${args[$nr]};
if [ ! -d "$LOGDIR" ]; then
    mkdir -p $LOGDIR;
fi

echo "Logfile:  ${LOGFILE}";
echo "===LOG START===" >> $LOGFILE;
self=`basename "$0"`;
case $MAKE in
    "create")
        find ./* |while read FILENAME
        do
            i=${FILENAME};
            o=`echo ${i}|rev`;
            l=`echo ${o%.}|rev`;
            j=`echo ${l}|rev`;
            k=`echo ${j%.*}|rev`;
            c=`basename "$l"`;            
            case $l in
            "/$self")
                                echo -e '\E[32;40m'"Omitting $self";tput sgr0;
                echo "Omitting $self" >> $LOGFILE;
                        ;;
            *.*)
                #Commented out for a little lett console print, will still be logged.
                #echo "Make Symlink from FILE- $i ---> .$(echo ${l%.*} | tr [:lower:] [:upper:]).$k";
                ln -s "./$c" ".$(echo ${l%.*} | tr [:lower:] [:upper:]).$k";
                echo "./$c .$(echo ${l%.*} | tr [:lower:] [:upper:]).$k" >> $LOGFILE;
            ;;
            *)
                echo -e 'Make Symlink from \E[34m\E[34mDIR--'`tput sgr0` "$i ---> .`echo "$l" | tr [:lower:] [:upper:]`";
                ln -s "./$c" "`echo .$l | tr [:lower:] [:upper:]`";
                echo "./$c `echo .$l | tr [:lower:] [:upper:]`" >> $LOGFILE;
            ;;
            esac
        
        done
        echo "===LOG END===" >> $LOGFILE;
    ;;
    "test")
        echo "Test Run!!!!!!" >> $LOGFILE;
        find ./* |while read FILENAME
            do
            i=${FILENAME};
            o=`echo ${i}|rev`;
                    l=`echo ${o%.}|rev`;
            j=`echo ${l}|rev`;
                    k=`echo ${j%.*}|rev`;
                    c=`basename "$l"`;
                    case $l in
                    "/$self")
                                echo -e '\E[32;40m'"Omitting $self";tput sgr0;
                                echo "Omitting $self" >> $LOGFILE;
                        ;;

                *.*)
                                echo "FILE- $i" ".$(echo ${l%.*} | tr [:lower:] [:upper:]).$k";
                    echo "./$c .$(echo ${l%.*} | tr [:lower:] [:upper:]).$k" >> $LOGFILE;
                    
                ;;
                *)
                                echo -e  '\E[34m\E[34mDIR--'`tput sgr0` "$i .`echo "$l" | tr [:lower:] [:upper:]`";
                    echo "./$c $(echo .$l | tr [:lower:] [:upper:])" >> $LOGFILE;
                        ;;
                    esac
            done
        echo "===LOG END===" >> $LOGFILE;
    ;;
    *)
        echo -e "\v";
        echo '*******************************************************************************​*********'
        echo "Usage: ./`basename "$0"` create|test [-d FILE]";
        echo -e "\n\n\"create\" starts the creation of symbolic links in current directory.";
        echo "It will go into subfolders and continue there until all subdirectories are included";
        echo -e "Do no use create without testing first.\v";
        echo "\"test\" will list all the files and folders that will be linked";
        echo "it will show the TARGET and LINK names and placement.";
        echo "Recomended to use before using the create function.";
        echo "Also recomended to read the log output of this before";
        echo -e "using the create function\v\v";
        echo "This is ment for usage with the GNU/Linux and Src Dedicated Server";
        echo "\"Failed to load \$include\" problem. This problem is caused due";
        echo "to Linux being case sensitive and the server looking for files and";
        echo "folders that are in UPPERCASE letters tho they have been downloaded";
        echo "and named in lowercase letters. This means they are not the same files";
        echo -e "as the ones being looked for.\n\n";
        echo "This little script is ment to correct this by making";
        echo "symbolic links with the right name to the oridginale file.";
        echo -e "\n\t*******************************************************************";
        echo -e "\t| Log files will be created in the directory:";
        echo -e "\t| $LOGDIR";
        echo -e "\t| The file will be saved as";
        echo -e "\t| $LOGFILE";
        echo -e "\t| To change this use the \"-d /path/to/logdir\" option.\n\t|";
        echo -e "\t| Make sure you have "'\E[32mwrite permissions' `tput sgr0` "for this folder and file";
        echo '*******************************************************************************​*********'
    ;;
esac
exit 0;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)