ãã®èšäºã«ã¯äžå¿ èŠãªãæäœæ¥ãã¯ãããŸãããããã±ãŒãžåœ¢åŒã¯ããªãåçŽã§ãæãéèŠãªè«çæ§é ã«é²åããŠããããã¹ãŠãæåéãã²ããŸãããŠãããã€ãã®ç¹æ®ãªãŠãŒãã£ãªãã£ã䜿çšããŠããŸãã
ããŒãã¹ãšããŠãèšäºã®æåŸã«ãç¬èªã®ããŒã«ã«ãªããžããªããã°ããäœæããäŸããããŸãããªããžããªããããã±ãŒãžãã€ã³ã¹ããŒã«ãããšãäŸåé¢ä¿ãèªåçã«è¿œè·¡ã§ããŸãã -è€æ°ã®ãã·ã³ã«1ã€ã®ã³ã³ãœãŒã«ã³ãã³ãã§ãã¹ãŠãã€ã³ã¹ããŒã«ããŸã:)
匷åãªLinuxãœãããŠã§ã¢ã®ã€ã³ã¹ããŒã«ã·ã¹ãã ã䜿ããããªãå Žåã¯ãCheckInstallããã°ã©ã ã®Webãµã€ãã«ã¢ã¯ã»ã¹ããããšããå§ãããŸãããmake installãã³ãã³ãããdebããã±ãŒãžãèªåçã«äœæããŸããïŒ
ãœãŒã¹
å€ãã®å Žæããã®ããã£ã«ã¬ã³ã®æ å ±ã§ãããäž»ã«æ¬¡ã®2ã€ããããŸãã
- OpennetïŒL GNU Debian / Linuxãã£ã¹ããªãã¥ãŒã·ã§ã³çšã®ããã±ãŒãžäœæã®æŠèŠ
- Debian.orgïŒDebian ããªã·ãŒããã¥ã¢ã« -å ¬åŒ
- Ubuntu WikiïŒ PackagingGuide /ããŒã·ãã¯
ãã®èšäºã§ã¯ãéåžžã«åŒ·åãªã¢ããªã±ãŒã·ã§ã³ã®ã€ã³ã¹ããŒã«å¶åŸ¡ãåŸãã®ã«ååãªããã±ãŒãžãäœæããåºæ¬ã«ã€ããŠè©³ãã説æããŠããŸãã ããé«åºŠãªæ©èœã¯çç¥ãããŠããŸãããé¢å¿ã®ãã人åãã®ããã¥ã¡ã³ããžã®çŽæ¥ãªã³ã¯ãæäŸãããŠããŸãã
ãã®èšäºã¯ãããã¥ã¡ã³ãã®ã³ããŒã翻蚳ã§ã¯ãããŸãããã¡ã¢ã®åœ¢åŒã®ç¥èã®éãŸãã§ãããçŸåšã¯èšäºã®åœ¢åŒã§çºè¡ãããŠããŸãã æ確ã«ããããã«ãè³ãæã«äŸãæã®èª¬æãèŠã€ãã䟿å©ãªæ©èœãããã³ç¡ç¥ããçããå¯èœæ§ã®ããããã€ãã®å žåçãªééãããããŸãã
æºåãã
ãªãããã ããªã®ã§ããïŒ
ã¯ããCheckInstallã¯äœæ¥ããã±ãŒãžãäœæã§ããŸãããdebããã±ãŒãžã§å¯èœãªãã¹ãŠã®æ©èœããµããŒãããŠããããã§ã¯ãããŸãã:) :)ã€ãŸãïŒ
- ããã±ãŒãž
ãã€ã³ã¹ããŒã«ããåãåŸãããã³ã€ã³ã¹ããŒã«ãã代ããã«å®è¡ããã¹ã¯ãªãã:) - èªåæ§æãã¡ã€ã«ç®¡çïŒããã±ãŒãžã¯ãå€ãæ§æãæ°ããæ§æã§äžæžãããããšãèš±å¯ããŸãã
- ãã³ãã¬ãŒãã®äœ¿çšïŒã€ã³ã¹ããŒã«äžã«ãŠãŒã¶ãŒã«è³ªåããæ©èœïŒ!!!ïŒ
- ä»ã®ããã±ãŒãžãã¡ã€ã«ãå€æŽãã
å¿ èŠãªãã®
ãã¡ãããtarãgzãarã¢ãŒã«ã€ãã¯å®å šãªããã±ãŒãžãäœæããã®ã«ååã§ãããäžèŠãªå€§éšããæé€ããäœæããããŒã«ã䜿çšããŠç掻ã楜ã«ããããšãã§ããŸã:)
ç§ãã¡ã¯çœ®ããŸãïŒ
$ sudo apt-get install dpkg debconf debhelper lintian
ç§ãã¡ã¯äœãããŸãã
ããšãã°ãç¹å®ã®ã¹ã¯ãªãã/usr/bin/super.shãèæ ®ãããŸãã äžèº«ã¯é¢ä¿ãããŸãããäž»ãªããšã¯ãæ£ããå Žæã«ã©ã®ããã«è¡šç€ºããããã§ã:)
ãã©ã«ããŒã®æºå
ããŒã ãã£ã¬ã¯ããªïŒãŸãã¯éœåã®è¯ãå ŽæïŒã«ãæªæ¥ã®ããã±ãŒãžã®ãã¹ãŠã®ãã¡ã€ã«ã眮ããããã©ã«ããŒãäœæããŸãïŒ
mkdir ~/supersh
ã 次ã«ã ããã±ãŒãžã®ã«ãŒããåŒã³åºããŸã ã
ããã±ãŒãžã®ã«ãŒãã«ãDEBIANããã©ã«ããŒãäœæããŸãïŒå€§æåã§ãããã¯éèŠã§ãïŒïŒã ãã®ãã©ã«ããŒã«ã¯ãããã±ãŒãžã®çæãå¶åŸ¡ããæ å ±ãå«ãŸããŠãããããã±ãŒãžã®ã€ã³ã¹ããŒã«æã«ãã£ã¹ã¯ã«ã³ããŒãããŸããã
ãŸããããã±ãŒãžã«ãŒããã©ã«ããŒã«ã¯å°æ¥ã®ããã£ã¹ã¯ã«ãŒãããå«ãŸããŸããããã±ãŒãžãã€ã³ã¹ããŒã«ãããšããã¹ãŠã®ãã¡ã€ã«ïŒãdebianããã©ã«ããŒãé€ãïŒã/ã«ãŒãã«è§£åãããŸãã ãããã£ãŠãã¹ã¯ãªããã¯ãããã±ãŒãžã®ã«ãŒããåºæºã«ããŠæ¬¡ã®ããã«é 眮ããå¿ èŠããããŸãïŒ "usr / bin / super.sh"
é»å°ã«çœïŒ
mkdir -p ~/supersh/DEBIAN #
mkdir -p ~/supersh/usr/bin #
cp super.sh ~/supersh/usr/bin/ #
ãã®çµæã次ã®ããšãã§ããŸãã
supersh/DEBIAN/
supersh/usr/
supersh/usr/bin/
supersh/usr/bin/super.sh
ããã±ãŒãžã®äœæïŒDEBIAN / *
åè¿°ããããã«ãDEBIANãã©ã«ããŒã«ã¯ã€ã³ã¹ããŒã«äžã«äœ¿çšããããã¡ã€ã«ãå«ãŸããŠããŸãã ããã§ã¯ãåãã¡ã€ã«ã«ã€ããŠïŒäŸã䜿çšããŠïŒèª¬æããŸãã
æ¬æ Œçãªããã±ãŒãžãäœæããã«ã¯ãå¶åŸ¡ãã¡ã€ã«ãcontrolãã§ååã§ããæ®ãã¯ãã¹ãŠãããã¹ãæ å ±ïŒå€æŽãã°ãã©ã€ã»ã³ã¹ïŒã®æ·»ä»ããŸãã¯ã¢ããªã±ãŒã·ã§ã³ã®é«åºŠãªã€ã³ã¹ããŒã«æ©èœã®å¶åŸ¡ã«äœ¿çšãããŸãã
DEBIAN / *ãã©ã«ããŒã«ãã以äžã®ãã¡ã€ã«ããå¿ èŠãªãã®ãéžæããæ瀺ã«åŸã£ãŠå ¥åããŠãã ãã:)
ãã®äŸã§ã¯ã å¿ é ã®DEBIAN /ã³ã³ãããŒã«ã®ã¿ãå®éã«äœ¿çšãããŸãã
ããã¢ã³/ã³ã³ãããŒã«ïŒåºæ¬æ å ±
ã³ã³ãããŒã«ã¯ããã¹ãŠã®åºæ¬çãªããããã£ãèšè¿°ããããã±ãŒãžã®äžå¿çãªãã¡ã€ã«ã§ãã ãã¡ã€ã«ã¯ããå±æ§ïŒå€ãã®ãã¢ã§æ§æãããããã¹ããã¡ã€ã«ã§ãã ã³ã¡ã³ãã䜿çšã§ããŸããè¡ã®å é ã«ãããïŒãæåïŒãã®æ©èœã¯dpkg> = 1.10.11ã§è¿œå ãããŸãããã³ã¡ã³ãã«äŸåããªãã§ãã ãã:)ã
è¡šã«ã¯ãå¶åŸ¡ãã¡ã€ã«ã«å®çŸ©ãããŠãããã¹ãŠã®ãã£ãŒã«ãã衚瀺ãããŸãã å¿ é ãã£ãŒã«ãã¯å€ªåã§ããŒã¯ãããŠããŸã ããããããªããšãããã±ãŒãžã¯æ£ããæ§æãããŠãããšèŠãªãããŸããã
ã¯ãããããã¯å¶åŸ¡ãã¡ã€ã«ã®å å®ãªæ©èœã§ã:)
ãã®äŸã§ã¯ã次ã®ããã«ãªããŸãã
Package: supersh
Version: 1.0-1
Section: misc
Architecture: all
Depends: bash, sed (>= 3.02-8)
Maintainer: o_O Tync <oo-tync.habrahabr.ru>
Description: Super Shell Script
â£A super example script.
â£.
â£It does nothing :)
ããã¢ã³/èäœæš©ïŒÂ©/ã©ã€ã»ã³ã¹
ã©ã€ã»ã³ã¹ã®ããã¹ãã ãã¡ã€ã«ã¯ãªãã·ã§ã³ã§ãããäœæè ã匷調ããããšããå§ãããŸã;ïŒ
DEBIAN / changelogïŒå€æŽå±¥æŽ
ç¹å¥ãªåœ¢åŒã®å€æŽãã°ïŒdpkgãããã±ãŒãžã®ããŒãžã§ã³çªå·ããªããžã§ã³ãé åžãéèŠåºŠãååŸããããã«äœ¿çšããŸãã å ¬åŒããã¥ã¡ã³ããåç §ããããšããå§ãããŸã;ïŒãããŠãäŸãæããŸãã
supersh (1.0-1) stable; urgency=medium
* Testing.
-- o_O Tync <oo-tync.habrahabr.ru> Sun, 13 Dec 2009 00:11:46 +0300
DEBIAN /ã«ãŒã«ïŒã³ã³ãã€ã«ã«ãŒã«
ããã±ãŒãžã®ã³ã³ãã€ã«ãå¶åŸ¡ããããã«äœ¿çšïŒããã¯
Architeture: source
:)ã®å Žåã§ã
å ¬åŒããã¥ã¡ã³ããåç §
DEBIAN / conffilesïŒæ§æãã¡ã€ã«ã®ãªã¹ã
éåžžãããã±ãŒãžã«ã¯ã/ãªã©ã§ãã¹ããããŠããæ§æãã¡ã€ã«ã®ç©ºçœãå«ãŸããŠããŸãã æããã«ãããã±ãŒãžå ã®æ§æãæŽæ°ããããšããŠãŒã¶ãŒã¯ç·šéããæ§æã倱ããŸãã ãã®åé¡ã¯ããconfig.dãã¿ã€ãã®ãã©ã«ããŒã䜿çšããŠç°¡åã«è§£æ±ºã§ããŸãããã®å 容ã¯ã¡ã€ã³æ§æã«å«ãŸããéè€ãããªãã·ã§ã³ã眮ãæããŸãã
ãDEBIAN / conffilesããã¡ã€ã«ã䜿çšãããšãåé¡ãããŸããŸã«è§£æ±ºã§ããŸããæ§æãã¡ã€ã«ã®ãªã¹ããå«ãŸããŠããŸãïŒ1è¡ã«1ã€ïŒã ããã±ãŒãžã®çŸåšã®ããŒãžã§ã³ã§ãããã®ãã¡ã€ã«ã®ãããããæŽæ°ããããšããŠãŒã¶ãŒã¯æ§æã®ããŒãžã§ã³ã®ç«¶åã«é¢ããèŠåãåãåããåé€ã眮æããŸãã¯ããŒãžãéžæã§ããŸãã
æ§æãæãåLinuxoidã¯ãå¿ ããã®ç¶æ³ã«çŽé¢ããŸãã:)ãããŠãããããèã䌞ã³ãŠãããŸãã
åè¡ã«ã¯ãåæ§æãžã®å®å šãªçµ¶å¯Ÿãã¹ãå¿ èŠã§ãã äŸïŒ
/etc/supersh/init.conf
/etc/supersh/actions.conf
DEBIAN / dirsïŒäœæãããã©ã«ããŒã®ãªã¹ã
ãããã°ã©ã ã§å¿ èŠãšãããŠããããäœããã®çç±ã§äœæãããŠããªããã©ã«ããŒãžã®çµ¶å¯Ÿãã¹ã®ãªã¹ãããå ¬åŒããã¥ã¡ã³ããèªã¿ãŸãã å®éã«ã¯ãããã°ã©ã ã§äœ¿çšãããäœããã®æ¹æ³ã§ããã¹ãŠã®ãã©ã«ããŒãããã«ãªã¹ããããŸãããã€ããªãŒãã©ãã«ãããããã°ã©ã ã§äœ¿çšãããã®ãã
1è¡ã«1ã€ã äŸïŒ
/var/log/supersh
/var/lib/supersh
è€æ°ã®ç©ºã®ãã©ã«ããäœæããã®ã«äŸ¿å©ã§ãã
DEBIAN / menuïŒã¡ãã¥ãŒé ç®ã®äœæ
ã¡ãã¥ãŒé ç®ãäœæããããã®æ±ãã«ãããã¡ã€ã«ã ããã¯ç§ã«ãšã£ãŠã¯ããŸããããŸããã§ãã:)ãã®å 容ã¯çãããŠã£ã³ããŠãããŒãžã£ãŸãã¯äœããã®ã³ã³ãœãŒã«ã¡ãã¥ãŒã®ããããã§äœ¿çšãããŠãããã®ããã«æããŸã...ãŸãã¯ä»¥åã«äœ¿çšããå¿ããããŠããŸãã:)
äŸïŒ
?package(supersh):needs="text" section="Applications/Programming" title="Super Shell Script" command="/usr/bin/super.sh"
TODOïŒçç±ãèŠã€ããŠãã ããã ããã¯
man5 menufile
æžãããŠ
man5 menufile
ãççŽã«èšã£ãŠç§ã¯æãäžããŸããã§ãã:)
UPDïŒã¡ãã¥ãŒé ç®ãè¿œå ããæ£ããæ¹æ³
ãã¡ã€ã«/ DEBIAN / menuãäœæãããã®ã¯äžæã§ãããã©ãã«ããã®ããæ確ã§ã¯ãããŸãããã°ã©ãã£ãã¯ã¡ãã¥ãŒã®èŠçŽ ã¯ãŸã äœæãããŠããŸããã ãããã£ãŠãç§ãã¡ã¯ãããæ£ããè¡ããŸã:)
/usr/share/applications
ã«ã¯ã
*.desktop
ãã¡ã€ã«ããããããããŸãããããã¯ã¡ãã¥ãŒé ç®ã§ãã ãããã¯ãiniãã¡ã€ã«ã®ãããªæ§æãæã€ããã¹ããã¡ã€ã«ã§ãã éããŠãå匷ããåãããšãããŠãçµæã®
*.desktop
ãã¡ã€ã«ã
usr/share/applications/
*.desktop
ãŸãã ãã®ã¢ã€ã³ã³ã¯
usr/share/pixmaps
ãŸãã
ãã®åŸã
update-menus
ã¡ãã¥ãŒ
update-menus
ã³ãã³ãã®å®è¡ãpostinstã¹ã¯ãªããã«è¿œå ããŸãã
if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ] ; then
update-menus
fi
ããã±ãŒãžã€ã³ã¹ããŒã«ã¹ã¯ãªããã®æäœã«ã€ããŠã¯ãåŸã§èª¬æããŸãã
ãã³ããããããšãã
DEBIAN / md5sumsïŒãã¡ã€ã«ã®ãã§ãã¯ãµã
ããã±ãŒãžã®æŽåæ§ãæ€èšŒããããã«äœ¿çšãããŸãã éèŠãªãã¡ã€ã«ã
ãã®ããã«å ¥åããŸãïŒcwd =ããã±ãŒãžã«ãŒãïŒïŒ
$ md5deep -r usr > DEBIAN/md5sums
DEBIAN / watchïŒããã°ã©ã ãããŠã³ããŒãããããµã€ããç£èŠããŸã
ãã®æ©èœã¯ãæ°åã®ããã±ãŒãžããã¡ã³ããã³ã¹ãè¡ãå Žåã«åœ¹ç«ã¡ããã¹ãŠã®æŽæ°ã远跡ããã®ã¯å°é£ã§ãã
ãã®ãã¡ã€ã«ã«ã¯ãuscanããã³uupdateããã°ã©ã ã®æé ãå«ãŸããŠããŸãã ãã®æ©äŒãå©çšããŠãããã±ãŒãžã®ãœãŒã¹ã³ãŒããåãåã£ããµã€ããç£èŠããé åžå šäœã®å質管çã確ä¿ã§ããŸãã
äŸïŒ
# Site Directory Pattern Version Script
ftp.obsession.se /gentoo gentoo-(.*)\.tar\.gz debian uupdate
uscanïŒ1ïŒã®å¥ã®äŸïŒ
version=3
madwimax.googlecode.com/files/madwimax-(.*)\.tar\.gz
å ¬åŒããã¥ã¡ã³ããããèªãã§ãã ããããã®ãããªåŒ·åãªãã®ã¯ãåãªã人éã§ã¯ãã£ãã«å¿ èŠãããŸãã:)
DEBIAN / cron.dïŒcronãžã§ãã®ã€ã³ã¹ããŒã«
ãã®ãã¡ã€ã«ã«ã¯ãã€ã³ã¹ããŒã«çšã®crontabããŒã¹ãå«ãŸããŠããŸãã äŸã§ãã¹ãŠã説æããŸãã
#
# Launches super.sh periodically
#
0 4 * * * root [ -x /usr/bin/super.sh ] && usr/bin/super.sh
DEBIAN / inid.dïŒinitã¹ã¯ãªãã
initã¹ã¯ãªããã®å 容ã¯ãã®ãã¡ã€ã«ã«æžã蟌ãŸããŸãã ã€ã³ã¿ãŒãããã§ã®initã¹ã¯ãªããã®èšè¿°ã«ã€ããŠã¯ã
ã¹ã¯ãªããã£ã³ã°
æãèå³æ·±ãã®ã¯ãã¹ã¯ãªãããdebããã±ãŒãžã«åã蟌ãããšã§ãã ã¹ã¯ãªããã䜿çšãããšããã¡ã€ã«ãæ£ããå Žæã«ã³ããŒããã ãã§ã¯å®è¡ã§ããªãã¢ã¯ã·ã§ã³ãå®è¡ããŠãããã±ãŒãžã®ã€ã³ã¹ããŒã«ãåã€ã³ã¹ããŒã«ãããã³åé€ãå¶åŸ¡ã§ããŸãã ããã«ã¯ãè¿œå ã®ãã¡ã€ã«ã®ããŠã³ããŒãïŒãã©ãã·ã¥ã€ã³ã¹ããŒã©ãŒãšåæ§ïŒãæ¢åã®ãã¡ã€ã«ã®å€æŽãããã³ãŠãŒã¶ãŒãããã±ãŒãžãèªåçšã«æ§æã§ãã察話åïŒGUIãŸãã¯ncursesïŒãã€ã¢ãã°ã衚瀺ããããšãã§ããŸããããšãã°ãmysqlã¯rootã«èšå®ãããã¹ã¯ãŒããå°ããŸãã
ãã¹ãŠã®ã¹ã¯ãªããã¯ã«ãŒããšããŠå®è¡ãããŸãïŒãã®ä»ã¯äœã§ããïŒã ãŸããã€ã³ã¹ããŒã«ã®å Žæãæå®ããåŒæ°ïŒåŠçããå¿ èŠã¯ãããŸããïŒãåãåããŸãã 詳现ã¯ãã¡ããã芧ãã ãã ã
DEBIAN /ïŒpreinst | postinst | prerm | postrmïŒïŒã€ã³ã¹ããŒã«ã¹ã¯ãªãã
åèšã§ã1ã€ã®ããã±ãŒãžã«æ倧4ã€ã®ã¹ã¯ãªãããäœæã§ããŸãã
ã¹ã¯ãªãã | äºå® |
---|---|
ããã¢ã³/ preinst | ããã±ãŒãžãã€ã³ã¹ããŒã«ããåã«å®è¡ãããŸãïŒã€ã³ã¹ããŒã«ãæåãããããã«äœããæºåã§ããŸã |
ããã¢ã³/ postinst | ããã±ãŒãžã®ã€ã³ã¹ããŒã«çŽåŸã«å®è¡ãããŸããã€ã³ã¹ããŒã«æžã¿ã®ããã±ãŒãžãæ§æããŠã䜿çšã§ããããã«ããŸãã ããã±ãŒãžãããã§ã€ã³ã¿ã©ã¯ãã£ãã«èšå®ãããŸãïŒããã¯dh_inputãšDEBIAN / templatesãã¡ã€ã«ã䜿çšããŠè¡ãããŸã |
ããã¢ã³/ prerm | ããã±ãŒãžãã¢ã³ã€ã³ã¹ããŒã«ãããçŽåã«å®è¡ãããŸããéåžžããã®ã¹ã¯ãªããã¯ããã±ãŒãžã®ã€ã³ã¹ããŒã«ãã¹ãã¯ãªãŒã³ã¢ãããããããäœãæ®ãããŸãã:) |
ããã¢ã³/ postrm | ããã±ãŒãžãåé€ãããçŽåŸã«å®è¡ãããŸãïŒæ®ããã¯ãªãŒã³ã¢ããããŸã |
ãããã®ã¹ã¯ãªããã§çºçãããšã©ãŒã¯æ±ºããŠãã°ã«èšé²ãããªãããšã«æ³šæããŠãã ãããã¹ã¯ãªããã®ãªã¿ãŒã³ã³ãŒããããèå³æ·±ããã®ã¯ã©ãã«ãä¿åãããããã°ã¯æåã§è¡ãå¿ èŠããããŸãã ç§ã®ããã±ãŒãžã®ããããã®ãŠãŒã¶ãŒãLinux Mintã«ã€ã³ã¹ããŒã«ã§ãããçç±ãææ¡ããããã«ãšã©ãŒãã°ïŒååšããªãïŒãèŠæ±ããããšããã§ããŸããã§ãã:)
åã¹ã¯ãªããã®åé ã§æ¬¡ã®ãã£ã¹ã¯ã䜿çšããããšããå§ãããŸããçºçãããã¹ãŠã®ãšã©ãŒãsyslogã«ä¿åããŸãã
#!/bin/bash
set -e # fail on any error
set -u # treat unset variables as errors
# ======[ Trap Errors ]======#
set -E # let shell functions inherit ERR trap
# Trap non-normal exit signals:
# 1/HUP, 2/INT, 3/QUIT, 15/TERM, ERR
trap err_handler 1 2 3 15 ERR
function err_handler {
local exit_status=${1:-$?}
logger -s -p "syslog.err" -t "ootync.deb" "supersh.deb script '$0' error code $exit_status (line $BASH_LINENO: '$BASH_COMMAND')"
exit $exit_status
}
... ...
exit 0
èŠåïŒãã£ã¹ã¯ã¯ãŸã ååã«ãã¹ããããŠããŸãããããäžåºŠç¢ºèªããŠãã ããã ç§ã¯æè¿ãããã°ã§ããªãããšã«ééããŸãã:)
DEBIAN /ãã³ãã¬ãŒãïŒãã€ã¢ãã°ãã³ãã¬ãŒã
ãã§ã«è¿°ã¹ãããã«ãDEBIAN / configã¹ã¯ãªããã§ã¯ããŠãŒã¶ãŒã«è³ªåãããããšãã§ããŸããè¡ãå ¥åãããªãã·ã§ã³ã®1ã€ãéžæãããã§ãã¯ããŒã¯ãä»ããŸã...ããã¯ãdebhelperããã±ãŒãždebconfã®bashé¢æ°ã®ãã©ã€ãã©ãªãã«ãã£ãŠè¡ãããŸãã ããã§ã¯èããŸããã
DEBIAN / templatesãã¡ã€ã«ã«ã¯ããã€ã¢ãã°ããã¯ã¹ïŒGUIãŸãã¯ncursesïŒã®è¡šç€ºã«äœ¿çšãããããŒã¿ãå«ãŸããŠããŸãã ãã¡ã€ã«ã«ã¯ã空ã®è¡ã§åºåããããããã¯ãå«ãŸããŠããŸãã åãããã¯ã¯ãç¹å®ã®ãã€ã¢ãã°ããã¯ã¹ã§äœ¿çšããããªãœãŒã¹ãå®çŸ©ããŸãã
ãã¹ãŠã®ã¿ã€ãã®ãã€ã¢ãã°ã®ããããŒã¯æšæºã§ãïŒ
Template: supersh/template-name
Type: string
Default: Default-value
Description: Dialog-title
â£Dialog-text
ãã³ãã¬ãŒã-ãã³ãã¬ãŒãã®äžæã®ïŒ1ã€ã®ããã±ãŒãžå ã®ïŒèå¥åã ã¹ã¯ãªããå ã§ç¹å®ã®ãã€ã¢ãã°ãåŒã³åºãå¿ èŠãããå Žåããã®ååã䜿çšãããŸãã
ã¿ã€ã-ãã³ãã¬ãŒãã®ã¿ã€ãã 次ã®ã¿ã€ããå®çŸ©ãããŠããŸãïŒæååããã¹ã¯ãŒããããŒã«å€ãéžæãè€æ°éžæãããã¹ããã¡ã¢ããšã©ãŒã
ããã©ã«ãå€-ããã©ã«ãå€ïŒãŠãŒã¶ãŒã¯åçŽã«åãå ¥ããããšãã§ããŸãã
説æ-å¶åŸ¡ãã¡ã€ã«ãšåæ§ã«ãçã説æãšé·ãããã¹ãã®2ã€ã®ãã£ãŒã«ãã§æ§æãããŸãã 1ã€ç®ã¯ããŠã£ã³ããŠãã®ã¿ã€ãã«ã2ã€ç®ã¯ãŠãŒã¶ãŒã«å¿ èŠãªå 容ã®ãã詳现ãªèª¬æã§ãã ãenterããªã©ã®åèªã䜿çšããããšã¯ãå§ãããŸããããããã«ãGreeting scriptãããMount pointããªã©ã®ãšãã»ã³ã¹ã䜿çšããããšããå§ãããŸãã
çš®é¡ | ãã³ãã¬ãŒãã®èª¬æ |
---|---|
ã²ã | ããã¹ãæååããã³ãã |
ãã¹ã¯ãŒã | ãã¹ã¯ãŒãããã³ããã
æãããªçç±ã«ããããã®ã¿ã€ãã®ãã³ãã¬ãŒãã«ã¯ããã©ã«ãå€ã¯ãããŸãã:) |
ããŒã«å€ | ãã§ãã¯ããŒã¯:)ãtrueããŸãã¯ãfalseãã®æååå€ããããŸã |
éžæãã | ããã€ãã®ãªãã·ã§ã³ã®ãããããéžæããæ©èœã
ãªãã·ã§ã³ã¯ããªãã·ã§ã³ã®ãã³ãã¬ãŒãå±æ§ã§æäŸãããŸãã Choices: yes, no, maybe
|
è€æ°éžæ | ãã§ãã¯ããŒã¯ãä»ããè€æ°ã®ãªãã·ã§ã³ãéžæããæ©èœã
ãªãã·ã§ã³ã¯ããªãã·ã§ã³ã®ãã³ãã¬ãŒãå±æ§ã§æäŸãããŸãã Choices: sex, drugs, rock-n-roll
|
ããã¹ã | ããã¹ãã衚瀺ããŸããããŸãéèŠã§ã¯ãªãæ å ±ããããŸã |
泚 | ããã¹ãã衚瀺ïŒéèŠãªæ å ± |
ãšã©ãŒ | éåžžã«éèŠãªæ å ±ãéèŠãªããã¹ãã衚瀺ããŸãã |
ããã¹ããã¡ã¢ããšã©ãŒãã³ãã¬ãŒãã«ã€ããŠã¯ãæ å ±ã®ã¿ã衚瀺ãããããããã©ã«ãå€ããããŸãã:)
次ã®ãã³ãã¬ãŒãã§éãã§ã¿ãŸãããã
Template: supersh/greeting
Type: string
Description: Welcome message
â£The message you wish the script to welcome you with.
Default: Greetings, my master!
debconfãšdebhelperã®äœ¿çšã®åºæ¬
ãããã¯å®è¡å¯èœãªãã©ããã§ãã ãã³ãã¬ãŒãã«ã€ããŠèªã¿ãå ã®ãã³ãã¬ãŒãã§äœæ¥ããããšãã§ããŸãïŒ
man 7 debconf-devel
:)
DEBIAN / configèšå®ã¹ã¯ãªããã§ãã³ãã¬ãŒãã䜿çšããã«ã¯ãæåã«debhelperæ©èœãæå¹ã«ããå¿ èŠããããŸãã
. /usr/share/debconf/confmodule
. /usr/share/debconf/confmodule
ãŸãããã®ãã¡ã€ã«ã¯postinstã¹ã¯ãªããã«å«ããå¿ èŠããããŸããããããªããšãDEBIAN / configã¹ã¯ãªããã¯ãŸã£ããå®è¡ãããŸããã
ãããã®æ©èœã¯debconfããã±ãŒãžã§å©çšå¯èœã§ããäŸåããããšãå¿ããã«æå¹ã«ããŠãã ããïŒ
ããªããã£ããŠãŒã¹ã±ãŒã¹ã DEBIAN /èšå®ãã¡ã€ã«
#!/bin/bash -e
# debconf
. /usr/share/debconf/confmodule
case "$1" in
configure|reconfigure)
#
db_input medium "supersh/greeting" || true #
db_go || true #
#
db_get "supersh/greeting" # $RET
greeting="$RET"
echo "$greeting" > /etc/supersh/greeting.txt
;;
*)
echo "config called with unknown argument \`$1'" >&2
exit 1
;;
esac
#
db_input medium "supersh/greeting" || true #
db_go || true #
#
db_get "supersh/greeting" # $RET
greeting="$RET"
echo "$greeting" > /etc/supersh/greeting.txt
ããã«ã¯ãã§ã«äžå¿«ãªåŸ ã¡äŒãããããŸãïŒdb_inputé¢æ°ã«ã¯äžçšåºŠã®ãã€ã¢ãã°ã®åªå 床ãäžããããŠããããšã«æ³šæããŠãã ããã debconfã§ã¯ãæå°åªå 床ãèšå®ã§ããŸããåªå 床ããã以äžã®ãã€ã¢ãã°ã¯è¡šç€ºãããŸããããããã©ã«ãå€ïŒããã©ã«ããã³ãã¬ãŒãïŒã䜿çšãããŸãïŒ ãããæ£ç¢ºã«è¡ãããªãããã«ããããã«ãéèŠãªåªå é äœã䜿çšããŸã:)ããã«ãGUIããã€ã³ã¹ããŒã«ããå Žåã質åãåºåããããã®ãããå€ãé«ããªãããããã®å€ãã¯ãŸã£ãã衚瀺ãããŸããã
å¯èœãªåªå é äœïŒäœ-ããã©ã«ããåžžã«äœ¿çšãããäž-ããã©ã«ãã¯éåžžéåžžã«é©åã§ãããé«-ããã©ã«ãã¯æãŸãããªããéèŠ-ãŠãŒã¶ãŒã®æ³šæãäžå¯æ¬ ã§ãã
|| true
|| true
ãbashã«æž¡ãããã-eãããŒãåå ã§ã¹ã¯ãªãããåæ¢ããã®ãé²ãããã«äœ¿çšãããŸãã
ãã®ã¹ã¯ãªããã§ã¯ããšã©ãŒããã£ããããããã«ãã®ãã£ã¹ã¯ã䜿çšããããšããå§ãããŸããããããªããšããããã°æã«åé åžå¯èœãªããã±ãŒãžã«åé¡ãããå¯èœæ§ããããŸã:)
debconfïŒé¢æ°ãã¡ãœããããã©ã¡ãŒã¿ãŒããšã©ãŒã³ãŒãïŒã䜿çšããããšã®ãã¹ãŠã®åŸ®åŠãªç¹ã¯ãããªãåé·ãªmanaã§èª¬æãããŠããŸãïŒ
man debconf-devel
ã
ãããŠæåŸïŒpurge-debconfã³ãã³ãã§ããã±ãŒãžãåé€ãããšããããŒã¿ããŒã¹ããããã±ãŒãžæ å ±ãã¯ãªãŒã³ã¢ããããå¿ èŠããããŸãã ããšãã°ãdb_inputãèŠæ±ãããšãã«ãŠãŒã¶ãŒã®éžæãä¿åããŸãã
ãã®ããŒã¿ãã¯ãªãŒã³ã¢ããããã«ã¯ã以äžãpostinstã¹ã¯ãªããã«è¿œå ããŸãã
if [ "$1" == "purge" ] && [ -e /usr/share/debconf/confmodule ] ; then
. /usr/share/debconf/confmodule
db_purge
fi
ããã±ãŒãžãåéããŸãïŒ :)
ãã£ãïŒ ãã¹ãŠã®å¿ èŠãªãã¡ã€ã«ãäœæãããå¿ èŠãªãã©ã«ããŒã«ãããŸãã ããã§ãããã±ãŒãžãåéã§ããŸã:)
æåã«è¡ãããšã¯ããŠãŒã¶ãŒããã±ãŒãžã®ã«ãŒããšã«ãŒãã°ã«ãŒãå ã®ãã¹ãŠã®ãã¡ã€ã«ãååž°çã«å ¬éããããšã§ãïŒrootïŒãŸãã¯å¿ èŠã«å¿ããŠä»ã®ïŒã ããã±ãŒãžãã¡ã€ã«ã¯ããã¡ã€ã«ã®ã¢ã¯ã»ã¹èš±å¯ãšææè ã®äž¡æ¹ãä¿åããtar.gzã¢ãŒã«ã€ãã«ããã±ãŒãžåãããŠããããããããå¿ èŠã§ãã ãããã£ãŠã次ãå®è¡ããå¿ èŠããããŸãã
$ sudo chown -R root:root .
ãã ããããã¯å¿ èŠãããŸããã ã¢ãŒã«ã€ããäœæãããšãã«ããã¡ã€ã«ã®ææè ãã«ãŒãã«çœ®ãæããåªããfakerootã³ãã³ãããããŸãã
ãã®äŸã§ã¯ãã¹ã¯ãªããã«å®è¡å¯èœæ§ããããå¿ èŠã§ãã
次ã«ããã©ã«ããŒã«æ»ããããã±ãŒãžã®ã«ãŒããã©ã«ããŒã衚瀺ãããããã«ããŸããããã±ãŒãžã¯ã
$ fakeroot dpkg-deb --build supersh
äœæãããããã±ãŒãžã¯ã* .debããã±ãŒãžã®åœåé åºãšäžèŽããããã«ååãå€æŽããå¿ èŠããããŸãã<package name> _ <version> _ <architecture> .deb
$ mv supersh.deb supersh_1.0-1_all.deb
ãã¹ãŠãããã±ãŒãžã®æºåãã§ããŸããïŒ
èªåããã±ãŒãžãã§ãã¯
ããã±ãŒãžããã§ãã¯ãããã®æ§é ã®å žåçãªãšã©ãŒãç¹å®ã§ããlintianãŠãŒãã£ãªãã£ããããŸãã ããã¯æ¬¡ã®ããã«è¡ãããŸãã
$ lintian supersh_1.0-1_all.deb
ããã±ãŒãžã®ã€ã³ã¹ããŒã«
$ sudo dpkg -i supersh_1.0-1_all.deb
ç¬èªã®ããã±ãŒãžãªããžããªãäœæãã
ããã§ç¬èªã®ããã±ãŒãžãã§ããŸããã ãããã®ããã€ãããããããã«äŸåé¢ä¿ãããå Žåã¯ãããŒã«ã«ã®ãã€ã¯ããªããžããªãããã«äžããŠããã±ãŒãžãããŒãžã£ãŒãœãŒã¹ã®ãªã¹ãã«å«ããæ¹ãã¯ããã«äŸ¿å©ã§ããããšãããããŸã:)ããã§ã¯ãç°¡åãªHowToãç¬èªã®ãªããžããªãäœæããæ¹æ³ãã«ã€ããŠèª¬æããŸãã é¢é£ããããã¥ã¡ã³ããèªãããšã§ãã¢ã€ãã¢ãç°¡åã«éçºã§ããŸã:)
æåã«ãã«ããŒãã€ã³ã¹ããŒã«ããŸãã
$ sudo apt-get install reprepro
å°æ¥ã®ãªããžããªã®èª¬æ
ãªããžããªã»ã³ã¿ãŒ-ãã®èª¬æã äž»ãªãã®ã¯ããªããžããªã³ã³ããŒãã³ãã®ãªã¹ãã§ãã ããœãããããã³ãã²ãŒã ãã³ã³ããŒãã³ããäœæããŸãã
å°æ¥ã®ãªããžããªçšã®ãã©ã«ããéžæããŸãã ãã¹ãŠã®ã¢ã¯ã·ã§ã³ã¯ãã®ã«ãŒãããå®è¡ãããŸãã
次ã®å 容ã®conf / distributionsãã¡ã€ã«ãäœæããŸãã
Description: my local repository
Origin: Ubuntu
Suite: testing
AlsoAcceptFor: unstable experimental
Codename: karmic
Version: 5.0
Architectures: i386 amd64 source
Components: soft games
UDebComponents: soft games
åçŽãªãªããžããªãäœæããããžãã¹ã§ã¯ããã¹ãŠã®ãã£ãŒã«ããåºæ¬çãªåœ¹å²ãæãããŠããããã§ã¯ãªãããäœãäœã§ãããããèŠèŠçã«å€æããããã«ã®ã¿äœ¿çšãããŸãã
ãªããžããªãäœæ
ãªããžããªã«ã€ããŠèª¬æããŸãïŒ æ¬¡ã«ã説æã«åºã¥ããŠç©ºçœãçæããŸãã ã³ãã³ãã¯ããªããžããªã®ã«ãŒãã§å®è¡ãããŸãã
$ reprepro export
$ reprepro createsymlinks
ãããŠãå®æãããªããžããªã/etc/apt/sources.listã«è¿œå ããŸãã
deb file:///path/to/repo/ karmic soft games
WebãµãŒããŒã䜿çšããŠãã®ãªããžããªãå ±æããããšãã§ããŸãã
ãªããžããªå ã®ããã±ãŒãžã管çãã
ãªããžããªã®ã«ãŒãã«ãè¿œå ãã* .debãã¡ã€ã«ãé 眮ããkarmicãã£ã¹ããªãã¥ãŒã·ã§ã³ã®ãœããã³ã³ããŒãã³ãã«è¿œå ããŸãã
reprepro -C soft includedeb karmic *.deb
ããã§ãããã±ãŒãžãããŒãžã£ãŒããããã±ãŒãžãå ¥æã§ããŸãã
ããã±ãŒãžã®åé€ïŒ
reprepro -C soft remove karmic supersh
ãã£ããã·ã¥ã©ã€ã³
ãã®èšäºã§ã¯ãdebããã±ãŒãžãäœæããããã®è³æã«ã€ããŠèª¬æããŸãããããã¯ãŒã¯ãååã«æ確ãªèª¬æãæã£ãŠããªãç¬éã«éç¹ã眮ãããŠããŸããç§ããããåçŽãã€æ確ã«è¿°ã¹ãè©Šã¿ã倱æããªãã£ãããšãé¡ã£ãŠããŸã:)
宿é¡:)ïŒã¯ã人ãèšäºã§èŠã€ããããéåžžã«ããææžåããããã®ã§ãïŒ
- ãœãŒã¹ã³ãŒããã³ã³ãã€ã«ãããœãŒã¹ããã±ãŒãžã®äœæïŒZabbixã®äŸã§ãmahoro habrayuzerã¯åœŒã®èšäºã§ããã«ã€ããŠå®å šã«èªã£ãŠããŸã
- debconfãèšå®ã¹ã¯ãªããå ã®debhelperïŒdebconf-develãšdebhelperã«ãããããèªãã§ãã ããããŸããdh_makeã³ãã³ãã䜿çšããŠããã±ãŒãžã¹ã±ã«ãã³ãäœæããããšãã§ããŸãã
- ããã±ãŒãžã§ããã¥ã¡ã³ããäœæããé«åºŠãªæ¹æ³ïŒãã¡ã€ã«DEBIAN / docsãDEBIAN / manpage *
- åæåã¹ã¯ãªããã®äœæ
- cronãžã§ã管ç
- gpgããŒã§ãªããžããªã«çœ²åãã
UPDïŒ @ ICD2 ã¯ãããã±ãŒãžãäœæããããã®GUIããã°ã©ã ïŒGiftWrapãããããšãææ¡ããŠããŸãã
也æ¯ïŒ :)
PSèšäºã«ã¯ããããééãã誀ãããããŸãã圌女ãäžç·ã«ãšãããŸãããïŒ :)