installer.sh 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. #!/bin/sh
  2. # Copyright (c) Tailscale Inc & AUTHORS
  3. # SPDX-License-Identifier: BSD-3-Clause
  4. #
  5. # This script detects the current operating system, and installs
  6. # Tailscale according to that OS's conventions.
  7. set -eu
  8. # All the code is wrapped in a main function that gets called at the
  9. # bottom of the file, so that a truncated partial download doesn't end
  10. # up executing half a script.
  11. main() {
  12. # Step 1: detect the current linux distro, version, and packaging system.
  13. #
  14. # We rely on a combination of 'uname' and /etc/os-release to find
  15. # an OS name and version, and from there work out what
  16. # installation method we should be using.
  17. #
  18. # The end result of this step is that the following three
  19. # variables are populated, if detection was successful.
  20. OS=""
  21. VERSION=""
  22. PACKAGETYPE=""
  23. APT_KEY_TYPE="" # Only for apt-based distros
  24. APT_SYSTEMCTL_START=false # Only needs to be true for Kali
  25. TRACK="${TRACK:-stable}"
  26. case "$TRACK" in
  27. stable|unstable)
  28. ;;
  29. *)
  30. echo "unsupported track $TRACK"
  31. exit 1
  32. ;;
  33. esac
  34. if [ -f /etc/os-release ]; then
  35. # /etc/os-release populates a number of shell variables. We care about the following:
  36. # - ID: the short name of the OS (e.g. "debian", "freebsd")
  37. # - VERSION_ID: the numeric release version for the OS, if any (e.g. "18.04")
  38. # - VERSION_CODENAME: the codename of the OS release, if any (e.g. "buster")
  39. # - UBUNTU_CODENAME: if it exists, use instead of VERSION_CODENAME
  40. . /etc/os-release
  41. case "$ID" in
  42. ubuntu|pop|neon|zorin|tuxedo)
  43. OS="ubuntu"
  44. if [ "${UBUNTU_CODENAME:-}" != "" ]; then
  45. VERSION="$UBUNTU_CODENAME"
  46. else
  47. VERSION="$VERSION_CODENAME"
  48. fi
  49. PACKAGETYPE="apt"
  50. # Third-party keyrings became the preferred method of
  51. # installation in Ubuntu 20.04.
  52. if expr "$VERSION_ID" : "2.*" >/dev/null; then
  53. APT_KEY_TYPE="keyring"
  54. else
  55. APT_KEY_TYPE="legacy"
  56. fi
  57. ;;
  58. debian)
  59. OS="$ID"
  60. VERSION="$VERSION_CODENAME"
  61. PACKAGETYPE="apt"
  62. # Third-party keyrings became the preferred method of
  63. # installation in Debian 11 (Bullseye).
  64. if [ -z "${VERSION_ID:-}" ]; then
  65. # rolling release. If you haven't kept current, that's on you.
  66. APT_KEY_TYPE="keyring"
  67. # Parrot Security is a special case that uses ID=debian
  68. elif [ "$NAME" = "Parrot Security" ]; then
  69. # All versions new enough to have this behaviour prefer keyring
  70. # and their VERSION_ID is not consistent with Debian.
  71. APT_KEY_TYPE="keyring"
  72. # They don't specify the Debian version they're based off in os-release
  73. # but Parrot 6 is based on Debian 12 Bookworm.
  74. VERSION=bookworm
  75. elif [ "$VERSION_ID" -lt 11 ]; then
  76. APT_KEY_TYPE="legacy"
  77. else
  78. APT_KEY_TYPE="keyring"
  79. fi
  80. ;;
  81. linuxmint)
  82. if [ "${UBUNTU_CODENAME:-}" != "" ]; then
  83. OS="ubuntu"
  84. VERSION="$UBUNTU_CODENAME"
  85. elif [ "${DEBIAN_CODENAME:-}" != "" ]; then
  86. OS="debian"
  87. VERSION="$DEBIAN_CODENAME"
  88. else
  89. OS="ubuntu"
  90. VERSION="$VERSION_CODENAME"
  91. fi
  92. PACKAGETYPE="apt"
  93. if [ "$VERSION_ID" -lt 5 ]; then
  94. APT_KEY_TYPE="legacy"
  95. else
  96. APT_KEY_TYPE="keyring"
  97. fi
  98. ;;
  99. elementary)
  100. OS="ubuntu"
  101. VERSION="$UBUNTU_CODENAME"
  102. PACKAGETYPE="apt"
  103. if [ "$VERSION_ID" -lt 6 ]; then
  104. APT_KEY_TYPE="legacy"
  105. else
  106. APT_KEY_TYPE="keyring"
  107. fi
  108. ;;
  109. parrot|mendel)
  110. OS="debian"
  111. PACKAGETYPE="apt"
  112. if [ "$VERSION_ID" -lt 5 ]; then
  113. VERSION="buster"
  114. APT_KEY_TYPE="legacy"
  115. else
  116. VERSION="bullseye"
  117. APT_KEY_TYPE="keyring"
  118. fi
  119. ;;
  120. galliumos)
  121. OS="ubuntu"
  122. PACKAGETYPE="apt"
  123. VERSION="bionic"
  124. APT_KEY_TYPE="legacy"
  125. ;;
  126. pureos|kaisen)
  127. OS="debian"
  128. PACKAGETYPE="apt"
  129. VERSION="bullseye"
  130. APT_KEY_TYPE="keyring"
  131. ;;
  132. raspbian)
  133. OS="$ID"
  134. VERSION="$VERSION_CODENAME"
  135. PACKAGETYPE="apt"
  136. # Third-party keyrings became the preferred method of
  137. # installation in Raspbian 11 (Bullseye).
  138. if [ "$VERSION_ID" -lt 11 ]; then
  139. APT_KEY_TYPE="legacy"
  140. else
  141. APT_KEY_TYPE="keyring"
  142. fi
  143. ;;
  144. kali)
  145. OS="debian"
  146. PACKAGETYPE="apt"
  147. YEAR="$(echo "$VERSION_ID" | cut -f1 -d.)"
  148. APT_SYSTEMCTL_START=true
  149. # Third-party keyrings became the preferred method of
  150. # installation in Debian 11 (Bullseye), which Kali switched
  151. # to in roughly 2021.x releases
  152. if [ "$YEAR" -lt 2021 ]; then
  153. # Kali VERSION_ID is "kali-rolling", which isn't distinguishing
  154. VERSION="buster"
  155. APT_KEY_TYPE="legacy"
  156. else
  157. VERSION="bullseye"
  158. APT_KEY_TYPE="keyring"
  159. fi
  160. ;;
  161. Deepin|deepin) # https://github.com/tailscale/tailscale/issues/7862
  162. OS="debian"
  163. PACKAGETYPE="apt"
  164. if [ "$VERSION_ID" -lt 20 ]; then
  165. APT_KEY_TYPE="legacy"
  166. VERSION="buster"
  167. else
  168. APT_KEY_TYPE="keyring"
  169. VERSION="bullseye"
  170. fi
  171. ;;
  172. pika)
  173. PACKAGETYPE="apt"
  174. # All versions of PikaOS are new enough to prefer keyring
  175. APT_KEY_TYPE="keyring"
  176. # Older versions of PikaOS are based on Ubuntu rather than Debian
  177. if [ "$VERSION_ID" -lt 4 ]; then
  178. OS="ubuntu"
  179. VERSION="$UBUNTU_CODENAME"
  180. else
  181. OS="debian"
  182. VERSION="$DEBIAN_CODENAME"
  183. fi
  184. ;;
  185. centos)
  186. OS="$ID"
  187. VERSION="$VERSION_ID"
  188. PACKAGETYPE="dnf"
  189. if [ "$VERSION" = "7" ]; then
  190. PACKAGETYPE="yum"
  191. fi
  192. ;;
  193. ol)
  194. OS="oracle"
  195. VERSION="$(echo "$VERSION_ID" | cut -f1 -d.)"
  196. PACKAGETYPE="dnf"
  197. if [ "$VERSION" = "7" ]; then
  198. PACKAGETYPE="yum"
  199. fi
  200. ;;
  201. rhel)
  202. OS="$ID"
  203. VERSION="$(echo "$VERSION_ID" | cut -f1 -d.)"
  204. PACKAGETYPE="dnf"
  205. if [ "$VERSION" = "7" ]; then
  206. PACKAGETYPE="yum"
  207. fi
  208. ;;
  209. fedora)
  210. OS="$ID"
  211. VERSION=""
  212. PACKAGETYPE="dnf"
  213. ;;
  214. rocky|almalinux|nobara|openmandriva|sangoma|risios|cloudlinux|alinux|fedora-asahi-remix)
  215. OS="fedora"
  216. VERSION=""
  217. PACKAGETYPE="dnf"
  218. ;;
  219. amzn)
  220. OS="amazon-linux"
  221. VERSION="$VERSION_ID"
  222. PACKAGETYPE="yum"
  223. ;;
  224. xenenterprise)
  225. OS="centos"
  226. VERSION="$(echo "$VERSION_ID" | cut -f1 -d.)"
  227. PACKAGETYPE="yum"
  228. ;;
  229. opensuse-leap|sles)
  230. OS="opensuse"
  231. VERSION="leap/$VERSION_ID"
  232. PACKAGETYPE="zypper"
  233. ;;
  234. opensuse-tumbleweed)
  235. OS="opensuse"
  236. VERSION="tumbleweed"
  237. PACKAGETYPE="zypper"
  238. ;;
  239. sle-micro-rancher)
  240. OS="opensuse"
  241. VERSION="leap/15.4"
  242. PACKAGETYPE="zypper"
  243. ;;
  244. arch|archarm|endeavouros|blendos|garuda|archcraft|cachyos)
  245. OS="arch"
  246. VERSION="" # rolling release
  247. PACKAGETYPE="pacman"
  248. ;;
  249. manjaro|manjaro-arm)
  250. OS="manjaro"
  251. VERSION="" # rolling release
  252. PACKAGETYPE="pacman"
  253. ;;
  254. alpine)
  255. OS="$ID"
  256. VERSION="$VERSION_ID"
  257. PACKAGETYPE="apk"
  258. ;;
  259. postmarketos)
  260. OS="alpine"
  261. VERSION="$VERSION_ID"
  262. PACKAGETYPE="apk"
  263. ;;
  264. nixos)
  265. echo "Please add Tailscale to your NixOS configuration directly:"
  266. echo
  267. echo "services.tailscale.enable = true;"
  268. exit 1
  269. ;;
  270. void)
  271. OS="$ID"
  272. VERSION="" # rolling release
  273. PACKAGETYPE="xbps"
  274. ;;
  275. gentoo)
  276. OS="$ID"
  277. VERSION="" # rolling release
  278. PACKAGETYPE="emerge"
  279. ;;
  280. freebsd)
  281. OS="$ID"
  282. VERSION="$(echo "$VERSION_ID" | cut -f1 -d.)"
  283. PACKAGETYPE="pkg"
  284. ;;
  285. osmc)
  286. OS="debian"
  287. PACKAGETYPE="apt"
  288. VERSION="bullseye"
  289. APT_KEY_TYPE="keyring"
  290. ;;
  291. photon)
  292. OS="photon"
  293. VERSION="$(echo "$VERSION_ID" | cut -f1 -d.)"
  294. PACKAGETYPE="tdnf"
  295. ;;
  296. # TODO: wsl?
  297. # TODO: synology? qnap?
  298. esac
  299. fi
  300. # If we failed to detect something through os-release, consult
  301. # uname and try to infer things from that.
  302. if [ -z "$OS" ]; then
  303. if type uname >/dev/null 2>&1; then
  304. case "$(uname)" in
  305. FreeBSD)
  306. # FreeBSD before 12.2 doesn't have
  307. # /etc/os-release, so we wouldn't have found it in
  308. # the os-release probing above.
  309. OS="freebsd"
  310. VERSION="$(freebsd-version | cut -f1 -d.)"
  311. PACKAGETYPE="pkg"
  312. ;;
  313. OpenBSD)
  314. OS="openbsd"
  315. VERSION="$(uname -r)"
  316. PACKAGETYPE=""
  317. ;;
  318. Darwin)
  319. OS="macos"
  320. VERSION="$(sw_vers -productVersion | cut -f1-2 -d.)"
  321. PACKAGETYPE="appstore"
  322. ;;
  323. Linux)
  324. OS="other-linux"
  325. VERSION=""
  326. PACKAGETYPE=""
  327. ;;
  328. esac
  329. fi
  330. fi
  331. # Ideally we want to use curl, but on some installs we
  332. # only have wget. Detect and use what's available.
  333. CURL=
  334. if type curl >/dev/null; then
  335. CURL="curl -fsSL"
  336. elif type wget >/dev/null; then
  337. CURL="wget -q -O-"
  338. fi
  339. if [ -z "$CURL" ]; then
  340. echo "The installer needs either curl or wget to download files."
  341. echo "Please install either curl or wget to proceed."
  342. exit 1
  343. fi
  344. TEST_URL="https://pkgs.tailscale.com/"
  345. RC=0
  346. TEST_OUT=$($CURL "$TEST_URL" 2>&1) || RC=$?
  347. if [ $RC != 0 ]; then
  348. echo "The installer cannot reach $TEST_URL"
  349. echo "Please make sure that your machine has internet access."
  350. echo "Test output:"
  351. echo $TEST_OUT
  352. exit 1
  353. fi
  354. # Step 2: having detected an OS we support, is it one of the
  355. # versions we support?
  356. OS_UNSUPPORTED=
  357. case "$OS" in
  358. ubuntu|debian|raspbian|centos|oracle|rhel|amazon-linux|opensuse|photon)
  359. # Check with the package server whether a given version is supported.
  360. URL="https://pkgs.tailscale.com/$TRACK/$OS/$VERSION/installer-supported"
  361. $CURL "$URL" 2> /dev/null | grep -q OK || OS_UNSUPPORTED=1
  362. ;;
  363. fedora)
  364. # All versions supported, no version checking required.
  365. ;;
  366. arch)
  367. # Rolling release, no version checking needed.
  368. ;;
  369. manjaro)
  370. # Rolling release, no version checking needed.
  371. ;;
  372. alpine)
  373. # All versions supported, no version checking needed.
  374. # TODO: is that true? When was tailscale packaged?
  375. ;;
  376. void)
  377. # Rolling release, no version checking needed.
  378. ;;
  379. gentoo)
  380. # Rolling release, no version checking needed.
  381. ;;
  382. freebsd)
  383. if [ "$VERSION" != "12" ] && \
  384. [ "$VERSION" != "13" ]
  385. then
  386. OS_UNSUPPORTED=1
  387. fi
  388. ;;
  389. openbsd)
  390. OS_UNSUPPORTED=1
  391. ;;
  392. macos)
  393. # We delegate macOS installation to the app store, it will
  394. # perform version checks for us.
  395. ;;
  396. other-linux)
  397. OS_UNSUPPORTED=1
  398. ;;
  399. *)
  400. OS_UNSUPPORTED=1
  401. ;;
  402. esac
  403. if [ "$OS_UNSUPPORTED" = "1" ]; then
  404. case "$OS" in
  405. other-linux)
  406. echo "Couldn't determine what kind of Linux is running."
  407. echo "You could try the static binaries at:"
  408. echo "https://pkgs.tailscale.com/$TRACK/#static"
  409. ;;
  410. "")
  411. echo "Couldn't determine what operating system you're running."
  412. ;;
  413. *)
  414. echo "$OS $VERSION isn't supported by this script yet."
  415. ;;
  416. esac
  417. echo
  418. echo "If you'd like us to support your system better, please email [email protected]"
  419. echo "and tell us what OS you're running."
  420. echo
  421. echo "Please include the following information we gathered from your system:"
  422. echo
  423. echo "OS=$OS"
  424. echo "VERSION=$VERSION"
  425. echo "PACKAGETYPE=$PACKAGETYPE"
  426. if type uname >/dev/null 2>&1; then
  427. echo "UNAME=$(uname -a)"
  428. else
  429. echo "UNAME="
  430. fi
  431. echo
  432. if [ -f /etc/os-release ]; then
  433. cat /etc/os-release
  434. else
  435. echo "No /etc/os-release"
  436. fi
  437. exit 1
  438. fi
  439. # Step 3: work out if we can run privileged commands, and if so,
  440. # how.
  441. CAN_ROOT=
  442. SUDO=
  443. if [ "$(id -u)" = 0 ]; then
  444. CAN_ROOT=1
  445. SUDO=""
  446. elif type sudo >/dev/null; then
  447. CAN_ROOT=1
  448. SUDO="sudo"
  449. elif type doas >/dev/null; then
  450. CAN_ROOT=1
  451. SUDO="doas"
  452. fi
  453. if [ "$CAN_ROOT" != "1" ]; then
  454. echo "This installer needs to run commands as root."
  455. echo "We tried looking for 'sudo' and 'doas', but couldn't find them."
  456. echo "Either re-run this script as root, or set up sudo/doas."
  457. exit 1
  458. fi
  459. # Step 4: run the installation.
  460. OSVERSION="$OS"
  461. [ "$VERSION" != "" ] && OSVERSION="$OSVERSION $VERSION"
  462. echo "Installing Tailscale for $OSVERSION, using method $PACKAGETYPE"
  463. case "$PACKAGETYPE" in
  464. apt)
  465. export DEBIAN_FRONTEND=noninteractive
  466. if [ "$APT_KEY_TYPE" = "legacy" ] && ! type gpg >/dev/null; then
  467. $SUDO apt-get update
  468. $SUDO apt-get install -y gnupg
  469. fi
  470. set -x
  471. $SUDO mkdir -p --mode=0755 /usr/share/keyrings
  472. case "$APT_KEY_TYPE" in
  473. legacy)
  474. $CURL "https://pkgs.tailscale.com/$TRACK/$OS/$VERSION.asc" | $SUDO apt-key add -
  475. $CURL "https://pkgs.tailscale.com/$TRACK/$OS/$VERSION.list" | $SUDO tee /etc/apt/sources.list.d/tailscale.list
  476. ;;
  477. keyring)
  478. $CURL "https://pkgs.tailscale.com/$TRACK/$OS/$VERSION.noarmor.gpg" | $SUDO tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
  479. $CURL "https://pkgs.tailscale.com/$TRACK/$OS/$VERSION.tailscale-keyring.list" | $SUDO tee /etc/apt/sources.list.d/tailscale.list
  480. ;;
  481. esac
  482. $SUDO apt-get update
  483. $SUDO apt-get install -y tailscale tailscale-archive-keyring
  484. if [ "$APT_SYSTEMCTL_START" = "true" ]; then
  485. $SUDO systemctl enable --now tailscaled
  486. $SUDO systemctl start tailscaled
  487. fi
  488. set +x
  489. ;;
  490. yum)
  491. set -x
  492. $SUDO yum install yum-utils -y
  493. $SUDO yum-config-manager -y --add-repo "https://pkgs.tailscale.com/$TRACK/$OS/$VERSION/tailscale.repo"
  494. $SUDO yum install tailscale -y
  495. $SUDO systemctl enable --now tailscaled
  496. set +x
  497. ;;
  498. dnf)
  499. # DNF 5 has a different argument format; determine which one we have.
  500. DNF_VERSION="3"
  501. if dnf --version | grep -q '^dnf5 version'; then
  502. DNF_VERSION="5"
  503. fi
  504. # The 'config-manager' plugin wasn't implemented when
  505. # DNF5 was released; detect that and use the old
  506. # version if necessary.
  507. if [ "$DNF_VERSION" = "5" ]; then
  508. set -x
  509. $SUDO dnf install -y 'dnf-command(config-manager)' && DNF_HAVE_CONFIG_MANAGER=1 || DNF_HAVE_CONFIG_MANAGER=0
  510. set +x
  511. if [ "$DNF_HAVE_CONFIG_MANAGER" != "1" ]; then
  512. if type dnf-3 >/dev/null; then
  513. DNF_VERSION="3"
  514. else
  515. echo "dnf 5 detected, but 'dnf-command(config-manager)' not available and dnf-3 not found"
  516. exit 1
  517. fi
  518. fi
  519. fi
  520. set -x
  521. if [ "$DNF_VERSION" = "3" ]; then
  522. $SUDO dnf install -y 'dnf-command(config-manager)'
  523. $SUDO dnf config-manager --add-repo "https://pkgs.tailscale.com/$TRACK/$OS/$VERSION/tailscale.repo"
  524. elif [ "$DNF_VERSION" = "5" ]; then
  525. # Already installed config-manager, above.
  526. $SUDO dnf config-manager addrepo --from-repofile="https://pkgs.tailscale.com/$TRACK/$OS/$VERSION/tailscale.repo"
  527. else
  528. echo "unexpected: unknown dnf version $DNF_VERSION"
  529. exit 1
  530. fi
  531. $SUDO dnf install -y tailscale
  532. $SUDO systemctl enable --now tailscaled
  533. set +x
  534. ;;
  535. tdnf)
  536. set -x
  537. curl -fsSL "https://pkgs.tailscale.com/$TRACK/$OS/$VERSION/tailscale.repo" > /etc/yum.repos.d/tailscale.repo
  538. $SUDO tdnf install -y tailscale
  539. $SUDO systemctl enable --now tailscaled
  540. set +x
  541. ;;
  542. zypper)
  543. set -x
  544. $SUDO rpm --import "https://pkgs.tailscale.com/$TRACK/$OS/$VERSION/repo.gpg"
  545. $SUDO zypper --non-interactive ar -g -r "https://pkgs.tailscale.com/$TRACK/$OS/$VERSION/tailscale.repo"
  546. $SUDO zypper --non-interactive --gpg-auto-import-keys refresh
  547. $SUDO zypper --non-interactive install tailscale
  548. $SUDO systemctl enable --now tailscaled
  549. set +x
  550. ;;
  551. pacman)
  552. set -x
  553. $SUDO pacman -S tailscale --noconfirm
  554. $SUDO systemctl enable --now tailscaled
  555. set +x
  556. ;;
  557. pkg)
  558. set -x
  559. $SUDO pkg install tailscale
  560. $SUDO service tailscaled enable
  561. $SUDO service tailscaled start
  562. set +x
  563. ;;
  564. apk)
  565. set -x
  566. if ! grep -Eq '^http.*/community$' /etc/apk/repositories; then
  567. if type setup-apkrepos >/dev/null; then
  568. $SUDO setup-apkrepos -c -1
  569. else
  570. echo "installing tailscale requires the community repo to be enabled in /etc/apk/repositories"
  571. exit 1
  572. fi
  573. fi
  574. $SUDO apk add tailscale
  575. $SUDO rc-update add tailscale
  576. $SUDO rc-service tailscale start
  577. set +x
  578. ;;
  579. xbps)
  580. set -x
  581. $SUDO xbps-install tailscale -y
  582. set +x
  583. ;;
  584. emerge)
  585. set -x
  586. $SUDO emerge --ask=n net-vpn/tailscale
  587. set +x
  588. ;;
  589. appstore)
  590. set -x
  591. open "https://apps.apple.com/us/app/tailscale/id1475387142"
  592. set +x
  593. ;;
  594. *)
  595. echo "unexpected: unknown package type $PACKAGETYPE"
  596. exit 1
  597. ;;
  598. esac
  599. echo "Installation complete! Log in to start using Tailscale by running:"
  600. echo
  601. if [ -z "$SUDO" ]; then
  602. echo "tailscale up"
  603. else
  604. echo "$SUDO tailscale up"
  605. fi
  606. }
  607. main