Comment 15 for bug 1969353

Revision history for this message
Batwam (batwam) wrote :

the final "/main_dir" looks like a typo. also, the first cp would fail as $proxy_script already includes the full path. One problem I see is that, for me at least, the files in the proxifiedScripts folders have been stripped of their numbers ("10_linux" is called "linux" for instance). so before copying the file back, you would need to take the script name and strip the _proxy part to find the original name:

#!/bin/bash
main_dir=/etc/grub.d
orig_dir=$main_dir/proxifiedScripts
backup_dir=$main_dir/proxyscript_backup

mkdir -p $backup_dir
for script in $(ls $orig_dir); do
    # we're assuming there's only one proxy script for each proxied file
    proxy_script=$(ls ${main_dir}/*_"${script}"_proxy)
    new_script=$(echo "$proxy_script" | sed 's/_proxy//g')
    # back up the "proxy script"
    mv "$proxy_script" $backup_dir
    # overwrite it with the original shell script if it doesn't already exist
    if [ ! -f "$new_script" ]; then
       cp $orig_dir/"$script" "$new_script"
    else
        echo "file already exists"
    fi
done

Also, if 10_linux has been copied during the upgrade, chances are that the files in the proxy folder is an older version so I wouldn't really want the new files to be overwritten with the old ones so, a simple sudo rm /etc/grub.d/*_proxy works just as well for me to prevent the grub failure which I experienced post upgrade. People can always fire up grub-customizer again and regenerate the files if needed.

Alternatively, could it be as simple as copying /etc/grub.d/bin/grubcfg_proxy as part of the package install/update?