Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F154138329
D23617.id74732.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D23617.id74732.diff
View Options
Index: Keywords/sample.ucl
===================================================================
--- Keywords/sample.ucl
+++ Keywords/sample.ucl
@@ -20,42 +20,29 @@
actions: [file(1)]
arguments: true
-post-install: <<EOD
- case "%1" in
- /*) sample_file="%1" ;;
- *) sample_file="%D/%1" ;;
- esac
- target_file="${sample_file%.sample}"
- set -- %@
- if [ $# -eq 2 ]; then
- target_file=${2}
- fi
- case "${target_file}" in
- /*) target_file="${target_file}" ;;
- *) target_file="%D/${target_file}" ;;
- esac
- if ! [ -f "${target_file}" ]; then
- /bin/cp -p "${sample_file}" "${target_file}"
- fi
-EOD
-pre-deinstall: <<EOD
- case "%1" in
- /*) sample_file="%1" ;;
- *) sample_file="%D/%1" ;;
- esac
- target_file="${sample_file%.sample}"
- set -- %@
- if [ $# -eq 2 ]; then
- set -- %@
- target_file=${2}
- fi
- case "${target_file}" in
- /*) target_file="${target_file}" ;;
- *) target_file="%D/${target_file}" ;;
- esac
- if cmp -s "${target_file}" "${sample_file}"; then
- rm -f "${target_file}"
- elif [ -e "${target_file}" ] ; then
- echo "You may need to manually remove ${target_file} if it is no longer needed."
- fi
-EOD
+post-install-lua: <<EOS
+sample_file = pkg.prefixed_path("%1")
+if "%#" == 2 then
+ target_file = pkg.prefixed_path("%1")
+else
+ target_file = string.gsub(sample_file,'%.sample$', "")
+end
+if not pkg.stat(target_file) then
+ pkg.copy(sample_file, target_file)
+end
+EOS
+
+pre-deinstall-lua: <<EOS
+sample_file = pkg.prefixed_path("%1")
+if "%#" == 2 then
+ target_file = pkg.prefixed_path("%1")
+else
+ target_file = string.gsub(sample_file,'%.sample$', "")
+end
+if pkg.filecmp(sample_file, target_file) == 0 then
+ os.remove(target_file)
+else
+ pkg.print_msg("You may need to manually remove " .. target_file .. " if it is no longer needed.")
+end
+
+EOS
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 27, 12:08 PM (6 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32225263
Default Alt Text
D23617.id74732.diff (1 KB)
Attached To
Mode
D23617: Lua version of the @sample
Attached
Detach File
Event Timeline
Log In to Comment