Merge lp:~nik90/component-store/improve-ucs-script into lp:component-store

Proposed by Nekhelesh Ramananthan
Status: Merged
Merged at revision: 35
Proposed branch: lp:~nik90/component-store/improve-ucs-script
Merge into: lp:component-store
Diff against target: 142 lines (+50/-26)
2 files modified
script/debian/changelog (+8/-0)
script/ucs (+42/-26)
To merge this branch: bzr merge lp:~nik90/component-store/improve-ucs-script
Reviewer Review Type Date Requested Status
Ubuntu Touch Community Dev Pending
Review via email: mp+241211@code.launchpad.net

Commit message

- Fixed typos in the help command
- Improved install and update command to use less network bandwidth

Description of the change

- Fixed typos in the help command
- Improved install and update command to use less network bandwidth

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'script/debian/changelog'
--- script/debian/changelog 2014-11-08 23:03:50 +0000
+++ script/debian/changelog 2014-11-09 15:39:04 +0000
@@ -1,3 +1,11 @@
1ucs (0.1.2) trusty; urgency=medium
2
3 * Improved install and update command to use less network bandwidth by only
4 downloading the necessary components.
5 * Fixed some typos in the help command.
6
7 -- Nekhelesh Ramananthan <krnekhelesh@gmail.com> Sun, 09 Nov 2014 16:36:31 +0100
8
1ucs (0.1.1) trusty; urgency=medium9ucs (0.1.1) trusty; urgency=medium
210
3 * Fixed install path to usr/bin11 * Fixed install path to usr/bin
412
=== modified file 'script/ucs'
--- script/ucs 2014-11-08 22:37:17 +0000
+++ script/ucs 2014-11-09 15:39:04 +0000
@@ -4,6 +4,7 @@
4PWD=$(pwd)4PWD=$(pwd)
5ARGS=("$@")5ARGS=("$@")
6UCS_BRANCH=lp:component-store6UCS_BRANCH=lp:component-store
7UCS_FILEPATH=lp:~ubuntu-touch-community-dev/component-store/trunk.14.10/ComponentStore
7BOOTSTRAP_FOLDER=${PWD}/ComponentStoreSetup8BOOTSTRAP_FOLDER=${PWD}/ComponentStoreSetup
89
9# Color Output10# Color Output
@@ -12,13 +13,14 @@
12NC='\e[0m'13NC='\e[0m'
1314
14show_usage() {15show_usage() {
15 echo "Usage: $0 [OPTION].. [OTHER ARGUMENTS]"16 echo "Usage:"
17 echo " ucs <command> [options]"
16 echo ""18 echo ""
17 echo "options:"19 echo "Commands:"
18 echo -e "\tinstall [COMPONENT]\tInstall Component"20 echo -e " install \tInstall Components"
19 echo -e "\tupdate [COMPONENT]\tUpdate Component"21 echo -e " update \tUpdate Components"
20 echo -e "\thelp \tdisplay this help and exit"22 echo -e " help \tdisplay this help and exit"
21 echo -e "\tversion \toutput version information and exit"23 echo -e " version \toutput version information and exit"
22}24}
2325
24install_prerequisites() {26install_prerequisites() {
@@ -41,59 +43,73 @@
4143
42#CASE: ABOUT ARGUMENT44#CASE: ABOUT ARGUMENT
43elif [[ $1 == "version" ]]; then45elif [[ $1 == "version" ]]; then
44 echo "Ubuntu Component Store (UCS) v0.1"46 echo "Ubuntu Component Store (UCS) v0.1.2"
45 echo "Copyright (C) 2014 Ubuntu Touch Community Dev Team"47 echo "Copyright (C) 2014 Ubuntu Touch Community Dev Team"
46 echo "License GPLv3: GNU version 3 <http://gnu.org/licenses/gpl.html>."48 echo "License GPLv3: GNU version 3 <http://gnu.org/licenses/gpl.html>."
47 echo "This is free software: you are free to change and redistribute it."49 echo "This is free software: you are free to change and redistribute it."
48 echo "There is NO WARRANTY, to the extent permitted by law."50 echo "There is NO WARRANTY, to the extent permitted by law."
49 echo51 echo
50 echo "Written by Nekhelesh Ramananthan"52 echo "Written by Ubuntu Touch Community Dev"
51 exit 053 exit 0
5254
53#CASE: INSTALL ARGUMENT55#CASE: INSTALL ARGUMENT
54elif [[ $1 == "install" ]]; then56elif [[ $1 == "install" ]]; then
55 install_prerequisites57 install_prerequisites
56 echo "Grabbing the latest upstream code..."
57 bzr branch -q $UCS_BRANCH $BOOTSTRAP_FOLDER
58 if [ $# -gt 1 ]; then58 if [ $# -gt 1 ]; then
59 for (( i=1; i<$#; i++ ))59 for (( i=1; i<$#; i++ ))
60 do60 do
61 if [ -d $BOOTSTRAP_FOLDER/ComponentStore/${ARGS[$i]} ]; then61 echo -n "[$i/`expr $# - 1`] Installing ${ARGS[$i]}..."
62 echo -e "Installing ${ARGS[$i]}...${GC}DONE${NC}"62 componentfilelist=(`bzr ls -q $UCS_FILEPATH/${ARGS[$i]}`)
63 mv $BOOTSTRAP_FOLDER/ComponentStore/${ARGS[$i]}/* ${PWD}63 componentfilelistcount=${#componentfilelist[@]}
64 if (( componentfilelistcount == 0 )); then
65 echo -e "${RC}FAILED${NC} (Invalid component name)"
64 else66 else
65 echo -e "Installing ${ARGS[$i]}...${RC}FAILED${NC} (Invalid component name)"67 for (( j=0; j<componentfilelistcount; j++ ))
68 do
69 filename=$(basename ${componentfilelist[j]})
70 bzr cat -q ${componentfilelist[j]} > ${PWD}/${filename}
71 done
72 echo -e "${GC}DONE${NC}"
66 fi73 fi
67 done74 done
68 else75 else
69 echo -e "Installing all components...${GC}DONE${NC}"76 echo -n "Installing all components..."
70 componentlist=(`ls $BOOTSTRAP_FOLDER/ComponentStore`)77 componentlist=(`bzr ls -q $UCS_FILEPATH`)
71 componentlistcount=${#componentlist[@]}78 componentlistcount=${#componentlist[@]}
72 for (( i=0; i<componentlistcount; i++ ))79 for (( i=0; i<componentlistcount; i++ ))
73 do80 do
74 mv $BOOTSTRAP_FOLDER/ComponentStore/${componentlist[i]}/* ${PWD}81 componentfilelist=(`bzr ls -q ${componentlist[i]}`)
82 componentfilelistcount=${#componentfilelist[@]}
83 for (( j=0; j<componentfilelistcount; j++ ))
84 do
85 bzr cat -q ${componentlist[i]}${componentfilelist[j]} > ${PWD}/${componentfilelist[j]}
86 done
75 done87 done
88 echo -e "${GC}DONE${NC}"
76 fi89 fi
77 rm -r $BOOTSTRAP_FOLDER
78 echo -e "${GC}Installation Complete!${NC}"90 echo -e "${GC}Installation Complete!${NC}"
7991
80#CASE: UPDATE ARGUMENT92#CASE: UPDATE ARGUMENT
81elif [[ $1 == "update" ]]; then93elif [[ $1 == "update" ]]; then
82 if [ $# -gt 1 ]; then94 if [ $# -gt 1 ]; then
83 echo "Grabbing the latest upstream code..."
84 bzr branch -q $UCS_BRANCH $BOOTSTRAP_FOLDER
85 for (( i=1; i<$#; i++ ))95 for (( i=1; i<$#; i++ ))
86 do96 do
87 if [ -d $BOOTSTRAP_FOLDER/ComponentStore/${ARGS[$i]} ]; then97 echo -n "[$i/`expr $# - 1`] Updating ${ARGS[$i]}..."
88 echo -e "Updating ${ARGS[$i]}...${GC}DONE${NC}"98 componentfilelist=(`bzr ls -q $UCS_FILEPATH/${ARGS[$i]}`)
89 mv $BOOTSTRAP_FOLDER/ComponentStore/${ARGS[$i]}/* ${PWD}99 componentfilelistcount=${#componentfilelist[@]}
100 if (( componentfilelistcount == 0 )); then
101 echo -e "${RC}FAILED${NC} (Invalid component name)"
90 else102 else
91 echo -e "Updating ${ARGS[$i]}...${RC}FAILED${NC} (Invalid component name)"103 for (( j=0; j<componentfilelistcount; j++ ))
104 do
105 filename=$(basename ${componentfilelist[j]})
106 bzr cat -q ${componentfilelist[j]} > ${PWD}/${filename}
107 done
108 echo -e "${GC}DONE${NC}"
92 fi109 fi
93 done110 done
94 rm -r $BOOTSTRAP_FOLDER
95 echo -e "${GC}Updating Components Complete!${NC}"111 echo -e "${GC}Updating Components Complete!${NC}"
96 else112 else
97 echo -e "${RC}Error updating components! Please specify the component name you want to update. Eg. ./ucs update EmptyState${NC}"113 echo -e "${RC}Error updating components! Please specify the component name you want to update. Eg. ucs update EmptyState${NC}"
98 fi114 fi
99fi115fi

Subscribers

People subscribed via source and target branches