Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [Nextcloud] Nextcloud-ocr.sh gets deleted on startup #1682

Open
tsvi opened this issue Dec 27, 2024 · 5 comments
Open

🐛 [Nextcloud] Nextcloud-ocr.sh gets deleted on startup #1682

tsvi opened this issue Dec 27, 2024 · 5 comments
Labels
bug Something isn't working stale Element will be closed automatically

Comments

@tsvi
Copy link

tsvi commented Dec 27, 2024

Description

Whenever starting up I get a message that the auto script cannot be run. I thought it was a fluke, but then when recreating it, I saw it was deleted by the addon.

Reproduction steps

1. create auto script file
2. Restart the addon
3. Auto script has been deleted and addon does not run it
4. See error in logs

Addon Logs

�[32m Provided by: https://github.com/alexbelgium/hassio-addons �[0m
�[34m-----------------------------------------------------------�[0m
�[32m Defining permissions for main user : �[0m
�[34mUser UID: 1000�[0m
�[34mUser GID : 1000�[0m
�[34m-----------------------------------------------------------�[0m
/etc/cont-init.d/00-global_var.sh: executing
�[34mFull_Text_Search='true'�[0m
�[34mOCR='true'�[0m
�[34mOCRLANG='eng,heb'�[0m
�[34mPGID='1000'�[0m
�[34mPUID='1000'�[0m
�[34madditional_apps='inotify-tools'�[0m
�[34mcertfile='fullchain.pem'�[0m
�[34mdefault_phone_region='**'�[0m
�[34melasticsearch_server='<ip:port>'�[0m
�[34menable_thumbnails='true'�[0m
�[34mkeyfile='privkey.pem'�[0m
�[34mtrusted_domains='****'�[0m
�[34muse_own_certs='false'�[0m
/etc/cont-init.d/00-local_mounts.sh: executing
/etc/cont-init.d/00-migrate_files.sh: executing
/etc/cont-init.d/00-smb_mounts.sh: executing
/etc/cont-init.d/01-config_yaml.sh: executing
Setting permissions for the config.yaml directory

�[32mLoad environment variables from /config/config.yaml if existing�[0m
�[32mIf accessing the file with filebrowser it should be mapped to /addon_configs/db21ed7f_nextcloud-ocr/config.yaml�[0m
�[32m---------------------------------------------------------�[0m
�[32mWiki here on how to use : github.com/alexbelgium/hassio-addons/wiki/Add‐ons-feature-:-add-env-variables�[0m

�[32m... no env variables found, exiting�[0m
/etc/cont-init.d/01-custom_script.sh: executing
�[32mExecute /addon_configs/db21ed7f_nextcloud-ocr/nextcloud-ocr.sh if existing�[0m
�[32mWiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation�[0m
�[32m... script found, executing�[0m
cp: cannot stat '/config/addons_autoscripts/nextcloud-ocr.sh': No such file or directory
Scanning files
Could not open input file: /app/www/public/occ
�[0;31mError�[0m : /etc/cont-init.d/01-custom_script.sh exiting 1
/etc/cont-init.d/01-folders.sh: executing
�[32mSetting user to 1000:1000�[0m

Architecture

No response

OS

HAos

@tsvi tsvi added the bug Something isn't working label Dec 27, 2024
@tsvi
Copy link
Author

tsvi commented Dec 27, 2024

Ok, I managed to discover that the file has been migrated to /addon_configs/, so I tried editing the script to copy itself from there to the scripts directory as in the original example, but that fails as well:

cp: cannot stat '/addon_configs/db21ed7f_nextcloud_ocr/nextcloud-ocr.sh': No such file or directory
Add missing indices to database
Could not open input file: /app/www/public/occ

If I understand correctly, the idea here is if occ is not found copy myself into the scripts directory, otherwise run my contents. So I'm unable to update the contents of the file copied during the container start as it's unable to see the file that's running?

@tsvi
Copy link
Author

tsvi commented Dec 27, 2024

I managed fixing it by using:

full_path=`realpath $BASH_SOURCE`
cp $full_path /scripts/

In any case the readme has to be fixed

@alexbelgium
Copy link
Owner

Thanks! I'll have a look

@alexbelgium
Copy link
Owner

That's actually because HA changed how it handles config mapping. In the current situation, the nextcloud-ocr.sh file is located in /config from within the container, but accessible in /addon_configs/db21ed7f_nextcloud-ocr from within file editors in HA. The startup log correctly refers the right location, but indeed I need to change the readme.

However, it should have still executed - I haven't looked at this code in a long time I'll try to find something more resilient

alexbelgium added a commit that referenced this issue Dec 28, 2024
alexbelgium added a commit that referenced this issue Dec 28, 2024
alexbelgium added a commit that referenced this issue Dec 28, 2024
alexbelgium added a commit that referenced this issue Dec 28, 2024
Copy link
Contributor

github-actions bot commented Jan 5, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Element will be closed automatically label Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale Element will be closed automatically
Projects
None yet
Development

No branches or pull requests

2 participants