คำนำ
snap try
วิธีหนึ่งที่จะไปเกี่ยวกับเรื่องนี้คือการใช้ จาก--help
ข้อความ:
The try command installs an unpacked snap into the system for testing
purposes. The unpacked snap content continues to be used even after
installation, so non-metadata changes there go live instantly. Metadata
changes such as those performed in snap.yaml will require reinstallation
to go live.
นอกจากนี้ยังมาพร้อมกับตัวเลือก:
--devmode Install in development mode and disable confinement
สิ่งนี้มีประโยชน์อย่างยิ่งหากคุณต้องการทดสอบการ จำกัด บิตและการใช้อินเทอร์เฟซที่ถูกต้อง
การใช้
วิธีใช้งานนี้ง่ายเพียงแค่เรียกใช้:
snapcraft prime
snap try prime/
ในขั้นตอนแรกคุณบอกsnapcraft
ให้ทำ
Final copy and preparation for the snap.
และในขั้นตอนที่สองsnapd
ทำให้การใช้เนื้อหาของไดเรกทอรีเพื่อ "ติดตั้ง" snap ตอนนี้คุณสามารถเล่นกับแพ็คเกจได้ในขณะที่ยังสามารถทำการเปลี่ยนแปลงได้
ตัวอย่าง
ลองใช้ตัวอย่างจากSnappy Playpenเพื่อแสดงวิธีใช้สิ่งนี้
เราใช้กงสุลเนื่องจากค่อนข้างรวดเร็วในการสร้างและใช้:
$ git clone https://github.com/ubuntu/snappy-playpen
$ cd snappy-playpen/consul/
snappy-playpen/consul$ snapcraft prime
Preparing to pull consul
[...]
Staging consul
Priming consul
snappy-playpen/consul$
ตอนนี้ขอให้แน่ใจว่าเราไม่ได้ติดตั้งรุ่นอื่นแล้วดำเนินการติดตั้ง
snappy-playpen/consul$ which consul
snappy-playpen/consul$ snap try prime
Name Version Rev Developer Notes
consul 0.6.4 x1 try
snappy-playpen/consul$ consul --help
usage: consul [--version] [--help] <command> [<args>]
Available commands are:
agent Runs a Consul agent
[...]
snappy-playpen/consul$
จนถึงตอนนี้ดีมาก ดูเหมือนว่าจะทำงานได้ดี ตอนนี้เรามาแทนที่ด้วย/bin/echo
เพื่อดูว่าสิ่งต่าง ๆ ทำงานอย่างไร:
snappy-playpen/consul$ cp /bin/echo prime/bin/consul
snappy-playpen/consul$ consul --help
Usage: /snap/consul/x1/bin/consul [SHORT-OPTION]... [STRING]...
or: /snap/consul/x1/bin/consul LONG-OPTION
Echo the STRING(s) to standard output.
[...]
daniel@daydream:/tmp/test/snappy-playpen/consul$
อย่างที่คุณเห็นเราสามารถทำการเปลี่ยนแปลงกับระบบถ่ายทอดสดในprime
ขณะที่ยังคงทำงานภายใต้การคุมขัง โดยทั่วไปนี่เป็นวิธีที่ดีในการเริ่มต้นและเรียกใช้และทดสอบอย่างรวดเร็ว
หมายเหตุ:ด้วยsnapd
ก่อนที่ 2.0.10 (2016/07/09) คุณต้อง temove พริบตาก่อนที่จะใช้snapcraft clean
หรือsnapd
จะได้รับอยู่ในสภาพที่ไม่ดีและสะอื้นเกี่ยวกับการไม่สามารถที่จะหาติดยึด มีการแก้ไขเพิ่มเติมบางอย่างสำหรับ 2.0.11 ซึ่งควรลงจอดในสองสามวันเช่นกัน
snapcraft clean
หรือ snapd อยู่ในสถานะไม่ดีและเสียงหอนเกี่ยวกับการไม่สามารถค้นหา snaps ที่เมาท์ได้ การแก้ไขอยู่ในระหว่างดำเนินการ แต่ยังไม่ได้เผยแพร่