Skip to content

Commit 2dddf92

Browse files
committed
Put programmable completion file to /etc/bash_comletion.d/
Also the fn remove_skyscraper() was present two times. Merged them together and added a prompt if skyscraper's cache should also be cleared.
1 parent 8d9b5af commit 2dddf92

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

scriptmodules/supplementary/skyscraper.sh

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,24 @@ function _config_files_skyscraper() {
7777
}
7878

7979
function remove_skyscraper() {
80+
local ret
81+
local msg
82+
83+
# Prompt for cache clearing
84+
msg="\nRemove also Skyscraper's cache data for all platforms:"
85+
msg+="\nvideos, screenshots, descriptions, ... ?"
86+
msg+="\n\nThis will only remove files in ~/.skyscraper/cache/."
87+
msg+="\n\nIf unsure select 'No'."
88+
dialog --clear --colors --defaultno --title "Remove Skyscraper" --yesno "$msg" 12 60 2>&1 >/dev/tty
89+
ret=$?
90+
91+
[[ $ret -eq 0 ]] && _purge_skyscraper
92+
93+
# Remove possible per-user deployment introduced with v3.9.3
8094
rm -f "$home/.bash_completion.d/Skyscraper.bash"
95+
96+
rm -f "/etc/bash_completion.d/Skyscraper.bash"
97+
rm -f "/usr/local/bin/Skyscraper"
8198
}
8299

83100
# Get the location of the cached resources folder. In v3+, this changed to 'cache'.
@@ -170,11 +187,6 @@ function _list_systems_skyscraper() {
170187
find -L "$romdir/" -mindepth 1 -maxdepth 1 -type d -not -empty | sort -u
171188
}
172189

173-
function remove_skyscraper() {
174-
# On removal of the package, purge the cache
175-
_purge_skyscraper
176-
}
177-
178190
function configure_skyscraper() {
179191
if [[ "$md_mode" == "remove" ]]; then
180192
return
@@ -281,9 +293,12 @@ function _init_config_skyscraper() {
281293
cp -f "$md_inst/.pristine_cfgs/priorities.xml.example" "$scraper_conf_dir/cache"
282294

283295
# Deploy programmable completion script
284-
mkUserDir "$home/.bash_completion.d"
285-
cp -f "$md_inst/.pristine_cfgs/Skyscraper.bash" "$home/.bash_completion.d"
286-
chown $user:$user "$home/.bash_completion.d/Skyscraper.bash"
296+
cp -f "$md_inst/.pristine_cfgs/Skyscraper.bash" "/etc/bash_completion.d/"
297+
# Ease of use but also needed for proper completion
298+
ln -sf "$md_inst/Skyscraper" "/usr/local/bin/Skyscraper"
299+
300+
# Remove possible per-user deployment introduced with v3.9.3
301+
rm -f "$home/.bash_completion.d/Skyscraper.bash"
287302
}
288303

289304
# Scrape one system, passed as parameter

0 commit comments

Comments
 (0)